Skip to content

Commit 450715e

Browse files
committed
Merge remote-tracking branch 'upstream/3.3' into 3.3
2 parents 9b08483 + 6d25dbb commit 450715e

Some content is hidden

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

52 files changed

+310
-176
lines changed

_build/redirection_map

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@
262262
/cookbook/upgrade/minor_version /setup/upgrade_major
263263
/cookbook/upgrade/patch_version /upgrade/bundles
264264
/cookbook/validation/custom_constraint /validation/custom_constraint
265-
/cookbook/validation/group_service_resolver /validation/group_service_resolver
265+
/cookbook/validation/group_service_resolver /form/validation_group_service_resolver
266266
/cookbook/validation/index /validation
267267
/cookbook/validation/severity /validation/severity
268268
/cookbook/web_server/built_in /setup/built_in_web_server
@@ -287,6 +287,7 @@
287287
/components/debug/introduction /components/debug
288288
/components/debug/index /components/debug
289289
/components/dependency_injection/advanced /service_container/alias_private
290+
/components/dependency_injection/autowiring /service_container/autowiring
290291
/components/dependency_injection/definitions /service_container/definitions
291292
/components/dependency_injection/introduction /components/dependency_injection
292293
/components/dependency_injection/index /components/dependency_injection
@@ -310,6 +311,7 @@
310311
/components/form/type_guesser /form/type_guesser
311312
/components/http_foundation/index /components/http_foundation
312313
/components/http_foundation/introduction /components/http_foundation
314+
/components/http_foundation/trusting_proxies /request/load_balancer_reverse_proxy
313315
/components/http_kernel/introduction /components/http_kernel
314316
/components/http_kernel/index /components/http_kernel
315317
/components/property_access/introduction /components/property_access
@@ -331,11 +333,11 @@
331333
/components/yaml/index /components/yaml
332334
/deployment/tools /deployment
333335
/install/bundles /setup/bundles
334-
/form /forms
335-
/testing/simulating_authentication /testing/http_authentication
336-
/components/dependency_injection/autowiring /service_container/autowiring
337336
/event_dispatcher/class_extension /event_dispatcher
337+
/form /forms
338+
/form/use_virtual_forms /form/inherit_data_option
338339
/security/target_path /security
339340
/service_container/third_party /service_container
340341
/templating/templating_service /templates
341-
/components/http_foundation/trusting_proxies /request/load_balancer_reverse_proxy
342+
/testing/simulating_authentication /testing/http_authentication
343+
/validation/group_service_resolver /form/validation_group_service_resolver

components/console/logger.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ The Console component comes with a standalone logger complying with the
99
be sent to the :class:`Symfony\\Component\\Console\\Output\\OutputInterface`
1010
instance passed as a parameter to the constructor.
1111

12-
The logger does not have any external dependency except ``php-fig/log``.
12+
The logger does not have any external dependency except ``psr/log``.
1313
This is useful for console applications and commands needing a lightweight
1414
PSR-3 compliant logger::
1515

components/console/single_command_tool.rst

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,8 @@ Of course, you can still register a command as usual::
3939
<?php
4040
require __DIR__.'/vendor/autoload.php';
4141

42-
use Symfony\Component\Console\Application;
43-
use Symfony\Component\Console\Input\InputArgument;
44-
use Symfony\Component\Console\Input\InputInterface;
45-
use Symfony\Component\Console\Input\InputOption;
46-
use Symfony\Component\Console\Output\OutputInterface;
47-
4842
use Acme\Command\DefaultCommand;
43+
use Symfony\Component\Console\Application;
4944

5045
$application = new Application('echo', '1.0.0');
5146
$command = new DefaultCommand();

components/filesystem.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,13 @@ On POSIX filesystems, directories are created with a default mode value
6464

6565
This function ignores already existing directories.
6666

67+
.. note::
68+
69+
The directory permissions are affected by the current `umask`_.
70+
Set the umask for your webserver, use PHP's :phpfunction:`umask`
71+
function or use the :phpfunction:`chmod` function after the
72+
directory has been created.
73+
6774
exists
6875
~~~~~~
6976

