8000 Merge branch '3.3' into 3.4 · symfony/symfony-docs@556be4d · GitHub
[go: up one dir, main page]

Skip to content

Commit 556be4d

Browse files
committed
Merge branch '3.3' into 3.4
* 3.3: (31 commits) Update resources.rst Update events.rst Improved a help note about authentication providers [#8280] add missing trailing comma [#8282] fix regex delimiters Add missing comment Update parameters.rst validateValue() is deprecated in 3.0 prefer getObject as getEntity is deprecated Fix non-existing Ldap::find() method Fix encore versioning config for SF 4 structure Update serializer.rst [#8308] fix commands order Update NotIdenticalTo.rst Correct psr/log package name Fixed typo Update debugging.rst Update group_service_resolver.rst Update remember_me.rst Update expression_language.rst ...
2 parents d410c46 + f72237d commit 556be4d

31 files changed

+157
-60
lines changed

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/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/serializer.rst

Lines changed: 1 addition & 1 deletion
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\Obje 10000 ctNormalizer;
410410
use Symfony\Component\Serializer\Serializer;
411411

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

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.

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/dynamic_form_modification.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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: 2 additions & 2 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.

form/form_collections.rst

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,8 @@ Notice that you embed a collection of ``TagType`` forms using the
130130
$builder->add('description');
131131

132132
$builder->add('tags', CollectionType::class, array(
133-
'entry_type' => TagType::class
133+
'entry_type' => TagType::class,
134+
'entry_options' => array('label' => false),
134135
));
135136
}
136137

@@ -285,8 +286,9 @@ add the ``allow_add`` option to your collection field::
285286
$builder->add('description');
286287

287288
$builder->add('tags', CollectionType::class, array(
288-
'entry_type' => TagType::class,
289-
'allow_add' => true,
289+
'entry_type' => TagType::class,
290+
'entry_options' => array('label' => false),
291+
'allow_add' => true,
290292
));
291293
}
292294

@@ -392,9 +394,15 @@ one example:
392394
// get the new index
393395
var index = $collectionHolder.data('index');
394396
397+
var newForm = prototype;
398+
// You need this only if you didn't set 'label' => false in your tags field in TaskType
399+
// Replace '__name__label__' in the prototype's HTML to
400+
// instead be a number based on how many items we have
401+
// newForm = newForm.replace(/__name__label__/g, index);
402+
395403
// Replace '__name__' in the prototype's HTML to
396404
// instead be a number based on how many items we have
397-
var newForm = prototype.replace(/__name__/g, index);
405+
newForm = newForm.replace(/__name__/g, index);
398406
399407
// increase the index with one for the next item
400408
$collectionHolder.data('index', index + 1);

forms.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -639,6 +639,7 @@ the choice is ultimately up to you.
639639
good idea to explicitly specify the ``data_class`` option by adding the
640640
following to your form type class::
641641

642+
// src/AppBundle/Form/TaskType.php
642643
use AppBundle\Entity\Task;
643644
use Symfony\Component\OptionsResolver\OptionsResolver;
644645

frontend/encore/babel.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Need to extend the Babel configuration further? The easiest way is via
2323
babelConfig.presets.push('es2017');
2424
2525
// no plugins are added by default, but you can add some
26-
// babelConfig.plugins = ['styled-jsx/babel'];
26+
// babelConfig.plugins.push('styled-jsx/babel');
2727
})
2828
;
2929

frontend/encore/css-preprocessors.rst

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,19 @@ And enable it in ``webpack.config.js``:
5959
.enableLessLoader()
6060
;
6161
62-
That's it! All files ending in ``.less`` will be pre-processed.
62+
That's it! All files ending in ``.less`` will be pre-processed. You can also pass
63+
options to ``less-loader``:
64+
65+
.. code-block:: javascript
66+
67+
// webpack.config.js
68+
// ...
69+
70+
Encore
71+
// ...
72+
.enableLessLoader(function(options) {
73+
// https://github.com/webpack-contrib/less-loader#examples
74+
// http://lesscss.org/usage/#command-line-usage-options
75+
// options.relativeUrls = false;
76+
});
77+
;

