Skip to content

Commit 7660376

Browse files
committed
Merge remote-tracking branch 'upstream/3.3' into 3.3
2 parents e79e37e + 9439177 commit 7660376

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+1613
-359
lines changed

.platform.app.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,5 @@ hooks:
5757
export PIP_USER=
5858
pip install pip==9.0.1 wheel==0.29.0
5959
pip install -r _build/.requirements.txt
60+
find .virtualenv -type f -name "*.rst" -delete
6061
make -C _build html

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ sudo: false
66
cache:
77
directories: [$HOME/.cache/pip]
88

9-
install: pip install sphinx~=1.3.0 git+https://github.com/fabpot/sphinx-php.git
9+
install: pip install -r _build/.requirements.txt
1010

11-
script: sphinx-build -nW -c _build/ -b html -d _build/doctrees . _build/html
11+
script: make -C _build SPHINXOPTS=-nW html
1212

1313
branches:
1414
except:

_build/.requirements.txt

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
alabaster==0.7.9
2-
Babel==2.3.4
1+
alabaster==0.7.10
2+
Babel==2.4.0
33
docutils==0.13.1
44
imagesize==0.7.1
5-
Jinja2==2.9.4
6-
MarkupSafe==0.23
5+
Jinja2==2.9.6
6+
MarkupSafe==1.0
77
Pygments==2.2.0
8-
pytz==2016.10
8+
pytz==2017.2
99
requests==2.12.5
1010
six==1.10.0
1111
snowballstemmer==1.2.1
12-
Sphinx==1.5.2
12+
Sphinx==1.3.6
1313
git+https://github.com/fabpot/sphinx-php.git@7312eccce9465640752e51373a480da700e02345#egg_name=sphinx-php
14-

_build/redirection_map

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@
164164
/cookbook/form/inherit_data_option /form/inherit_data_option
165165
/cookbook/form/unit_testing /form/unit_testing
166166
/cookbook/form/use_empty_data /form/use_empty_data
167-
/cookbook/frontend/bower /frontend/bower
167+
/cookbook/frontend/bower /frontend
168168
/cookbook/frontend/index /frontend
169169
/cookbook/install/unstable_versions /setup/unstable_versions
170170
/cookbook/install/bundles /setup/bundles

assetic/asset_management.rst

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -552,10 +552,11 @@ done from the template and is relative to the public document root:
552552
553553
.. note::
554554

555-
Symfony also contains a method for cache *busting*, where the final URL
556-
generated by Assetic contains a query parameter that can be incremented
557-
via configuration on each deployment. For more information, see the
558-
:ref:`reference-framework-assets-version` configuration option.
555+
Symfony provides various cache busting implementations via the
556+
:ref:`version <reference-framework-assets-version>`,
557+
:ref:`version_format <reference-assets-version-format>`, and
558+
:ref:`json_manifest_path <reference-assets-json-manifest-path>`
559+
configuration options.
559560

560561
.. _assetic-dumping:
561562