@@ -320,3 +327,4 @@ Learn More
320327
filesystem/*
321328

322329
.. _`Packagist`: https://packagist.org/packages/symfony/filesystem
330+
.. _`umask`: https://en.wikipedia.org/wiki/Umask

components/ldap.rst

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,11 @@ using the following options:
3737
``version``
3838
The version of the LDAP protocol to use
3939

40-
``useSsl``
41-
Whether or not to secure the connection using SSL
40+
``encryption``
41+
The encryption protocol : ``ssl``, ``tls`` or ``none`` (default)
4242

43-
``useStartTls``
44-
Whether or not to secure the connection using StartTLS
45-
46-
``optReferrals``
47-
Specifies whether to automatically follow referrals
48-
returned by the LDAP server
43+
``options``
44+
LDAP server's options as defined in :class:`ConnectionOptions <Symfony\\Component\\Ldap\\Adapter\\ExtLdap\\ConnectionOptions>`
4945

5046
For example, to connect to a start-TLS secured LDAP server::
5147

@@ -73,10 +69,10 @@ distinguished name (DN) and the password of a user::
7369

7470
Once bound (or if you enabled anonymous authentication on your
7571
LDAP server), you may query the LDAP server using the
76-
:method:`Symfony\\Component\\Ldap\\Ldap::find` method::
72+
:method:`Symfony\\Component\\Ldap\\Ldap::query` method::
7773

7874
// ...
7975

80-
$ldap->find('dc=symfony,dc=com', '(&(objectclass=person)(ou=Maintainers))');
76+
$ldap->query('dc=symfony,dc=com', '(&(objectclass=person)(ou=Maintainers))');
8177

8278
.. _Packagist: https://packagist.org/packages/symfony/ldap

components/phpunit_bridge.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,14 +224,14 @@ If you have this kind of time-related tests::
224224
sleep(10);
225225
$duration = $stopwatch->stop('event_name')->getDuration();
226226

227-
$this->assertEquals(10, $duration);
227+
$this->assertEquals(10000, $duration);
228228
}
229229
}
230230

231231
You used the :doc:`Symfony Stopwatch Component </components/stopwatch>` to
232232
calculate the duration time of your process, here 10 seconds. However, depending
233233
on the load of the server or the processes running on your local machine, the
234-
``$duration`` could for example be `10.000023s` instead of `10s`.
234+
``$duration`` could for example be ``10.000023s`` instead of ``10s``.
235235

236236
This kind of tests are called transient tests: they are failing randomly
237237
depending on spurious and external circumstances. They are often cause trouble

components/serializer.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ class extending :class:`Symfony\\Component\\Serializer\\Normalizer\\AbstractNorm
405405
including :class:`Symfony\\Component\\Serializer\\Normalizer\\GetSetMethodNormalizer`
406406
and :class:`Symfony\\Component\\Serializer\\Normalizer\\PropertyNormalizer`::
407407

408-
use Symfony\Component\Serializer\Encoder\JsonEncoder
408+
use Symfony\Component\Serializer\Encoder\JsonEncoder;
409409
use Symfony\Component\Serializer\Normalizer\ObjectNormalizer;
410410
use Symfony\Component\Serializer\Serializer;
411411

@@ -418,9 +418,9 @@ and :class:`Symfony\\Component\\Serializer\\Normalizer\\PropertyNormalizer`::
418418
$obj->name = 'Acme Inc.';
419419
$obj->address = '123 Main Street, Big City';
420420

421-
$json = $serializer->serialize($obj);
421+
$json = $serializer->serialize($obj, 'json');
422422
// {"org_name": "Acme Inc.", "org_address": "123 Main Street, Big City"}
423-
$objCopy = $serializer->deserialize($json);
423+
$objCopy = $serializer->deserialize($json, Company::class, 'json');
424424
// Same data as $obj
425425

426426
.. _using-camelized-method-names-for-underscored-attributes:

components/validator/resources.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,14 +173,14 @@ Using a Custom MetadataFactory
173173
------------------------------
174174

175175
All the loaders and the cache are passed to an instance of
176-
:class:`Symfony\\Component\\Validator\\Mapping\\ClassMetadataFactory`. This
177-
class is responsible for creating a ``ClassMetadata`` instance from all the
176+
:class:`Symfony\\Component\\Validator\\Mapping\\Factory\\LazyLoadingMetadataFactory`.
177+
This class is responsible for creating a ``ClassMetadata`` instance from all the
178178
configured resources.
179179

180180
You can also use a custom metadata factory implementation by creating a class
181181
which implements
182-
:class:`Symfony\\Component\\Validator\\MetadataFactoryInterface`. You can set
183-
this custom implementation using
182+
:class:`Symfony\\Component\\Validator\\Mapping\\Factory\\MetadataFactoryInterface`.
183+
You can set this custom implementation using
184184
:method:`Symfony\\Component\\Validator\\ValidatorBuilder::setMetadataFactory`::
185185

186186
use Acme\Validation\CustomMetadataFactory;

components/var_dumper.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ Choosing between both is mostly a matter of personal taste, still:
101101
be suited to your use case (e.g. you shouldn't use it in an HTML
102102
attribute or a ``<script>`` tag).
103103

104-
This behavior can be changed by configuring the ``dump.dump_destination``
104+
This behavior can be changed by configuring the ``debug.dump_destination``
105105
option. Read more about this and other options in
106106
:doc:`the DebugBundle configuration reference </reference/configuration/debug>`.
107107

controller/upload_file.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,7 @@ automatically upload the file when persisting the entity::
329329
class BrochureUploadListener
330330
{
331331
private $uploader;
332+
private $fileName;
332333

333334
public function __construct(FileUploader $uploader)
334335
{
@@ -359,11 +360,10 @@ automatically upload the file when persisting the entity::
359360
$file = $entity->getBrochure();
360361

361362
// only upload new files
362-
if (!$file instanceof UploadedFile) {
363-
return;
363+
if ($file instanceof UploadedFile) {
364+
$fileName = $this->uploader->upload($file);
364365
}
365366

366-
$fileName = $this->uploader->upload($file);
367367
$entity->setBrochure($fileName);
368368
}
369369
}

debug/debugging.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ that can help you visualize and find the information.
7575
``debug:config``
7676
Shows all configured bundles, their class and their alias.
7777

78+
``debug:event-dispatcher``
79+
Displays information about all the registered listeners in the event dispatcher.
80+
7881
``debug:router``
7982
Displays information about all configured routes in the application as a
8083
table with the name, method, scheme, host and path for each route.

deployment/platformsh.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,14 @@ following file (it's your role to add this file to your code base)::
126126
# Store session into /tmp.
127127
ini_set('session.save_path', '/tmp/sessions');
128128

129-
Make sure this file is listed in your *imports*:
129+
Make sure this file is listed in your *imports* (after the default ``parameters.yml``
130+
file):
130131

131132
.. code-block:: yaml
132133
133134
# app/config/config.yml
134135
imports:
136+
- { resource: parameters.yml }
135137
- { resource: parameters_platform.php }
136138
137139
Deploy your Application

doctrine.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -539,17 +539,17 @@ Take a look at the previous example in more detail:
539539

540540
.. _doctrine-entity-manager:
541541

542-
* **line 13** The ``$this->getDoctrine()->getManager()`` method gets Doctrine's
542+
* **line 12** The ``$this->getDoctrine()->getManager()`` method gets Doctrine's
543543
*entity manager* object, which is the most important object in Doctrine. It's
544544
responsible for saving objects to, and fetching objects from, the database.
545545

546-
* **lines 15-18** In this section, you instantiate and work with the ``$product``
546+
* **lines 14-17** In this section, you instantiate and work with the ``$product``
547547
object like any other normal PHP object.
548548

549-
* **line 21** The ``persist($product)`` call tells Doctrine to "manage" the
549+
* **line 20** The ``persist($product)`` call tells Doctrine to "manage" the
550550
``$product`` object. This does **not** cause a query to be made to the database.
551551

552-
* **line 24** When the ``flush()`` method is called, Doctrine looks through
552+
* **line 23** When the ``flush()`` method is called, Doctrine looks through
553553
all of the objects that it's managing to see if they need to be persisted
554554
to the database. In this example, the ``$product`` object's data doesn't
555555
exist in the database, so the entity manager executes an ``INSERT`` query,

doctrine/associations.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ When you need to fetch associated objects, your workflow looks just like it
273273
did before. First, fetch a ``$product`` object and then access its related
274274
``Category`` object::
275275

276-
use AppBundle\Entity\Post;
276+
use AppBundle\Entity\Product;
277277
// ...
278278

279279
public function showAction($productId)
@@ -368,8 +368,7 @@ following method to the ``ProductRepository`` class::
368368
// src/AppBundle/Repository/ProductRepository.php
369369
public function findOneByIdJoinedToCategory($productId)
370370
{
371-
$query = $this->getDoctrine()
372-
->getManager()
371+
$query = $this->getEntityManager()
373372
->createQuery(
374373
'SELECT p, c FROM AppBundle:Product p
375374
JOIN p.category c

doctrine/event_listeners_subscribers.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ interface and have an event method for each event it subscribes to::
165165

166166
public function index(LifecycleEventArgs $args)
167167
{
168-
$entity = $args->getEntity();
168+
$entity = $args->getObject();
169169

170170
// perhaps you only want to act on some "Product" entity
171171
if ($entity instanceof Product) {

form/button_based_validation.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ large or whether you tried to submit text in a number field.
3636
.. seealso::
3737

3838
To see how to use a service to resolve ``validation_groups`` dynamically
39-
read the :doc:`/validation/group_service_resolver` article.
39+
read the :doc:`/form/validation_group_service_resolver` article.

form/create_custom_field_type.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ Using the Field Type
251251
You can now use your custom field type immediately, simply by creating a
252252
new instance of the type in one of your forms::
253253

254-
// src/AppBundle/Form/Type/AuthorType.php
254+
// src/AppBundle/Form/Type/OrderType.php
255255
namespace AppBundle\Form\Type;
256256

257257
use Symfony\Component\Form\AbstractType;

form/data_transformers.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Simple Example: Transforming String Tags from User Input to an Array
2323

2424
Suppose you have a Task form with a tags ``text`` type::
2525

26-
// src/AppBundle/Form/TaskType.php
26+
// src/AppBundle/Form/Type/TaskType.php
2727
namespace AppBundle\Form\Type;
2828

2929
use AppBundle\Entity\Task;
@@ -56,7 +56,7 @@ This is a *perfect* time to attach a custom data transformer to the ``tags``
5656
field. The easiest way to do this is with the :class:`Symfony\\Component\\Form\\CallbackTransformer`
5757
class::
5858

59-
// src/AppBundle/Form/TaskType.php
59+
// src/AppBundle/Form/Type/TaskType.php
6060
namespace AppBundle\Form\Type;
6161

6262
use Symfony\Component\Form\CallbackTransformer;
@@ -120,7 +120,7 @@ issue number.
120120

121121
Start by setting up the text field like normal::
122122

123-
// src/AppBundle/Form/TaskType.php
123+
// src/AppBundle/Form/Type/TaskType.php
124124
namespace AppBundle\Form\Type;
125125

126126
use AppBundle\Entity\Task;
@@ -250,7 +250,7 @@ Next, you need to use the ``IssueToNumberTransformer`` object inside if ``TaskTy
250250
and add it to the ``issue`` field. No problem! Just add a ``__construct()`` method
251251
and type-hint the new class::
252252

253-
// src/AppBundle/Form/TaskType.php
253+
// src/AppBundle/Form/Type/TaskType.php
254254
namespace AppBundle\Form\Type;
255255

256256
use AppBundle\Form\DataTransformer\IssueToNumberTransformer;
@@ -374,7 +374,7 @@ have the data transformer *and* a nice default value for the ``invalid_message``
374374
As long as you're using :ref:`autowire <services-autowire>` and
375375
:ref:`autoconfigure <services-autoconfigure>`, you can start using the form immediately::
376376

377-
// src/AppBundle/Form/TaskType.php
377+
// src/AppBundle/Form/Type/TaskType.php
378378
namespace AppBundle\Form\Type;
379379

380380
use AppBundle\Form\DataTransformer\IssueToNumberTransformer;

form/dynamic_form_modification.rst

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ Customizing the Form Type
260260
Now that you have all the basics in place you can take advantage of the ``TokenStorageInterface``
261261
and fill in the listener logic::
262262

263-
// src/AppBundle/FormType/FriendMessageFormType.php
263+
// src/AppBundle/Form/Type/FriendMessageFormType.php
264264

265265
use AppBundle\Entity\User;
266266
use Doctrine\ORM\EntityRepository;
@@ -412,7 +412,6 @@ sport like this::
412412
'class' => 'AppBundle:Position',
413413
'placeholder' => '',
414414
'choices' => $positions,
415-
'choices_as_values' => true,
416415
));
417416
}
418417
);
@@ -469,7 +468,6 @@ The type would now look like::
469468
'class' => 'AppBundle:Position',
470469
'placeholder' => '',
471470
'choices' => $positions,
472-
'choices_as_values' => true,
473471
));
474472
};
475473

form/events.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ View data ``null``
8484

8585
.. sidebar:: ``FormEvents::PRE_SET_DATA`` in the Form component
8686

87-
The ``collection`` form type relies on the
88-
``Symfony\Component\Form\Extension\Core\EventListener\ResizeFormListener``
87+
The ``Symfony\Component\Form\Extension\Core\Type\CollectionType`` form type relies
88+
on the ``Symfony\Component\Form\Extension\Core\EventListener\ResizeFormListener``
8989
subscriber, listening to the ``FormEvents::PRE_SET_DATA`` event in order
9090
to reorder the form's fields depending on the data from the pre-populated
9191
object, by removing and adding all form rows.
@@ -304,6 +304,7 @@ callback for better readability::
304304

305305
use Symfony\Component\Form\Extension\Core\Type\TextType;
306306
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
307+
use Symfony\Component\Form\FormEvent;
307308
use Symfony\Component\Form\FormEvents;
308309

309310
// ...
@@ -391,9 +392,9 @@ Event subscribers have different uses:
391392
392393
To register the event subscriber, use the ``addEventSubscriber()`` method::
393394

395+
use AppBundle\Form\EventListener\AddEmailFieldListener;
394396
use Symfony\Component\Form\Extension\Core\Type\TextType;
395397
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
396-
use AppBundle\Form\EventListener\AddEmailFieldListener;
397398

398399
// ...
399400

0 commit comments

Comments
 (0)