Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0c86169

Browse files
committed
Merge remote-tracking branch 'upstream/master' into twig_cs
Conflicts: cookbook/form/form_collections.rst
2 parents ece6c4c + e2c24fa commit 0c86169

File tree

93 files changed

+3747
-881
lines changed

Some content is hidden

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

93 files changed

+3747
-881
lines changed

book/controller.rst

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ working with forms, for example::
327327
public function updateAction(Request $request)
328328
{
329329
$form = $this->createForm(...);
330-
330+
331331
$form->bindRequest($request);
332332
// ...
333333
}
@@ -449,7 +449,7 @@ object that's returned from that controller::
449449
));
450450

451451
// further modify the response or return it directly
452-
452+
453453
return $response;
454454
}
455455

@@ -478,7 +478,7 @@ value to each variable.
478478
a shortcut for core Symfony2 functionality. A forward can be accomplished
479479
directly via the ``http_kernel`` service. A forward returns a ``Response``
480480
object::
481-
481+
482482
$httpKernel = $this->container->get('http_kernel');
483483
$response = $httpKernel->forward('AcmeHelloBundle:Hello:fancy', array(
484484
'name' => $name,
@@ -517,7 +517,7 @@ The Symfony templating engine is explained in great detail in the
517517

518518
The ``renderView`` method is a shortcut to direct use of the ``templating``
519519
service. The ``templating`` service can also be used directly::
520-
520+
521521
$templating = $this->get('templating');
522522
$content = $templating->render('AcmeHelloBundle:Hello:index.html.twig', array('name' => $name));
523523

@@ -616,8 +616,8 @@ from any controller::
616616
// in another controller for another request
617617
$foo = $session->get('foo');
618618

619-
// set the user locale
620-
$session->setLocale('fr');
619+
// use a default value of the key doesn't exist
620+
$filters = $session->set('filters', array());
621621

622622
These attributes will remain on the user for the remainder of that user's
623623
session.
@@ -643,7 +643,7 @@ For example, imagine you're processing a form submit::
643643
if ($form->isValid()) {
644644
// do some sort of processing
645645

646-
$this->get('session')->setFlash('notice', 'Your changes were saved!');
646+
$this->get('session')->getFlashBag()->add('notice', 'Your changes were saved!');
647647

648648
return $this->redirect($this->generateUrl(...));
649649
}
@@ -662,19 +662,19 @@ the ``notice`` message:
662662

663663
.. code-block:: html+jinja
664664

665-
{% if app.session.hasFlash('notice') %}
665+
{% for flashMessage in app.session.flashbag.get('notice') %}
666666
<div class="flash-notice">
667-
{{ app.session.flash('notice') }}
667+
{{ flashMessage }}
668668
</div>
669-
{% endif %}
669+
{% endfor %}
670670

671671
.. code-block:: php
672-
673-
<?php if ($view['session']->hasFlash('notice')): ?>
672+
673+
<?php foreach ($view['session']->getFlashBag()->get('notice') as $message): ?>
674674
<div class="flash-notice">
675-
<?php echo $view['session']->getFlash('notice') ?>
675+
<?php echo "<div class='flash-error'>$message</div>" ?>
676676
</div>
677-
<?php endif; ?>
677+
<?php endforeach; ?>
678678
679679
By design, flash messages are meant to live for exactly one request (they're
680680
"gone in a flash"). They're designed to be used across redirects exactly as
@@ -693,7 +693,7 @@ headers and content that's sent back to the client::
693693

694694
// create a simple Response with a 200 status code (the default)
695695
$response = new Response('Hello '.$name, 200);
696-
696+
697697
// create a JSON-response with a 200 status code
698698
$response = new Response(json_encode(array('name' => $name)));
699699
$response->headers->set('Content-Type', 'application/json');

book/doctrine.rst

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -44,21 +44,21 @@ Configuring the Database
4444

4545
Before you really begin, you'll need to configure your database connection
4646
information. By convention, this information is usually configured in an
47-
``app/config/parameters.ini`` file:
47+
``app/config/parameters.yml`` file:
4848

49-
.. code-block:: ini
49+
.. code-block:: yaml
5050
51-
;app/config/parameters.ini
52-
[parameters]
53-
database_driver = pdo_mysql
54-
database_host = localhost
55-
database_name = test_project
56-
database_user = root
57-
database_password = password
51+
# app/config/parameters.yml
52+
parameters:
53+
database_driver: pdo_mysql
54+
database_host: localhost
55+
database_name: test_project
56+
database_user: root
57+
database_password: password
5858
5959
.. note::
6060

61-
Defining the configuration via ``parameters.ini`` is just a convention.
61+
Defining the configuration via ``parameters.yml`` is just a convention.
6262
The parameters defined in that file are referenced by the main configuration
6363
file when setting up Doctrine:
6464

@@ -377,7 +377,7 @@ of the bundle:
377377
$product->setPrice('19.99');
378378
$product->setDescription('Lorem ipsum dolor');
379379
380-
$em = $this->getDoctrine()->getEntityManager();
380+
$em = $this->getDoctrine()->getManager();
381381
$em->persist($product);
382382
$em->flush();
383383
@@ -515,7 +515,7 @@ you have a route that maps a product id to an update action in a controller::
515515

516516
public function updateAction($id)
517517
{
518-
$em = $this->getDoctrine()->getEntityManager();
518+
$em = $this->getDoctrine()->getManager();
519519
$product = $em->getRepository('AcmeStoreBundle:Product')->find($id);
520520

521521
if (!$product) {
@@ -579,7 +579,7 @@ Imagine that you want to query for products, but only return products that
579579
cost more than ``19.99``, ordered from cheapest to most expensive. From inside
580580
a controller, do the following::
581581

582-
$em = $this->getDoctrine()->getEntityManager();
582+
$em = $this->getDoctrine()->getManager();
583583
$query = $em->createQuery(
584584
'SELECT p FROM AcmeStoreBundle:Product p WHERE p.price > :price ORDER BY p.price ASC'
585585
)->setParameter('price', '19.99');
@@ -741,20 +741,20 @@ ordered alphabetically.
741741
{
742742
public function findAllOrderedByName()
743743
{
744-
return $this->getEntityManager()
744+
return $this->getManager()
745745
->createQuery('SELECT p FROM AcmeStoreBundle:Product p ORDER BY p.name ASC')
746746
->getResult();
747747
}
748748
}
749749
750750
.. tip::
751751

752-
The entity manager can be accessed via ``$this->getEntityManager()``
752+
The entity manager can be accessed via ``$this->getManager()``
753753
from inside the repository.
754754

755755
You can use this new method just like the default finder methods of the repository::
756756

757-
$em = $this->getDoctrine()->getEntityManager();
757+
$em = $this->getDoctrine()->getManager();
758758
$products = $em->getRepository('AcmeStoreBundle:Product')
759759
->findAllOrderedByName();
760760

@@ -946,7 +946,7 @@ Now, let's see the code in action. Imagine you're inside a controller::
946946
// relate this product to the category
947947
$product->setCategory($category);
948948
949-
$em = $this->getDoctrine()->getEntityManager();
949+
$em = $this->getDoctrine()->getManager();
950950
$em->persist($category);
951951
$em->persist($product);
952952
$em->flush();
@@ -1061,7 +1061,7 @@ following method to the ``ProductRepository`` class::
10611061
10621062
public function findOneByIdJoinedToCategory($id)
10631063
{
1064-
$query = $this->getEntityManager()
1064+
$query = $this->getManager()
10651065
->createQuery('
10661066
SELECT p, c FROM AcmeStoreBundle:Product p
10671067
JOIN p.category c
@@ -1377,14 +1377,14 @@ For more information about Doctrine, see the *Doctrine* section of the
13771377

13781378
.. _`Doctrine`: http://www.doctrine-project.org/
13791379
.. _`MongoDB`: http://www.mongodb.org/
1380-
.. _`Basic Mapping Documentation`: http://docs.doctrine-project.org/projects/doctrine-orm/en/2.1/reference/basic-mapping.html
1381-
.. _`Query Builder`: http://docs.doctrine-project.org/projects/doctrine-orm/en/2.1/reference/query-builder.html
1382-
.. _`Doctrine Query Language`: http://docs.doctrine-project.org/projects/doctrine-orm/en/2.1/reference/dql-doctrine-query-language.html
1383-
.. _`Association Mapping Documentation`: http://docs.doctrine-project.org/projects/doctrine-orm/en/2.1/reference/association-mapping.html
1380+
.. _`Basic Mapping Documentation`: http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/basic-mapping.html
1381+
.. _`Query Builder`: http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/query-builder.html
1382+
.. _`Doctrine Query Language`: http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/dql-doctrine-query-language.html
1383+
.. _`Association Mapping Documentation`: http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/association-mapping.html
13841384
.. _`DateTime`: http://php.net/manual/en/class.datetime.php
1385-
.. _`Mapping Types Documentation`: http://docs.doctrine-project.org/projects/doctrine-orm/en/2.1/reference/basic-mapping.html#doctrine-mapping-types
1386-
.. _`Property Mapping documentation`: http://docs.doctrine-project.org/projects/doctrine-orm/en/2.1/reference/basic-mapping.html#property-mapping
1387-
.. _`Lifecycle Events documentation`: http://docs.doctrine-project.org/projects/doctrine-orm/en/2.1/reference/events.html#lifecycle-events
1388-
.. _`Reserved SQL keywords documentation`: http://docs.doctrine-project.org/projects/doctrine-orm/en/2.1/reference/basic-mapping.html#quoting-reserved-words
1389-
.. _`Persistent classes`: http://docs.doctrine-project.org/projects/doctrine-orm/en/2.1/reference/basic-mapping.html#persistent-classes
1390-
.. _`Property Mapping`: http://docs.doctrine-project.org/projects/doctrine-orm/en/2.1/reference/basic-mapping.html#property-mapping
1385+
.. _`Mapping Types Documentation`: http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/basic-mapping.html#doctrine-mapping-types
1386+
.. _`Property Mapping documentation`: http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/basic-mapping.html#property-mapping
1387+
.. _`Lifecycle Events documentation`: http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/events.html#lifecycle-events
1388+
.. _`Reserved SQL keywords documentation`: http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/basic-mapping.html#quoting-reserved-words
1389+
.. _`Persistent classes`: http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/basic-mapping.html#persistent-classes
1390+
.. _`Property Mapping`: http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/basic-mapping.html#property-mapping

0 commit comments

Comments
 (0)