Skip to content

Commit 3d87527

Browse files
committed
Merge branch '2.0' into 2.1
2 parents 4775365 + c712fdf commit 3d87527

File tree

11 files changed

+89
-29
lines changed

11 files changed

+89
-29
lines changed

CONTRIBUTING.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Contributing
2+
------------
3+
4+
We love contributors! For more information on how you can contribute to the
5+
Symfony documentation, please read [Contributing to the Documentation](http://symfony.com/doc/current/contributing/documentation/overview.html)

book/doctrine.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -722,7 +722,7 @@ To do this, add the name of the repository class to your mapping definition.
722722
use Doctrine\ORM\Mapping as ORM;
723723
724724
/**
725-
* @ORM\Entity(repositoryClass="Acme\StoreBundle\Repository\ProductRepository")
725+
* @ORM\Entity(repositoryClass="Acme\StoreBundle\Entity\ProductRepository")
726726
*/
727727
class Product
728728
{
@@ -734,7 +734,7 @@ To do this, add the name of the repository class to your mapping definition.
734734
# src/Acme/StoreBundle/Resources/config/doctrine/Product.orm.yml
735735
Acme\StoreBundle\Entity\Product:
736736
type: entity
737-
repositoryClass: Acme\StoreBundle\Repository\ProductRepository
737+
repositoryClass: Acme\StoreBundle\Entity\ProductRepository
738738
# ...
739739
740740
.. code-block:: xml
@@ -745,7 +745,7 @@ To do this, add the name of the repository class to your mapping definition.
745745
<doctrine-mapping>
746746
747747
<entity name="Acme\StoreBundle\Entity\Product"
748-
repository-class="Acme\StoreBundle\Repository\ProductRepository">
748+
repository-class="Acme\StoreBundle\Entity\ProductRepository">
749749
<!-- ... -->
750750
</entity>
751751
</doctrine-mapping>
@@ -763,8 +763,8 @@ ordered alphabetically.
763763

764764
.. code-block:: php
765765
766-
// src/Acme/StoreBundle/Repository/ProductRepository.php
767-
namespace Acme\StoreBundle\Repository;
766+
// src/Acme/StoreBundle/Entity/ProductRepository.php
767+
namespace Acme\StoreBundle\Entity;
768768
769769
use Doctrine\ORM\EntityRepository;
770770
@@ -1090,7 +1090,7 @@ Of course, if you know up front that you'll need to access both objects, you
10901090
can avoid the second query by issuing a join in the original query. Add the
10911091
following method to the ``ProductRepository`` class::
10921092

1093-
// src/Acme/StoreBundle/Repository/ProductRepository.php
1093+
// src/Acme/StoreBundle/Entity/ProductRepository.php
10941094
public function findOneByIdJoinedToCategory($id)
10951095
{
10961096
$query = $this->getEntityManager()

book/routing.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,6 +1020,12 @@ instead of simply ``/hello/{name}``:
10201020
The string ``/admin`` will now be prepended to the pattern of each route
10211021
loaded from the new routing resource.
10221022

1023+
.. tip::
1024+
1025+
You can also define routes using annotations. See the
1026+
:doc:`FrameworkExtraBundle documentation</bundles/SensioFrameworkExtraBundle/annotations/routing>`
1027+
to see how.
1028+
10231029
.. index::
10241030
single: Routing; Debugging
10251031

components/dependency_injection/compilation.rst

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,10 @@ A very simple extension may just load configuration files into the container::
6161
{
6262
public function load(array $configs, ContainerBuilder $container)
6363
{
64-
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
64+
$loader = new XmlFileLoader(
65+
$container,
66+
new FileLocator(__DIR__.'/../Resources/config')
67+
);
6568
$loader->load('services.xml');
6669
}
6770

@@ -225,7 +228,10 @@ but also load a secondary one only if a certain parameter is set::
225228
$processor = new Processor();
226229
$config = $processor->processConfiguration($configuration, $configs);
227230

228-
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
231+
$loader = new XmlFileLoader(
232+
$container,
233+
new FileLocator(__DIR__.'/../Resources/config')
234+
);
229235
$loader->load('services.xml');
230236

231237
if ($config['advanced']) {
@@ -309,7 +315,10 @@ For example, to run your custom pass after the default removal passes have been
309315
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
310316

311317
$container = new ContainerBuilder();
312-
$container->addCompilerPass(new CustomCompilerPass, PassConfig::TYPE_AFTER_REMOVING);
318+
$container->addCompilerPass(
319+
new CustomCompilerPass,
320+
PassConfig::TYPE_AFTER_REMOVING
321+
);
313322

314323
.. _components-dependency-injection-dumping:
315324

@@ -357,7 +366,10 @@ it::
357366
$container->compile();
358367

359368
$dumper = new PhpDumper($container);
360-
file_put_contents($file, $dumper->dump(array('class' => 'MyCachedContainer')));
369+
file_put_contents(
370+
$file,
371+
$dumper->dump(array('class' => 'MyCachedContainer'))
372+
);
361373
}
362374

363375
You will now get the speed of the PHP configured container with the ease of using
@@ -386,7 +398,10 @@ but getting an up to date configuration whilst developing your application::
386398

387399
if (!$isDebug) {
388400
$dumper = new PhpDumper($container);
389-
file_put_contents($file, $dumper->dump(array('class' => 'MyCachedContainer')));
401+
file_put_contents(
402+
$file,
403+
$dumper->dump(array('class' => 'MyCachedContainer'))
404+
);
390405
}
391406
}
392407

components/dependency_injection/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@
1212
factories
1313
parentservices
1414
advanced
15+
workflow
1516

components/dependency_injection/tags.rst

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -128,14 +128,22 @@ custom tag::
128128
{
129129
public function process(ContainerBuilder $container)
130130
{
131-
if (false === $container->hasDefinition('acme_mailer.transport_chain')) {
131+
if (!$container->hasDefinition('acme_mailer.transport_chain')) {
132132
return;
133133
}
134134

135-
$definition = $container->getDefinition('acme_mailer.transport_chain');
136-
137-
foreach ($container->findTaggedServiceIds('acme_mailer.transport') as $id => $attributes) {
138-
$definition->addMethodCall('addTransport', array(new Reference($id)));
135+
$definition = $container->getDefinition(
136+
'acme_mailer.transport_chain'
137+
);
138+
139+
$taggedServices = $container->findTaggedServiceIds(
140+
'acme_mailer.transport'
141+
);
142+
foreach ($taggedServices as $id => $attributes) {
143+
$definition->addMethodCall(
144+
'addTransport',
145+
array(new Reference($id))
146+
);
139147
}
140148
}
141149
}
@@ -242,15 +250,23 @@ use this, update the compiler::
242250
{
243251
public function process(ContainerBuilder $container)
244252
{
245-
if (false === $container->hasDefinition('acme_mailer.transport_chain')) {
253+
if (!$container->hasDefinition('acme_mailer.transport_chain')) {
246254
return;
247255
}
248256

249-
$definition = $container->getDefinition('acme_mailer.transport_chain');
257+
$definition = $container->getDefinition(
258+
'acme_mailer.transport_chain'
259+
);
250260

251-
foreach ($container->findTaggedServiceIds('acme_mailer.transport') as $id => $tagAttributes) {
261+
$taggedServices = $container->findTaggedServiceIds(
262+
'acme_mailer.transport'
263+
);
264+
foreach ($taggedServices as $id => $tagAttributes) {
252265
foreach ($tagAttributes as $attributes) {
253-
$definition->addMethodCall('addTransport', array(new Reference($id), $attributes["alias"]));
266+
$definition->addMethodCall(
267+
'addTransport',
268+
array(new Reference($id), $attributes["alias"])
269+
);
254270
}
255271
}
256272
}

components/dependency_injection/workflow.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Working with cached Container
2424
Before building it, the kernel checks to see if a cached version of the container
2525
exists. The ``HttpKernel`` has a debug setting and if this is false, the
2626
cached version is used if it exists. If debug is true then the kernel
27-
:doc:`checks to see if configuration is fresh<components/config/caching>`
27+
:doc:`checks to see if configuration is fresh</components/config/caching>`
2828
and if it is, the cached version of the container is. If not then the container
2929
is built from the application-level configuration and the bundles's extension
3030
configuration.
@@ -51,11 +51,11 @@ Bundle-level Configuration with Extensions
5151

5252
By convention, each bundle contains an Extension class which is in the bundle's
5353
``DependencyInjection`` directory. These are registered with the ``ContainerBuilder``
54-
when the kernel is booted. When the ``ContainerBuilder`` is :doc:`compiled<components/dependency-injection/compilation>`,
54+
when the kernel is booted. When the ``ContainerBuilder`` is :doc:`/compiled<components/dependency-injection/compilation>`,
5555
the application-level configuration relevant to the bundle's extension is
5656
passed to the Extension which also usually loads its own config file(s), typically from the bundle's
5757
``Resources/config`` directory. The application-level config is usually processed
58-
with a :doc:`Configuration object<components/config/definition>` also stored
58+
with a :doc:`Configuration object</components/config/definition>` also stored
5959
in the bundle's ``DependencyInjection`` directory.
6060

6161
Compiler passes to allow Interaction between Bundles

components/map.rst.inc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
* :doc:`/components/dependency_injection/factories`
2929
* :doc:`/components/dependency_injection/parentservices`
3030
* :doc:`/components/dependency_injection/advanced`
31+
* :doc:`/components/dependency_injection/workflow`
3132

3233
* **DOM Crawler**
3334

cookbook/bundles/best_practices.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ the ``Tests/`` directory. Tests should follow the following principles:
172172
a sample application;
173173
* The functional tests should only be used to test the response output and
174174
some profiling information if you have some;
175-
* The code coverage should at least covers 95% of the code base.
175+
* The tests should cover at least 95% of the code base.
176176

177177
.. note::
178178
A test suite must not contain ``AllTests.php`` scripts, but must rely on the

cookbook/controller/service.rst

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,22 @@ on how to perform many common tasks.
4444
bundle that will be used in many different projects. So, even if you don't
4545
specify your controllers as services, you'll likely see this done in some
4646
open-source Symfony2 bundles.
47+
48+
Using Annotation Routing
49+
------------------------
50+
51+
When using annotations to setup routing when using a controller defined as a
52+
service, you need to specify your service as follows::
53+
54+
/**
55+
* @Route("/blog", service="my_bundle.annot_controller")
56+
* @Cache(expires="tomorrow")
57+
*/
58+
class AnnotController extends Controller
59+
{
60+
}
61+
62+
In this example, ``my_bundle.annot_controller`` should be the id of the
63+
``AnnotController`` instance defined in the service container. This is
64+
documented in the :doc:`/bundles/SensioFrameworkExtraBundle/annotations/routing`
65+
chapter.

cookbook/templating/twig_extension.rst

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,12 @@ As an example we will create a price filter to format a given number into price:
2626
// src/Acme/DemoBundle/Twig/AcmeExtension.php
2727
namespace Acme\DemoBundle\Twig;
2828

29-
use Twig_Extension;
30-
use Twig_Filter_Method;
31-
32-
class AcmeExtension extends Twig_Extension
29+
class AcmeExtension extends \Twig_Extension
3330
{
3431
public function getFilters()
3532
{
3633
return array(
37-
'price' => new Twig_Filter_Method($this, 'priceFilter'),
34+
'price' => new \Twig_Filter_Method($this, 'priceFilter'),
3835
);
3936
}
4037

0 commit comments

Comments
 (0)