Skip to content

Commit 2198c86

Browse files
committed
Merge branch '2.3' into 2.4
2 parents 4dba1ac + 02aead2 commit 2198c86

File tree

15 files changed

+67
-31
lines changed

15 files changed

+67
-31
lines changed

book/index.rst

100755100644
File mode changed.

book/validation.rst

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,14 @@ simple example from inside a controller::
129129
$errors = $validator->validate($author);
130130

131131
if (count($errors) > 0) {
132-
return new Response(print_r($errors, true));
132+
/*
133+
* Uses a __toString method on the $errors variable which is a
134+
* ConstraintViolationList object. This gives us a nice string
135+
* for debugging
136+
*/
137+
$errorsString = (string) $errors;
138+
139+
return new Response($errorsString);
133140
}
134141

135142
return new Response('The author is valid! Yes!');

components/console/introduction.rst

100755100644
File mode changed.

components/console/usage.rst

100755100644
File mode changed.

cookbook/assetic/asset_management.rst

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,9 @@ Using Assetic provides many advantages over directly serving the files.
4343
The files do not need to be stored where they are served from and can be
4444
drawn from various sources such as from within a bundle.
4545

46-
You can use Assetic to process both :ref:`CSS stylesheets <cookbook-assetic-including-css>`
47-
and :ref:`JavaScript files <cookbook-assetic-including-javascript>`. The philosophy
46+
You can use Assetic to process :ref:`CSS stylesheets <cookbook-assetic-including-css>`,
47+
:ref:`JavaScript files <cookbook-assetic-including-javascript>` and
48+
:ref:`images <cookbook-assetic-including-image>`. The philosophy
4849
behind adding either is basically the same, but with a slightly different syntax.
4950

5051
.. _cookbook-assetic-including-javascript:
@@ -128,6 +129,32 @@ the :ref:`cssrewrite <cookbook-assetic-cssrewrite>` filter.
128129
that there is a known issue that causes the ``cssrewrite`` filter to fail
129130
when using the ``@AcmeFooBundle`` syntax for CSS Stylesheets.
130131

132+
.. _cookbook-assetic-including-image:
133+
134+
Including images
135+
~~~~~~~~~~~~~~~~
136+
137+
To include an image you can use the ``image`` tag.
138+
139+
.. configuration-block::
140+
141+
.. code-block:: html+jinja
142+
143+
{% image '@AcmeFooBundle/Resources/public/images/example.jpg' %}
144+
<img src="{{ asset_url }}" alt="Example" />
145+
{% endimage %}
146+
147+
.. code-block:: html+php
148+
149+
<?php foreach ($view['assetic']->image(
150+
array('@AcmeFooBundle/Resources/public/images/example.jpg')
151+
) as $url): ?>
152+
<img src="<?php echo $view->escape($url) ?>" alt="Example" />
153+
<?php endforeach; ?>
154+
155+
You can also use Assetic for image optimization. More information in
156+
:doc:`/cookbook/assetic/jpeg_optimize`.
157+
131158
.. _cookbook-assetic-cssrewrite:
132159

133160
Fixing CSS Paths with the ``cssrewrite`` Filter

cookbook/assetic/jpeg_optimize.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ It can now be used from a template:
6464

6565
.. code-block:: html+php
6666

