Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4bbe6c6

Browse filesBrowse files
committed
Merge branch '2.3' into 2.6
Conflicts: book/templating.rst components/class_loader/class_loader.rst components/class_loader/debug_class_loader.rst components/class_loader/introduction.rst components/config/definition.rst components/dependency_injection/compilation.rst components/dependency_injection/factories.rst components/event_dispatcher/immutable_dispatcher.rst components/event_dispatcher/introduction.rst
2 parents 2874a67 + 1ce8fb1 commit 4bbe6c6
Copy full SHA for 4bbe6c6

36 files changed

+665
-569
lines changed

‎book/from_flat_php_to_symfony2.rst

Copy file name to clipboardExpand all lines: book/from_flat_php_to_symfony2.rst
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ an individual blog result based on a given id::
266266
$link = open_database_connection();
267267

268268
$id = intval($id);
269-
$query = 'SELECT date, title, body FROM post WHERE id = '.$id;
269+
$query = 'SELECT created_at, title, body FROM post WHERE id = '.$id;
270270
$result = mysql_query($query);
271271
$row = mysql_fetch_assoc($result);
272272

@@ -297,7 +297,7 @@ the individual blog post:
297297
<?php ob_start() ?>
298298
<h1><?php echo $post['title'] ?></h1>
299299

300-
<div class="date"><?php echo $post['date'] ?></div>
300+
<div class="date"><?php echo $post['created_at'] ?></div>
301301
<div class="body">
302302
<?php echo $post['body'] ?>
303303
</div>

‎book/templating.rst

Copy file name to clipboardExpand all lines: book/templating.rst
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -579,6 +579,10 @@ you set `with_context`_ to false).
579579
maps (i.e. an array with named keys). If you needed to pass in multiple
580580
elements, it would look like this: ``{'foo': foo, 'bar': bar}``.
581581

582+
.. versionadded:: 2.3
583+
The `include() function`_ is a new Twig feature that's available in Symfony
584+
2.3. Prior, the `{% include %} tag`_ tag was used.
585+
582586
.. index::
583587
single: Templating; Embedding action
584588

‎components/class_loader/class_loader.rst

Copy file name to clipboardExpand all lines: components/class_loader/class_loader.rst
+17-17Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
The PSR-0 Class Loader
55
======================
66

7-
If your classes and third-party libraries follow the `PSR-0`_ standard, you
8-
can use the :class:`Symfony\\Component\\ClassLoader\\ClassLoader` class to
9-
load all of your project's classes.
7+
If your classes and third-party libraries follow the `PSR-0`_ standard,
8+
you can use the :class:`Symfony\\Component\\ClassLoader\\ClassLoader` class
9+
to load all of your project's classes.
1010

1111
.. tip::
1212

13-
You can use both the ``ApcClassLoader`` and the ``XcacheClassLoader`` to
14-
:doc:`cache </components/class_loader/cache_class_loader>` a ``ClassLoader``
13+
You can use both the ``ApcClassLoader`` and the ``XcacheClassLoader``
14+
to :doc:`cache </components/class_loader/cache_class_loader>` a ``ClassLoader``
1515
instance.
1616

1717
Usage
@@ -35,12 +35,12 @@ is straightforward::
3535

3636
.. note::
3737

38-
The autoloader is automatically registered in a Symfony application (see
39-
``app/autoload.php``).
38+
The autoloader is automatically registered in a Symfony application
39+
(see ``app/autoload.php``).
4040

41-
Use the :method:`Symfony\\Component\\ClassLoader\\ClassLoader::addPrefix` or
42-
:method:`Symfony\\Component\\ClassLoader\\ClassLoader::addPrefixes` methods to
43-
register your classes::
41+
Use :method:`Symfony\\Component\\ClassLoader\\ClassLoader::addPrefix` or
42+
:method:`Symfony\\Component\\ClassLoader\\ClassLoader::addPrefixes` to register
43+
your classes::
4444

4545
// register a single namespaces
4646
$loader->addPrefix('Symfony', __DIR__.'/vendor/symfony/symfony/src');
@@ -59,9 +59,9 @@ register your classes::
5959
'Twig_' => __DIR__.'/vendor/twig/twig/lib',
6060
));
6161

62-
Classes from a sub-namespace or a sub-hierarchy of `PEAR`_ classes can be looked
63-
for in a location list to ease the vendoring of a sub-set of classes for large
64-
projects::
62+
Classes from a sub-namespace or a sub-hierarchy of `PEAR`_ classes can be
63+
looked for in a location list to ease the vendoring of a sub-set of classes
64+
for large projects::
6565

6666
$loader->addPrefixes(array(
6767
'Doctrine\\Common' => __DIR__.'/vendor/doctrine/common/lib',
@@ -71,10 +71,10 @@ projects::
7171
));
7272

