Skip to content

Commit

Permalink
Merge branch '2.8'
Browse files Browse the repository at this point in the history
  • Loading branch information
wouterj committed Jun 7, 2015
2 parents f78cab7 + 59569c0 commit 078bb2d
Show file tree
Hide file tree
Showing 19 changed files with 153 additions and 49 deletions.
31 changes: 17 additions & 14 deletions book/forms.rst
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ from inside a controller::
// src/AppBundle/Controller/DefaultController.php
namespace AppBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use AppBundle\Entity\Task;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;

class DefaultController extends Controller
Expand Down Expand Up @@ -546,16 +546,17 @@ This will call the static method ``determineValidationGroups()`` on the
The Form object is passed as an argument to that method (see next example).
You can also define whole logic inline by using a ``Closure``::

use Acme\AcmeBundle\Entity\Client;
use AppBundle\Entity\Client;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

// ...
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults(array(
'validation_groups' => function(FormInterface $form) {
'validation_groups' => function (FormInterface $form) {
$data = $form->getData();

if (Client::TYPE_PERSON == $data->getType()) {
return array('person');
}
Expand All @@ -569,16 +570,17 @@ Using the ``validation_groups`` option overrides the default validation
group which is being used. If you want to validate the default constraints
of the entity as well you have to adjust the option as follows::

use Acme\AcmeBundle\Entity\Client;
use AppBundle\Entity\Client;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

// ...
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults(array(
'validation_groups' => function(FormInterface $form) {
'validation_groups' => function (FormInterface $form) {
$data = $form->getData();

if (Client::TYPE_PERSON == $data->getType()) {
return array('Default', 'person');
}
Expand Down Expand Up @@ -1052,7 +1054,8 @@ that will house the logic for building the task form::
$builder
->add('task')
->add('dueDate', null, array('widget' => 'single_text'))
->add('save', 'submit');
->add('save', 'submit')
;
}

public function getName()
Expand Down Expand Up @@ -1127,7 +1130,8 @@ the choice is ultimately up to you.
$builder
->add('task')
->add('dueDate', null, array('mapped' => false))
->add('save', 'submit');
->add('save', 'submit')
;
}

Additionally, if there are any fields on the form that aren't included in
Expand Down Expand Up @@ -1159,7 +1163,7 @@ easy to use in your application.
# src/AppBundle/Resources/config/services.yml
services:
acme_demo.form.type.task:
app.form.type.task:
class: AppBundle\Form\Type\TaskType
tags:
- { name: form.type, alias: task }
Expand All @@ -1173,10 +1177,7 @@ easy to use in your application.
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<services>
<service
id="acme_demo.form.type.task"
class="AppBundle\Form\Type\TaskType">
<service id="app.form.type.task" class="AppBundle\Form\Type\TaskType">
<tag name="form.type" alias="task" />
</service>
</services>
Expand All @@ -1187,7 +1188,7 @@ easy to use in your application.
// src/AppBundle/Resources/config/services.php
$container
->register(
'acme_demo.form.type.task',
'app.form.type.task',
'AppBundle\Form\Type\TaskType'
)
->addTag('form.type', array(
Expand Down Expand Up @@ -1480,6 +1481,7 @@ renders the form:
{# app/Resources/views/default/new.html.twig #}
{% form_theme form 'form/fields.html.twig' %}

{# or if you want to use multiple themes #}
{% form_theme form 'form/fields.html.twig' 'form/fields2.html.twig' %}

{# ... render the form #}
Expand All @@ -1489,6 +1491,7 @@ renders the form:
<!-- app/Resources/views/default/new.html.php -->
<?php $view['form']->setTheme($form, array('form')) ?>

<!-- or if you want to use multiple themes -->
<?php $view['form']->setTheme($form, array('form', 'form2')) ?>

<!-- ... render the form -->
Expand Down Expand Up @@ -1735,7 +1738,7 @@ file:
'Form',
),
),
)
),
// ...
));
Expand Down
26 changes: 13 additions & 13 deletions book/templating.rst
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ Throughout this chapter, template examples will be shown in both Twig and PHP.
web designers everywhere.

Twig can also do things that PHP can't, such as whitespace control,
sandboxing, automatic HTML escaping, manual contextual output escaping,
sandboxing, automatic HTML escaping, manual contextual output escaping,
and the inclusion of custom functions and filters that only affect templates.
Twig contains little features that make writing templates easier and more concise.
Take the following example, which combines a loop with a logical ``if``
Expand Down Expand Up @@ -206,8 +206,8 @@ First, build a base layout file:
<div id="sidebar">
{% block sidebar %}
<ul>
<li><a href="/">Home</a></li>
<li><a href="/blog">Blog</a></li>
<li><a href="/">Home</a></li>
<li><a href="/blog">Blog</a></li>
</ul>
{% endblock %}
</div>
Expand Down Expand Up @@ -654,7 +654,7 @@ string syntax for controllers (i.e. **bundle**:**controller**:**action**):
{# ... #}
<div id="sidebar">
{{ render(controller(
'AcmeArticleBundle:Article:recentArticles',
'AppBundle:Article:recentArticles',
{ 'max': 3 }
)) }}
</div>
Expand All @@ -667,7 +667,7 @@ string syntax for controllers (i.e. **bundle**:**controller**:**action**):
<div id="sidebar">
<?php echo $view['actions']->render(
new \Symfony\Component\HttpKernel\Controller\ControllerReference(
'AcmeArticleBundle:Article:recentArticles',
'AppBundle:Article:recentArticles',
array('max' => 3)
)
) ?>
Expand Down Expand Up @@ -784,7 +784,7 @@ in your application configuration:
// app/config/config.php
$container->loadFromExtension('framework', array(
// ...
'templating' => array(
'templating' => array(
'hinclude_default_template' => array(
'hinclude.html.twig',
),
Expand All @@ -808,7 +808,7 @@ any global default template that is defined):
new ControllerReference('...'),
array(
'renderer' => 'hinclude',
'default' => 'default/content.html.twig',
'default' => 'default/content.html.twig',
)
) ?>
Expand All @@ -826,7 +826,7 @@ Or you can also specify a string to display as the default content:
new ControllerReference('...'),
array(
'renderer' => 'hinclude',
'default' => 'Loading...',
'default' => 'Loading...',
)
) ?>
Expand Down Expand Up @@ -999,13 +999,13 @@ but Symfony provides a more dynamic option via the ``asset`` Twig function:

<img src="{{ asset('images/logo.png') }}" alt="Symfony!" />

<link href="{{ asset('css/blog.css') }}" rel="stylesheet" type="text/css" />
<link href="{{ asset('css/blog.css') }}" rel="stylesheet" />

.. code-block:: html+php

<img src="<?php echo $view['assets']->getUrl('images/logo.png') ?>" alt="Symfony!" />

<link href="<?php echo $view['assets']->getUrl('css/blog.css') ?>" rel="stylesheet" type="text/css" />
<link href="<?php echo $view['assets']->getUrl('css/blog.css') ?>" rel="stylesheet" />

The ``asset`` function's main purpose is to make your application more portable.
If your application lives at the root of your host (e.g. http://example.com),
Expand Down Expand Up @@ -1171,7 +1171,7 @@ is by default "web").

.. code-block:: html+jinja

<link href="{{ asset('bundles/acmedemo/css/contact.css') }}" rel="stylesheet" />
<link href="{{ asset('bundles/acmedemo/css/contact.css') }}" rel="stylesheet" />

The end result is a page that includes both the ``main.css`` and ``contact.css``
stylesheets.
Expand Down Expand Up @@ -1396,7 +1396,7 @@ One common way to use inheritance is to use a three-level approach. This
method works perfectly with the three different types of templates that were just
covered:

* Create a ``app/Resources/views/base.html.twig`` file that contains the main
* Create an ``app/Resources/views/base.html.twig`` file that contains the main
layout for your application (like in the previous example). Internally, this
template is called ``base.html.twig``;

Expand Down Expand Up @@ -1487,7 +1487,7 @@ tag to the screen:

.. code-block:: html

Hello &lt;script&gt;alert(&#39;helloe&#39;)&lt;/script&gt;
Hello &lt;script&gt;alert(&#39;hello!&#39;)&lt;/script&gt;

The Twig and PHP templating systems approach the problem in different ways.
If you're using Twig, output escaping is on by default and you're protected.
Expand Down
94 changes: 94 additions & 0 deletions changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,100 @@ documentation.
Do you also want to participate in the Symfony Documentation? Take a look
at the ":doc:`/contributing/documentation/overview`" article.

May, 2015
---------

New Documentation
~~~~~~~~~~~~~~~~~

* `#5329 <https://github.com/symfony/symfony-docs/pull/5329>`_ Adding a new entry about deprecation warnings (weaverryan)
* `#4604 <https://github.com/symfony/symfony-docs/pull/4604>`_ Making the channel handler more useful by showing it on the prod environment (weaverryan)
* `#5155 <https://github.com/symfony/symfony-docs/pull/5155>`_ Documented upgrading path for a major version (WouterJ)
* `#5127 <https://github.com/symfony/symfony-docs/pull/5127>`_ [VarDumper] Add doc for assertDump\* assertions (nicolas-grekas)
* `#5137 <https://github.com/symfony/symfony-docs/pull/5137>`_ Added a note about the rotating_file monolog handler (javiereguiluz)
* `#5283 <https://github.com/symfony/symfony-docs/pull/5283>`_ [BestPractices] restructured text format for the installation instructions template (xabbuh)
* `#5298 <https://github.com/symfony/symfony-docs/pull/5298>`_ Completed framework config (WouterJ)
* `#5255 <https://github.com/symfony/symfony-docs/pull/5255>`_ [Cookbook] Use configured user provider instead of injection (mvar)
* `#5216 <https://github.com/symfony/symfony-docs/pull/5216>`_ [Cookbook] [Deployment] Added note about Nginx (phansys)
* `#5169 <https://github.com/symfony/symfony-docs/pull/5169>`_ Removed synchronized services from Symfony 2.7 docs (javiereguiluz)
* `#5117 <https://github.com/symfony/symfony-docs/pull/5117>`_ Complete review of the "Customize Error Pages" cookbook article (javiereguiluz)
* `#5115 <https://github.com/symfony/symfony-docs/pull/5115>`_ Flesh out twig-template for custom data-collector (Darien Hager)
* `#5106 <https://github.com/symfony/symfony-docs/pull/5106>`_ [VarDumper] upgrade doc to 2.7 wither interface (nicolas-grekas)
* `#4728 <https://github.com/symfony/symfony-docs/pull/4728>`_ Add Session Cache Limiting section for NativeSessionStorage (mrclay)
* `#4084 <https://github.com/symfony/symfony-docs/pull/4084>`_ [Book][Forms] describe the allow_extra_fields form option (xabbuh)
* `#5294 <https://github.com/symfony/symfony-docs/pull/5294>`_ Tweaks to bower entry - specifically committing deps (weaverryan)
* `#5062 <https://github.com/symfony/symfony-docs/pull/5062>`_ Cookbook about Command in Application with AnsiToHtml (Rvanlaak)
* `#4901 <https://github.com/symfony/symfony-docs/pull/4901>`_ Removed the Internals chapter from the Symfony book (javiereguiluz)
* `#4807 <https://github.com/symfony/symfony-docs/pull/4807>`_ [2.7] bumped min PHP version to 5.3.9 (xelaris)
* `#4790 <https://github.com/symfony/symfony-docs/pull/4790>`_ [Cookbook][Routing] Update custom_route_loader.rst (xelaris)
* `#5159 <https://github.com/symfony/symfony-docs/pull/5159>`_ Added an article explaining how to use Bower in Symfony (WouterJ)
* `#4700 <https://github.com/symfony/symfony-docs/pull/4700>`_ add informations how to create a custom doctrine mapping (timglabisch)
* `#4675 <https://github.com/symfony/symfony-docs/pull/4675>`_ [Serializer] Doc for groups support (dunglas)
* `#5164 <https://github.com/symfony/symfony-docs/pull/5164>`_ Added information about the Symfony Demo application (javiereguiluz)
* `#5100 <https://github.com/symfony/symfony-docs/pull/5100>`_ Change MySQL UTF-8 examples to use utf8mb4 (DHager, Darien Hager)
* `#5088 <https://github.com/symfony/symfony-docs/pull/5088>`_ [Cookbook] Custom compile steps on Heroku (bicpi)
* `#5005 <https://github.com/symfony/symfony-docs/pull/5005>`_ Renamed precision option to scale (WouterJ)

Fixed Documentation
~~~~~~~~~~~~~~~~~~~

* `#5324 <https://github.com/symfony/symfony-docs/pull/5324>`_ 5259 improve 'Testing Documentation' in contributing guide (snoek09)
* `#5328 <https://github.com/symfony/symfony-docs/pull/5328>`_ Update create_form_type_extension.rst (jackdelin)
* `#5305 <https://github.com/symfony/symfony-docs/pull/5305>`_ [BestPractices][Security] revert #5271 on the 2.6 branch (xabbuh)
* `#5251 <https://github.com/symfony/symfony-docs/pull/5251>`_ [Cookbook][Controller] replace docs for removed `forward()` method (xabbuh)
* `#5237 <https://github.com/symfony/symfony-docs/pull/5237>`_ Update authentication.rst (taavit)
* `#5299 <https://github.com/symfony/symfony-docs/pull/5299>`_ Command controller tweaks to #5062 (weaverryan)
* `#5297 <https://github.com/symfony/symfony-docs/pull/5297>`_ Kernel Events Proofreading after #4901 (weaverryan)
* `#5296 <https://github.com/symfony/symfony-docs/pull/5296>`_ Fix link to Zend Soap (peterkokot)
* `#5266 <https://github.com/symfony/symfony-docs/pull/5266>`_ Update heroku.rst (nickbyfleet)
* `#5270 <https://github.com/symfony/symfony-docs/pull/5270>`_ Use OptionsResolver (tacman)
* `#5271 <https://github.com/symfony/symfony-docs/pull/5271>`_ Fix nonexistent controller method (amansilla)
* `#4615 <https://github.com/symfony/symfony-docs/pull/4615>`_ Update NotBlank to reflect the actual validation (DRvanR)
* `#5249 <https://github.com/symfony/symfony-docs/pull/5249>`_ [security][form login] fix translations for the security messages. (aitboudad)
* `#5247 <https://github.com/symfony/symfony-docs/pull/5247>`_ [2.7] [Serializer] fixes the order of the Serializer constructor arguments. (hhamon)
* `#5220 <https://github.com/symfony/symfony-docs/pull/5220>`_ Fix example namespace (lepiaf)
* `#5203 <https://github.com/symfony/symfony-docs/pull/5203>`_ Order has one param without spaces (carlosbuenosvinos)
* `#4273 <https://github.com/symfony/symfony-docs/pull/4273>`_ - fix doctrine version in How to Provide Model Classes for several Doctrine Implementations cookbook

Minor Documentation Changes
~~~~~~~~~~~~~~~~~~~~~~~~~~~

* `#5343 <https://github.com/symfony/symfony-docs/pull/5343>`_ [Reference][Forms] reorder index to match the description order (xabbuh)
* `#5309 <https://github.com/symfony/symfony-docs/pull/5309>`_ [Cookbook][Controller] few tweaks to the error pages article (xabbuh)
* `#5311 <https://github.com/symfony/symfony-docs/pull/5311>`_ Moved sections to be equal to index list (WouterJ)
* `#5326 <https://github.com/symfony/symfony-docs/pull/5326>`_ Fixed code intentation (lyrixx)
* `#5327 <https://github.com/symfony/symfony-docs/pull/5327>`_ [Platform] Made things more obvious and copy/paste friendly (lyrixx)
* `#5338 <https://github.com/symfony/symfony-docs/pull/5338>`_ Text in index.html.twig for The Big Picture wrong (BT643)
* `#5341 <https://github.com/symfony/symfony-docs/pull/5341>`_ fixed typo and added additional hit for NullOutput() (kuldipem)
* `#5302 <https://github.com/symfony/symfony-docs/pull/5302>`_ Place DQL in front of QueryBuilder (alfonsomga)
* `#5276 <https://github.com/symfony/symfony-docs/pull/5276>`_ Better illustrate what the "user mistake" is. (diamondsea)
* `#5304 <https://github.com/symfony/symfony-docs/pull/5304>`_ Proofreading Javier's excellent updates - in some places, shortening some things (weaverryan)
* `#5263 <https://github.com/symfony/symfony-docs/pull/5263>`_ Let docbot review the form docs (WouterJ)
* `#5280 <https://github.com/symfony/symfony-docs/pull/5280>`_ Rebase #4633 (seangallavan)
* `#5241 <https://github.com/symfony/symfony-docs/pull/5241>`_ [Components][Form] apply some fixes to the Form events chapter (xabbuh)
* `#5233 <https://github.com/symfony/symfony-docs/pull/5233>`_ Improve Choice Validation Constraint Example (huebs)
* `#5228 <https://github.com/symfony/symfony-docs/pull/5228>`_ Clarify `query_builder` closure return type (kix)
* `#5165 <https://github.com/symfony/symfony-docs/pull/5165>`_ Minor changes to match the Symfony Demo reference application (javiereguiluz)
* `#5281 <https://github.com/symfony/symfony-docs/pull/5281>`_ store templates under app/Resources/views (xabbuh)
* `#5267 <https://github.com/symfony/symfony-docs/pull/5267>`_ fix infinity upper bound (xabbuh)
* `#5277 <https://github.com/symfony/symfony-docs/pull/5277>`_ always refer to getcomposer.org through HTTPS (xabbuh)
* `#4671 <https://github.com/symfony/symfony-docs/pull/4671>`_ consistent spelling (xabbuh)
* `#4255 <https://github.com/symfony/symfony-docs/pull/4255>`_ Updated autoload standard to PSR-4. (phansys)
* `#5278 <https://github.com/symfony/symfony-docs/pull/5278>`_ remove unnecessary code (karion)
* `#5262 <https://github.com/symfony/symfony-docs/pull/5262>`_ Update Routes in the Getting Started documentation (BT643)
* `#5178 <https://github.com/symfony/symfony-docs/pull/5178>`_ Usage of denyAccessUnlessGranted in the controller (94noni)
* `#5229 <https://github.com/symfony/symfony-docs/pull/5229>`_ Remove mention of \*.class parameters from conventions (jvasseur)
* `#5250 <https://github.com/symfony/symfony-docs/pull/5250>`_ [Cookbook][Logging] use straightforward instead of straigt forward (xabbuh)
* `#5257 <https://github.com/symfony/symfony-docs/pull/5257>`_ Let docbot review the constraint docs (WouterJ)
* `#5222 <https://github.com/symfony/symfony-docs/pull/5222>`_ Update service_container.rst (assoum891)
* `#5221 <https://github.com/symfony/symfony-docs/pull/5221>`_ Update Uglifyjs.rst (assoum891)
* `#5219 <https://github.com/symfony/symfony-docs/pull/5219>`_ Fix contradicting merging policy rules (lscholten)
* `#5217 <https://github.com/symfony/symfony-docs/pull/5217>`_ Update _payload-option.rst.inc (bvleur)
* `#5226 <https://github.com/symfony/symfony-docs/pull/5226>`_ Update http_cache.rst (assoum891)
* `#5238 <https://github.com/symfony/symfony-docs/pull/5238>`_ Fixed typo and removed outdated imports (nomack84)
* `#5240 <https://github.com/symfony/symfony-docs/pull/5240>`_ [Cookbook][Email] revert #4808 (xabbuh)


April, 2015
-----------

Expand Down
2 changes: 1 addition & 1 deletion components/dependency_injection/lazy_services.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ the `ProxyManager bridge`_:

.. code-block:: bash
$ php composer.phar require ocramius/proxy-manager:~0.5
$ php composer.phar require ocramius/proxy-manager:~1.0
Afterwards compile your container and check to make sure that you get
a proxy for your lazy services.
Expand Down
2 changes: 1 addition & 1 deletion components/finder.rst
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ And it also works with user-defined streams::
use Symfony\Component\Finder\Finder;

$s3 = new \Zend_Service_Amazon_S3($key, $secret);
$s3->registerStreamWrapper("s3");
$s3->registerStreamWrapper('s3');

$finder = new Finder();
$finder->name('photos*')->size('< 100K')->date('since 1 hour ago');
Expand Down
Loading

0 comments on commit 078bb2d

Please sign in to comment.