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

Skip to content
8000

Commit ac970b2

Browse files
committed
Merge branch '3.4'
* 3.4: (34 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 ef97812 + 556be4d commit ac970b2

33 files changed

+182
-61
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\ObjectNormalizer;
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

components/yaml/yaml_format.rst

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,4 +300,28 @@ Comments can be added in YAML by prefixing them with a hash mark (``#``):
300300
Comments are simply ignored by the YAML parser and do not need to be
301301
indented according to the current level of nesting in a collection.
302302

303+
Explicit Typing
304+
---------------
305+
306+
The YAML specification defines some tags to set the type of any data explicitly:
307+
308+
.. code-block:: yaml
309+
310+
data:
311+
# this value is parsed as a string (it's not transformed into a DateTime)
312+
start_date: !!str 2002-12-14
313+
314+
# this value is parsed as a float number (it will be 3.0 instead of 3)
315+
price: !!float 3
316+
317+
# this value is parsed as binary data encoded in base64
318+
picture: !!binary |
319+
R0lGODlhDAAMAIQAAP//9/X
320+
17unp5WZmZgAAAOfn515eXv
321+
Pz7Y6OjuDg4J+fn5OTk6enp
322+
56enmleECcgggoBADs=
323+
324+
.. versionadded:: 3.4
325+
Support for the ``!!str`` tag was introduced in Symfony 3.4.
326+
303327
.. _YAML: http://yaml.org/

debug/debugging.rst

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

31+
``debug:event-dispatcher``
32+
Displays information about all the registered listeners in the event dispatcher.
33+
3134
``debug:router``
3235
Displays information about all configured routes in the application as a
3336
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/debug.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ min_depth
3838

3939
Configures the minimum tree depth until which all items are guaranteed to
4040
be cloned. After this depth is reached, only ``max_items`` items will be
41-
cloned. The default value is ``1``, which is consistentcwith older Symfony
41+
cloned. The default value is ``1``, which is consistent with older Symfony
4242
versions.
4343

4444
.. versionadded:: 3.4

0 commit comments

Comments
 (0)
0