67-
<?php foreach ($view['assetic']->images(
67+
<?php foreach ($view['assetic']->image(
6868
array('@AcmeFooBundle/Resources/public/images/example.jpg'),
6969
array('jpegoptim')
7070
) as $url): ?>

cookbook/bundles/remove.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ can remove the ``Acme`` directory as well.
7676
.. tip::
7777

7878
If you don't know the location of a bundle, you can use the
79-
:method:`Symfony\\Bundle\\FrameworkBundle\\Bundle\\Bundle::getPath` method
79+
:method:`Symfony\\Component\\HttpKernel\\Bundle\\BundleInterface::getPath` method
8080
to get the path of the bundle::
8181

8282
echo $this->container->get('kernel')->getBundle('AcmeDemoBundle')->getPath();

cookbook/event_dispatcher/before_after_filters.rst

100755100644
File mode changed.

cookbook/form/form_collections.rst

100755100644
Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -608,8 +608,11 @@ First, add a "delete this tag" link to each tag form:
608608
.. code-block:: javascript
609609
610610
jQuery(document).ready(function() {
611+
// Get the ul that holds the collection of tags
612+
$collectionHolder = $('ul.tags');
613+
611614
// add a delete link to all of the existing tag form li elements
612-
collectionHolder.find('li').each(function() {
615+
$collectionHolder.find('li').each(function() {
613616
addTagFormDeleteLink($(this));
614617
});
615618
@@ -665,7 +668,9 @@ the relationship between the removed ``Tag`` and ``Task`` object.
665668
is handling the "update" of your Task::
666669

667670
// src/Acme/TaskBundle/Controller/TaskController.php
668-
671+
672+
use Doctrine\Common\Collections\ArrayCollection;
673+
669674
// ...
670675
public function editAction($id, Request $request)
671676
{
@@ -676,11 +681,11 @@ the relationship between the removed ``Tag`` and ``Task`` object.
676681
throw $this->createNotFoundException('No task found for is '.$id);
677682
}
678683

679-
$originalTags = array();
684+
$originalTags = new ArrayCollection();
680685

681-
// Create an array of the current Tag objects in the database
686+
// Create an ArrayCollection of the current Tag objects in the database
682687
foreach ($task->getTags() as $tag) {
683-
$originalTags[] = $tag;
688+
$originalTags->add($tag);
684689
}
685690

686691
$editForm = $this->createForm(new TaskType(), $task);
@@ -689,27 +694,20 @@ the relationship between the removed ``Tag`` and ``Task`` object.
689694

690695
if ($editForm->isValid()) {
691696

692-
// filter $originalTags to contain tags no longer present
693-
foreach ($task->getTags() as $tag) {
694-
foreach ($originalTags as $key => $toDel) {
695-
if ($toDel->getId() === $tag->getId()) {
696-
unset($originalTags[$key]);
697-
}
698-
}
699-
}
700-
701697
// remove the relationship between the tag and the Task
702698
foreach ($originalTags as $tag) {
703-
// remove the Task from the Tag
704-
$tag->getTasks()->removeElement($task);
699+
if (false === $task->getTags()->contains($tag)) {
700+
// remove the Task from the Tag
701+
$tag->getTasks()->removeElement($task);
705702

706-
// if it were a many-to-one relationship, remove the relationship like this
707-
// $tag->setTask(null);
703+
// if it was a many-to-one relationship, remove the relationship like this
704+
// $tag->setTask(null);
708705

709-
$em->persist($tag);
706+
$em->persist($tag);
710707

711-
// if you wanted to delete the Tag entirely, you can also do that
712-
// $em->remove($tag);
708+
// if you wanted to delete the Tag entirely, you can also do that
709+
// $em->remove($tag);
710+
}
713711
}
714712

715713
$em->persist($task);

cookbook/serializer.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ You can load normalizers and/or encoders by tagging them as
6767
:ref:`serializer.encoder<reference-dic-tags-serializer-encoder>`. It's also
6868
possible to set the priority of the tag in order to decide the matching order.
6969

70-
Here an example on how to load the load
71-
the :class:`Symfony\\Component\\Serializer\\Normalizer\\GetSetMethodNormalizer`:
70+
Here is an example on how to load the
71+
:class:`Symfony\\Component\\Serializer\\Normalizer\\GetSetMethodNormalizer`:
7272

7373
.. configuration-block::
7474

@@ -108,4 +108,4 @@ the :class:`Symfony\\Component\\Serializer\\Normalizer\\GetSetMethodNormalizer`:
108108
infinite loop is created when calling the getters. You're encouraged
109109
to add your own normalizers that fit your use-case.
110110

111-
.. _JMSSerializerBundle: http://jmsyst.com/bundles/JMSSerializerBundle
111+
.. _JMSSerializerBundle: http://jmsyst.com/bundles/JMSSerializerBundle

quick_tour/the_controller.rst

100755100644
File mode changed.

reference/configuration/monolog.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ MonologBundle Configuration ("monolog")
3030
id: my_handler
3131
3232
# Default options and values for some "my_custom_handler"
33+
# Note: many of these options are specific to the "type".
34+
# For example, the "service" type doesn't use any options
35+
# except id and channels
3336
my_custom_handler:
3437
type: ~ # Required
3538
id: ~

reference/index.rst

100755100644
File mode changed.

reference/map.rst.inc

100755100644
File mode changed.

reference/requirements.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ Required
2626

2727
.. caution::
2828

29-
Be aware that Symfony2 has some known limitations when using PHP 5.3.8
30-
or below. For more information see the `Requirements section of the README`_.
29+
Be aware that Symfony2 has some known limitations when using a PHP version
30+
less than 5.3.8 or equal to 5.3.16. For more information see the
31+
`Requirements section of the README`_.
3132

3233
Optional
3334
--------

0 commit comments

Comments
 (0)