frontend/encore/dev-server.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,19 @@ by the normal `webpack-dev-server`_. For example:
2424
2525
This will start a server at ``https://localhost:9000``.
2626

27+
Using dev-server inside a VM
28+
----------------------------
29+
30+
If you're using ``dev-server`` from inside a virtual machine, then you'll need
31+
to bind to all IP addresses and allow any host to access the server:
32+
33+
.. code-block:: terminal
34+
35+
$ ./node_modules/.bin/encore dev-server --host 0.0.0.0 --disable-host-check
36+
37+
You can now access the dev-server using the IP address to your virtual machine on
38+
port 8080 - e.g. http://192.168.1.1:8080.
39+
2740
Hot Module Replacement HMR
2841
--------------------------
2942

frontend/encore/postcss.rst

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,20 @@ Then, Enable the loader in Encore!
3636
;
3737
3838
That's it! The ``postcss-loader`` will now be used for all CSS, Sass, etc files.
39+
You can also pass options to the `postcss-loader`_ by passing a callback:
40+
41+
.. code-block:: diff
42+
43+
// webpack.config.js
44+
45+
Encore
46+
// ...
47+
+ .enablePostCssLoader((options) => {
48+
+ options.config = {
49+
+ path: 'app/config/postcss.config.js'
50+
+ };
51+
+ })
52+
;
3953
4054
Adding browserslist to package.json
4155
-----------------------------------
@@ -62,4 +76,5 @@ See `browserslist`_ for more details on the syntax.
6276
.. _`autoprefixing`: https://github.com/postcss/autoprefixer
6377
.. _`linting`: https://stylelint.io/
6478
.. _`browserslist`: https://github.com/ai/browserslist
65-
.. _`babel-preset-env`: https://github.com/babel/babel-preset-env
79+
.. _`babel-preset-env`: https://github.com/babel/babel-preset-env
80+
.. _`postcss-loader`: https://github.com/postcss/postcss-loader

frontend/encore/simple-example.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,11 @@ To build the assets, use the ``encore`` executable:
7070
# compile assets, but also minify & optimize them
7171
$ ./node_modules/.bin/encore production
7272
73+
# shorter version of the above 3 commands
74+
$ yarn run encore dev
75+
$ yarn run encore dev -- --watch
76+
$ yarn run encore production
77+
7378
.. note::
7479

7580
Re-run ``encore`` each time you update your ``webpack.config.js`` file.

frontend/encore/typescript.rst

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,33 @@ also configure the `ts-loader options`_ via a callback:
3434
If React assets are enabled (``.enableReactPreset()``), any ``.tsx`` file will be
3535
processed as well by ``ts-loader``.
3636

37-
Loader usage can be checked better in its `README`_ documentation.
37+
More information about the ``ts-loader`` can be found in its `README`_.
3838

39-
"Use webpack like normal, including ``webpack --watch`` and ``webpack-dev-server``,
40-
or through another build system using the Node.js API."
39+
Faster Builds with fork-ts-checker-webpack-plugin
40+
-------------------------------------------------
4141

42-
-- Running section of ts-loader documentation
42+
By using `fork-ts-checker-webpack-plugin`_, you can run type checking in a separate
43+
process, which can speedup compile time. To enable it, install the plugin:
44+
45+
.. code-block:: terminal
46+
47+
$ yarn add --dev fork-ts-checker-webpack-plugin
48+
49+
Then enable it by calling:
50+
51+
.. code-block:: diff
52+
53+
// webpack.config.js
54+
55+
Encore
56+
// ...
57+
enableForkedTypeScriptTypesChecking()
58+
;
59+
60+
This plugin requires that you have a `tsconfig.json`_ file that is setup correctly.
4361