best_practices/controllers.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,16 +97,16 @@ for the homepage of our app:
9797
9898
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
9999
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
100-
use Doctrine\ORM\EntityManagerInterface;
101100
102101
class DefaultController extends Controller
103102
{
104103
/**
105104
* @Route("/", name="homepage")
106105
*/
107-
public function indexAction(EntityManagerInterface $em)
106+
public function indexAction()
108107
{
109-
$posts = $em->getRepository('AppBundle:Post')
108+
$posts = $this->getDoctrine()
109+
->getRepository('AppBundle:Post')
110110
->findLatest();
111111
112112
return $this->render('default/index.html.twig', array(

best_practices/security.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,9 +224,10 @@ more advanced use-case, you can always do the same security check in PHP:
224224
/**
225225
* @Route("/{id}/edit", name="admin_post_edit")
226226
*/
227-
public function editAction($id, EntityManagerInterface $em)
227+
public function editAction($id)
228228
{
229-
$post = $em->getRepository('AppBundle:Post')
229+
$post = $this->getDoctrine()
230+
->getRepository('AppBundle:Post')
230231
->find($id);
231232
232233
if (!$post) {

components/workflow.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ these statuses are called **places**. You can define the workflow like this::
4444
use Symfony\Component\Workflow\Workflow;
4545
use Symfony\Component\Workflow\MarkingStore\SingleStateMarkingStore;
4646

47-
$definition = new DefinitionBuilder()
48-
->addPlaces(['draft', 'review', 'rejected', 'published'])
47+
$definition = new DefinitionBuilder();
48+
$definition->addPlaces(['draft', 'review', 'rejected', 'published'])
4949
// Transitions are defined with a unique name, an origin place and a destination place
5050
->addTransition(new Transition('to_review', 'draft', 'review'))
5151
->addTransition(new Transition('publish', 'review', 'published'))

contributing/code/standards.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ Naming Conventions
186186
* Use camelCase, not underscores, for variable, function and method
187187
names, arguments;
188188

189-
* Use underscores for option names and parameter names;
189+
* Use underscores for configuration options and parameters;
190190

191191
* Use namespaces for all classes;
192192

controller/argument_value_resolver.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,12 +164,12 @@ and adding a priority.
164164
<!-- app/config/services.xml -->
165165
<?xml version="1.0" encoding="UTF-8" ?>
166166
<container xmlns="http://symfony.com/schema/dic/services"
167-
xmlns:xsi="'http://www.w3.org/2001/XMLSchema-Instance"
167+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-Instance"
168168
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
169169
170170
<services>
171171
<!-- ... be sure autowiring is enabled -->
172-
<defaults autowire="true" ... />
172+
<defaults autowire="true" />
173173
<!-- ... -->
174174
175175
<service id="AppBundle\ArgumentResolver\UserValueResolver">

controller/error_pages.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ In that case, you might want to override one or both of the ``showAction()`` and
291291
292292
<services>
293293
<!-- ... be sure autowiring is enabled -->
294-
<defaults autowire="true" ... />
294+
<defaults autowire="true" />
295295
<!-- ... -->
296296
297297
<service id="AppBundle\Controller\CustomExceptionController" public="true">

controller/upload_file.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ Now, register this class as a Doctrine listener:
396396
http://symfony.com/schema/dic/services/services-1.0.xsd">
397397
398398
<!-- ... be sure autowiring is enabled -->
399-
<defaults autowire="true" ... />
399+
<defaults autowire="true" />
400400
<!-- ... -->
401401
402402
<service id="AppBundle\EventListener\BrochureUploaderListener">

deployment.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ Don't forget that deploying your application also involves updating any dependen
198198
(typically via Composer), migrating your database, clearing your cache and
199199
other potential things like pushing assets to a CDN (see `Common Post-Deployment Tasks`_).
200200

201-
.. _`Capifony`: http://capifony.org/
201+
.. _`Capifony`: https://github.com/everzet/capifony
202202
.. _`Capistrano`: http://capistranorb.com/
203203
.. _`sf2debpkg`: https://github.com/liip/sf2debpkg
204204
.. _`Fabric`: http://www.fabfile.org/

doctrine.rst

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -549,12 +549,12 @@ a controller, this is pretty easy. Add the following method to the
549549
use AppBundle\Entity\Product;
550550
use Symfony\Component\HttpFoundation\Response;
551551
use Doctrine\ORM\EntityManagerInterface;
552-
use Doctrine\Common\Persistence\ManagerRegistry;
553552

554-
public function createAction(EntityManagerInterface $em)
553+
public function createAction()
555554
{
556-
// or fetch the em via the container
557-
// $em = $this->get('doctrine')->getManager();
555+
// you can fetch the EntityManager via $this->getDoctrine()
556+
// or you can add an argument to your action: createAction(EntityManagerInterface $em)
557+
$em = $this->get('doctrine')->getManager();
558558

559559
$product = new Product();
560560
$product->setName('Keyboard');
@@ -571,8 +571,9 @@ a controller, this is pretty easy. Add the following method to the
571571
}
572572

573573
// if you have multiple entity managers, use the registry to fetch them
574-
public function editAction(ManagerRegistry $doctrine)
574+
public function editAction()
575575
{
576+
$doctrine = $this->getDoctrine();
576577
$em = $doctrine->getManager();
577578
$em2 = $doctrine->getManager('other_connection')
578579
}
@@ -586,7 +587,7 @@ Take a look at the previous example in more detail:
586587

587588
.. _doctrine-entity-manager:
588589

589-
* **line 10** The ``EntityManagerInterface`` type-hint tells Symfony to pass you Doctrine's
590+
* **line 13** The ``$this->getDoctrine()->getManager()`` method gets Doctrine's
590591
*entity manager* object, which is the most important object in Doctrine. It's
591592
responsible for saving objects to, and fetching objects from, the database.
592593

@@ -633,11 +634,10 @@ Fetching an object back out of the database is even easier. For example,
633634
suppose you've configured a route to display a specific ``Product`` based
634635
on its ``id`` value::
635636

636-
use Doctrine\ORM\EntityManagerInterface;
637-
638-
public function showAction($productId, EntityManagerInterface $em)
637+
public function showAction($productId)
639638
{
640-
$product = $em->getRepository('AppBundle:Product')
639+
$product = $this->getDoctrine()
640+
->getRepository('AppBundle:Product')
641641
->find($productId);
642642

643643
if (!$product) {
@@ -727,11 +727,11 @@ Updating an Object
727727
Once you've fetched an object from Doctrine, updating it is easy. Suppose
728728
you have a route that maps a product id to an update action in a controller::
729729

730-
use Doctrine\ORM\EntityManagerInterface;
731-
732-
public function updateAction($productId, EntityManagerInterface $em)
730+
public function updateAction($productId)
733731
{
734-
$product = $em->getRepository('AppBundle:Product')->find($productId);
732+
$product = $this->getDoctrine()
733+
->getRepository('AppBundle:Product')
734+
->find($productId);
735735

736736
if (!$product) {
737737
throw $this->createNotFoundException(

doctrine/associations.rst

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -236,11 +236,10 @@ Now you can see this new code in action! Imagine you're inside a controller::
236236
use AppBundle\Entity\Category;
237237
use AppBundle\Entity\Product;
238238
use Symfony\Component\HttpFoundation\Response;
239-
use Doctrine\ORM\EntityManagerInterface;
240239

241240
class DefaultController extends Controller
242241
{
243-
public function createProductAction(EntityManagerInterface $em)
242+
public function createProductAction()
244243
{
245244
$category = new Category();
246245
$category->setName('Computer Peripherals');
@@ -253,6 +252,7 @@ Now you can see this new code in action! Imagine you're inside a controller::
253252
// relate this product to the category
254253
$product->setCategory($category);
255254

255+
$em = $this->getDoctrine()->getManager();
256256
$em->persist($category);
257257
$em->persist($product);
258258
$em->flush();
@@ -276,11 +276,10 @@ When you need to fetch associated objects, your workflow looks just like it
276276
did before. First, fetch a ``$product`` object and then access its related
277277
``Category`` object::
278278

279-
use Doctrine\ORM\EntityManagerInterface;
280-
281-
public function showAction($productId, EntityManagerInterface $em)
279+
public function showAction($productId)
282280
{
283-
$product = $em->getRepository('AppBundle:Product')
281+
$product = $this->getDoctrine()
282+
->getRepository('AppBundle:Product')
284283
->find($productId);
285284

286285
$categoryName = $product->getCategory()->getName();
@@ -304,11 +303,10 @@ the category (i.e. it's "lazily loaded").
304303

305304
You can also query in the other direction::
306305

307-
use Doctrine\ORM\EntityManagerInterface;
308-
309-
public function showProductsAction($categoryId, EntityManagerInterface $em)
306+
public function showProductsAction($categoryId)
310307
{
311-
$category = $em->getRepository('AppBundle:Category')
308+
$category = $this->getDoctrine()
309+
->getRepository('AppBundle:Category')
312310
->find($categoryId);
313311

314312
$products = $category->getProducts();
@@ -367,11 +365,11 @@ can avoid the second query by issuing a join in the original query. Add the
367365
following method to the ``ProductRepository`` class::
368366

369367
// src/AppBundle/Repository/ProductRepository.php
370-
use Doctrine\ORM\EntityManagerInterface;
371-
372368
public function findOneByIdJoinedToCategory($productId)
373369
{
374-
$query = $em->createQuery(
370+
$query = $this->getDoctrine()
371+
->getManager()
372+
->createQuery(
375373
'SELECT p, c FROM AppBundle:Product p
376374
JOIN p.category c
377375
WHERE p.id = :id'
@@ -387,11 +385,10 @@ following method to the ``ProductRepository`` class::
387385
Now, you can use this method in your controller to query for a ``Product``
388386
object and its related ``Category`` with just one query::
389387

390-
use Doctrine\ORM\EntityManagerInterface;
391-
392-
public function showAction($productId, EntityManagerInterface $em)
388+
public function showAction($productId)
393389
{
394-
$product = $em->getRepository('AppBundle:Product')
390+
$product = $this->getDoctrine()
391+
->getRepository('AppBundle:Product')
395392
->findOneByIdJoinedToCategory($productId);
396393

397394
$category = $product->getCategory();

doctrine/registration_form.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,14 +226,13 @@ into the database::
226226
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
227227
use Symfony\Component\HttpFoundation\Request;
228228
use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface;
229-
use Doctrine\ORM\EntityManagerInterface;
230229

231230
class RegistrationController extends Controller
232231
{
233232
/**
234233
* @Route("/register", name="user_registration")
235234
*/
236-
public function registerAction(Request $request, UserPasswordEncoderInterface $passwordEncoder, EntityManagerInterface $em)
235+
public function registerAction(Request $request, UserPasswordEncoderInterface $passwordEncoder)
237236
{
238237
// 1) build the form
239238
$user = new User();
@@ -248,6 +247,7 @@ into the database::
248247
$user->setPassword($password);
249248

250249
// 4) save the User!
250+
$em = $this->getDoctrine()->getManager();
251251
$em->persist($user);
252252
$em->flush();
253253

doctrine/repository.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,12 @@ entities, ordered alphabetically by name.
9696

9797
You can use this new method just like the default finder methods of the repository::
9898

99-
use Doctrine\ORM\EntityManagerInterface;
10099
// ...
101100

102-
public function listAction(EntityManagerInterface $em)
101+
public function listAction()
103102
{
104-
$products = $em->getRepository('AppBundle:Product')
103+
$products = $this->getDoctrine()
104+
->getRepository('AppBundle:Product')
105105
->findAllOrderedByName();
106106
}
107107

form/form_collections.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -679,11 +679,11 @@ the relationship between the removed ``Tag`` and ``Task`` object.
679679
// src/AppBundle/Controller/TaskController.php
680680

681681
use Doctrine\Common\Collections\ArrayCollection;
682-
use Doctrine\ORM\EntityManagerInterface;
683682

684683
// ...
685-
public function editAction($id, Request $request, EntityManagerInterface $e,)
684+
public function editAction($id, Request $request)
686685
{
686+
$em = $this->getDoctrine()->getManager();
687687
$task = $em->getRepository('AppBundle:Task')->find($id);
688688

689689
if (!$task) {

form/form_dependencies.rst

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,11 @@ create your form::
3232

3333
// src/AppBundle/Controller/DefaultController.php
3434
use AppBundle\Form\TaskType;
35-
use Doctrine\ORM\EntityManagerInterface;
3635

3736
// ...
38-
public function newAction(EntityManagerInterface $em)
37+
public function newAction()
3938
{
40-
// or fetch the em via the container
41-
// $em = $this->get('doctrine')->getManager();
39+
$em = $this->getDoctrine()->getManager();
4240

4341
$task = ...;
4442
$form = $this->createForm(TaskType::class, $task, array(

form/type_guesser.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ With this knowledge, you can easily implement the ``guessType()`` method of the
136136
$phpdoc = $reflectionProperty->getDocComment();
137137

138138
// parse the $phpdoc into an array like:
139-
// array('type' => 'string', 'since' => '1.0')
139+
// array('var' => 'string', 'since' => '1.0')
140140
$phpdocTags = ...;
141141

142142
return $phpdocTags;

form/unit_testing.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ allows you to return a list of extensions to register::
191191
$this->validator
192192
->method('validate')
193193
->will($this->returnValue(new ConstraintViolationList()));
194-
$validator
194+
$this->validator
195195
->method('getMetadataFor')
196196
->will($this->returnValue(new ClassMetadata(Form::class)));
197197

0 commit comments

Comments
 (0)