7373
In this example, if you try to use a class in the ``Doctrine\Common`` namespace
74-
or one of its children, the autoloader will first look for the class under the
75-
``doctrine-common`` directory. If not found, it will then fallback to the default
76-
``Doctrine`` directory (the last one configured) before giving up. The order
77-
of the prefix registrations is significant in this case.
74+
or one of its children, the autoloader will first look for the class under
75+
the ``doctrine-common`` directory. If not found, it will then fallback to
76+
the default ``Doctrine`` directory (the last one configured) before giving
77+
up. The order of the prefix registrations is significant in this case.
7878

7979
.. _PEAR: http://pear.php.net/manual/en/standards.naming.php
8080
.. _PSR-0: http://www.php-fig.org/psr/psr-0/

‎components/class_loader/class_map_generator.rst

Copy file name to clipboardExpand all lines: components/class_loader/class_map_generator.rst
+15-12Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@
55
The Class Map Generator
66
=======================
77

8-
Loading a class usually is an easy task given the `PSR-0`_ and `PSR-4`_ standards.
9-
Thanks to the Symfony ClassLoader component or the autoloading mechanism provided
10-
by Composer, you don't have to map your class names to actual PHP files manually.
11-
Nowadays, PHP libraries usually come with autoloading support through Composer.
8+
Loading a class usually is an easy task given the `PSR-0`_ and `PSR-4`_
9+
standards. Thanks to the Symfony ClassLoader component or the autoloading
10+
mechanism provided by Composer, you don't have to map your class names to
11+
actual PHP files manually. Nowadays, PHP libraries usually come with autoloading
12+
support through Composer.
1213

1314
But from time to time you may have to use a third-party library that comes
1415
without any autoloading support and therefore forces you to load each class
@@ -44,16 +45,17 @@ it possible to create a map of class names to files.
4445
Generating a Class Map
4546
----------------------
4647

47-
To generate the class map, simply pass the root directory of your class files
48-
to the :method:`Symfony\\Component\\ClassLoader\\ClassMapGenerator::createMap`
48+
To generate the class map, simply pass the root directory of your class
49+
files to the
50+
:method:`Symfony\\Component\\ClassLoader\\ClassMapGenerator::createMap`
4951
method::
5052

5153
use Symfony\Component\ClassLoader\ClassMapGenerator;
5254

5355
var_dump(ClassMapGenerator::createMap(__DIR__.'/library'));
5456

55-
Given the files and class from the table above, you should see an output like
56-
this:
57+
Given the files and class from the table above, you should see an output
58+
like this:
5759

5860
.. code-block:: text
5961
@@ -87,8 +89,9 @@ file in the same directory with the following contents::
8789
'Acme\\Bar' => '/var/www/library/bar/Foo.php',
8890
);
8991

90-
Instead of loading each file manually, you'll only have to register the generated
91-
class map with, for example, the :class:`Symfony\\Component\\ClassLoader\\MapClassLoader`::
92+
Instead of loading each file manually, you'll only have to register the
93+
generated class map with, for example, the
94+
:class:`Symfony\\Component\\ClassLoader\\MapClassLoader`::
9295

9396
use Symfony\Component\ClassLoader\MapClassLoader;
9497