4462
.. _`TypeScript`: https://www.typescriptlang.org/
4563
.. _`ts-loader options`: https://github.com/TypeStrong/ts-loader#options
4664
.. _`README`: https://github.com/TypeStrong/ts-loader#typescript-loader-for-webpack
65+
.. _`fork-ts-checker-webpack-plugin`: https://www.npmjs.com/package/fork-ts-checker-webpack-plugin
66+
.. _`tsconfig.json`: https://www.npmjs.com/package/fork-ts-checker-webpack-plugin#modules-resolution

frontend/encore/versioning.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ ignoring any existing cache:
1616
// ...
1717
1818
Encore
19-
.setOutputPath('web/build/')
19+
.setOutputPath('public/build/')
2020
// ...
2121
+ .enableVersioning()
2222
@@ -49,7 +49,7 @@ in your ``script`` and ``link`` tags. If you're using Symfony, just activate the
4949
# ...
5050
assets:
5151
# feature is supported in Symfony 3.3 and higher
52-
json_manifest_path: '%kernel.project_dir%/web/build/manifest.json'
52+
json_manifest_path: '%kernel.project_dir%/public/build/manifest.json'
5353
5454
That's it! Just be sure to wrap each path in the Twig ``asset()`` function
5555
like normal:

reference/configuration/doctrine.rst

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Full Default Configuration
2424
commented: true
2525
# If defined, all the tables whose names match this regular expression are ignored
2626
# by the schema tool (in this example, any table name starting with `wp_`)
27-
#schema_filter: "/^wp_/"
27+
#schema_filter: '/^(?!wp_)/'
2828
2929
connections:
3030
# A collection of different named connections (e.g. default, conn2, etc)
@@ -299,9 +299,10 @@ certain classes, but those are for very advanced use-cases only.
299299
Caching Drivers
300300
~~~~~~~~~~~~~~~
301301

302-
For the caching drivers you can specify the values ``array``, ``apc``, ``apcu``,
303-
``memcache``, ``memcached``, ``redis``, ``wincache``, ``zenddata``, ``xcache``
304-
or ``service``.
302+
The built-in types of caching drivers are: ``array``, ``apc``, ``apcu``,
303+
``memcache``, ``memcached``, ``redis``, ``wincache``, ``zenddata`` and ``xcache``.
304+
There is a special type called ``service`` which lets you define the ID of your
305+
own caching service.
305306

306307
The following example shows an overview of the caching configurations:
307308

@@ -310,15 +311,17 @@ The following example shows an overview of the caching configurations:
310311
doctrine:
311312
orm:
312313
auto_mapping: true
314+
# each caching driver type defines its own config options
313315
metadata_cache_driver: apc
314-
query_cache_driver:
315-
type: service
316-
id: my_doctrine_common_cache_service
317316
result_cache_driver:
318317
type: memcache
319318
host: localhost
320319
port: 11211
321320
instance_class: Memcache
321+
# the 'service' type requires to define the 'id' option too
322+
query_cache_driver:
323+
type: service
324+
id: my_doctrine_common_cache_service
322325
323326
Mapping Configuration
324327
~~~~~~~~~~~~~~~~~~~~~

reference/constraints/NotIdenticalTo.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,6 @@ message
118118

119119
**type**: ``string`` **default**: ``This value should not be identical to {{ compared_value_type }} {{ compared_value }}.``
120120

121-
This is the message that will be shown if the value is not equal.
121+
This is the message that will be shown if the value is identical.
122122

123123
.. include:: /reference/constraints/_payload-option.rst.inc

routing/scheme.rst

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,25 @@ the URI scheme via schemes:
1010

1111
.. configuration-block::
1212

13+
.. code-block:: php-annotations
14+
15+
// src/AppBundle/Controller/MainController.php
16+
namespace AppBundle\Controller;
17+
18+
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
19+
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
20+
21+
class MainController extends Controller
22+
{
23+
/**
24+
* @Route("/secure", name="secure", schemes={"https"})
25+
*/
26+
public function secureAction()
27+
{
28+
// ...
29+
}
30+
}
31+
1332
.. code-block:: yaml
1433
1534
# app/config/routing.yml

0 commit comments

Comments
 (0)
0