@@ -110,8 +113,8 @@ class map with, for example, the :class:`Symfony\\Component\\ClassLoader\\MapCla
110113
component.
111114

112115
Besides dumping the class map for one directory, you can also pass an array
113-
of directories for which to generate the class map (the result actually is
114-
the same as in the example above)::
116+
of directories for which to generate the class map (the result actually
117+
is the same as in the example above)::
115118

116119
use Symfony\Component\ClassLoader\ClassMapGenerator;
117120

‎components/class_loader/introduction.rst

Copy file name to clipboardExpand all lines: components/class_loader/introduction.rst
+5-3Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,12 @@ Usage
1111
-----
1212

1313
Whenever you reference a class that has not been required or included yet,
14-
PHP uses the `autoloading mechanism`_ to delegate the loading of a file defining
15-
the class. Symfony provides three autoloaders, which are able to load your classes:
14+
PHP uses the `autoloading mechanism`_ to delegate the loading of a file
15+
defining the class. Symfony provides three autoloaders, which are able to
16+
load your classes:
1617

1718
* :doc:`/components/class_loader/class_loader`: loads classes that follow
18-
the `PSR-0` class naming standard;
19+
the `PSR-0`_ class naming standard;
1920

2021
* :doc:`/components/class_loader/psr4_class_loader`: loads classes that follow
2122
the `PSR-4` class naming standard;
@@ -43,5 +44,6 @@ You can install the component in 2 different ways:
4344

4445
.. include:: /components/require_autoload.rst.inc
4546

47+
.. _PSR-0: http://www.php-fig.org/psr/psr-0/
4648
.. _`autoloading mechanism`: http://php.net/manual/en/language.oop5.autoload.php
4749
.. _Packagist: https://packagist.org/packages/symfony/class-loader

‎components/class_loader/map_class_loader.rst

Copy file name to clipboardExpand all lines: components/class_loader/map_class_loader.rst
+11-9Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,22 @@
44
MapClassLoader
55
==============
66

7-
The :class:`Symfony\\Component\\ClassLoader\\MapClassLoader` allows you to
8-
autoload files via a static map from classes to files. This is useful if you
9-
use third-party libraries which don't follow the `PSR-0`_ standards and so
10-
can't use the :doc:`PSR-0 class loader </components/class_loader/class_loader>`.
7+
The :class:`Symfony\\Component\\ClassLoader\\MapClassLoader` allows you
8+
to autoload files via a static map from classes to files. This is useful
9+
if you use third-party libraries which don't follow the `PSR-0`_ standards
10+
and so can't use the
11+
:doc:`PSR-0 class loader </components/class_loader/class_loader>`.
1112

12-
The ``MapClassLoader`` can be used along with the :doc:`PSR-0 class loader </components/class_loader/class_loader>`
13-
by configuring and calling the ``register()`` method on both.
13+
The ``MapClassLoader`` can be used along with the
14+
:doc:`PSR-0 class loader </components/class_loader/class_loader>` by
15+
configuring and calling the ``register()`` method on both.
1416

1517
.. note::
1618

1719
The default behavior is to append the ``MapClassLoader`` on the autoload
18-
stack. If you want to use it as the first autoloader, pass ``true`` when
19-
calling the ``register()`` method. Your class loader will then be prepended
20-
on the autoload stack.
20+
stack. If you want to use it as the first autoloader, pass ``true``
21+
when calling the ``register()`` method. Your class loader will then
22+
be prepended on the autoload stack.
2123

2224
Usage
2325
-----

‎components/config/caching.rst

Copy file name to clipboardExpand all lines: components/config/caching.rst
+20-19Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,27 @@
11
.. index::
22
single: Config; Caching based on resources
33

4-
Caching Based on Resources
4+
Caching based on Resources
55
==========================
66

7-
When all configuration resources are loaded, you may want to process the configuration
8-
values and combine them all in one file. This file acts like a cache. Its
9-
contents don’t have to be regenerated every time the application runs – only
10-
when the configuration resources are modified.
7+
When all configuration resources are loaded, you may want to process the
8+
configuration values and combine them all in one file. This file acts
9+
like a cache. Its contents don’t have to be regenerated every time the
10+
application runs – only when the configuration resources are modified.
1111

1212
For example, the Symfony Routing component allows you to load all routes,
1313
and then dump a URL matcher or a URL generator based on these routes. In
14-
this case, when one of the resources is modified (and you are working in a
15-
development environment), the generated file should be invalidated and regenerated.
16-
This can be accomplished by making use of the :class:`Symfony\\Component\\Config\\ConfigCache`
17-
class.
18-
19-
The example below shows you how to collect resources, then generate some code
20-
based on the resources that were loaded, and write this code to the cache. The
21-
cache also receives the collection of resources that were used for generating
22-
the code. By looking at the "last modified" timestamp of these resources,
23-
the cache can tell if it is still fresh or that its contents should be regenerated::
14+
this case, when one of the resources is modified (and you are working
15+
in a development environment), the generated file should be invalidated
16+
and regenerated. This can be accomplished by making use of the
17+
:class:`Symfony\\Component\\Config\\ConfigCache` class.
18+
19+
The example below shows you how to collect resources, then generate some
20+
code based on the resources that were loaded and write this code to the
21+
cache. The cache also receives the collection of resources that were used
22+
for generating the code. By looking at the "last modified" timestamp of
23+
these resources, the cache can tell if it is still fresh or that its contents
24+
should be regenerated::
2425

2526
use Symfony\Component\Config\ConfigCache;
2627
use Symfony\Component\Config\Resource\FileResource;
@@ -52,8 +53,8 @@ the cache can tell if it is still fresh or that its contents should be regenerat
5253
// you may want to require the cached code:
5354
require $cachePath;
5455

55-
In debug mode, a ``.meta`` file will be created in the same directory as the
56-
cache file itself. This ``.meta`` file contains the serialized resources,
57-
whose timestamps are used to determine if the cache is still fresh. When not
58-
in debug mode, the cache is considered to be "fresh" as soon as it exists,
56+
In debug mode, a ``.meta`` file will be created in the same directory as
57+
the cache file itself. This ``.meta`` file contains the serialized resources,
58+
whose timestamps are used to determine if the cache is still fresh. When
59+
not in debug mode, the cache is considered to be "fresh" as soon as it exists,
5960
and therefore no ``.meta`` file will be generated.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.