Skip to content

Commit ba7805e

Browse files
committed
Merge branch '4.0' into 4.1
* 4.0: (24 commits) updating the guard session migration details for Symfony 3.4 changes Avoiding authentication on every request with Guard Minor typo in csrf.rst [Filesystem] Improved the code of an example Removed another usage of mt_rand() Transition from mt_rand to random_int Update setup.rst remove not existent label_attr options from buttons Fixed some code indentation Added the versionadded directive add missing XML and PHP code examples Expanded the explanation a bit Minor fixes Update licence hint for JMS serializer Revert "minor #9507 Document the built in env var processors (mcfedr, javiereguiluz)" Minor rewords and formatting fixes Example of customer env var processor Add examples for parameter processors Add description of the built in envvar processors Mention that "exclude" option now accepts arrays too ...
2 parents c35b335 + e5040d0 commit ba7805e

File tree

16 files changed

+876
-178
lines changed

16 files changed

+876
-178
lines changed

components/filesystem.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ endpoint for filesystem operations::
2929
$fileSystem = new Filesystem();
3030

3131
try {
32-
$fileSystem->mkdir('/tmp/random/dir/'.mt_rand());
32+
$fileSystem->mkdir(sys_get_temp_dir().'/'.random_int(0, 1000));
3333
} catch (IOExceptionInterface $exception) {
3434
echo "An error occurred while creating your directory at ".$exception->getPath();
3535
}

components/finder.rst

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -168,17 +168,27 @@ Sort the result by name or by type (directories first, then files)::
168168

169169
$finder->sortByType();
170170

171-
.. note::
171+
.. tip::
172172

173-
Notice that the ``sort*`` methods need to get all matching elements to do
174-
their jobs. For large iterators, it is slow.
173+
By default, the ``sortByName()`` method uses the :phpfunction:`strcmp` PHP
174+
function (e.g. ``file1.txt``, ``file10.txt``, ``file2.txt``). Pass ``true``
175+
as its argument to use PHP's `natural sort order`_ algorithm instead (e.g.
176+
``file1.txt``, ``file2.txt``, ``file10.txt``).
177+
178+
.. versionadded:: 4.2
179+
The option to use the natural sort order was introduced in Symfony 4.2.
175180

176181
You can also define your own sorting algorithm with ``sort()`` method::
177182

178183
$finder->sort(function (\SplFileInfo $a, \SplFileInfo $b) {
179184
return strcmp($a->getRealPath(), $b->getRealPath());
180185
});
181186

187+
.. note::
188+
189+
Notice that the ``sort*`` methods need to get all matching elements to do
190+
their jobs. For large iterators, it is slow.
191+
182192
File Name
183193
~~~~~~~~~
184194

@@ -320,8 +330,9 @@ The contents of returned files can be read with
320330
// ...
321331
}
322332

323-
.. _strtotime: https://php.net/manual/en/datetime.formats.php
324-
.. _protocol: https://php.net/manual/en/wrappers.php
325-
.. _Streams: https://php.net/streams
326-
.. _IEC standard: https://physics.nist.gov/cuu/Units/binary.html
327-
.. _Packagist: https://packagist.org/packages/symfony/finder
333+
.. _strtotime: https://php.net/manual/en/datetime.formats.php
334+
.. _protocol: https://php.net/manual/en/wrappers.php
335+
.. _Streams: https://php.net/streams
336+
.. _IEC standard: https://physics.nist.gov/cuu/Units/binary.html
337+
.. _Packagist: https://packagist.org/packages/symfony/finder
338+
.. _`natural sort order`: https://en.wikipedia.org/wiki/Natural_sort_order

components/ldap.rst

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,38 @@ delete existing ones::
137137
// Removing an existing entry
138138
$entryManager->remove(new Entry('cn=Test User,dc=symfony,dc=com'));
139139

140+
141+
Batch Updating
142+
______________
143+
144+
Use the entry manager's :method:`Symfony\\Component\\Ldap\\Adapter\\ExtLdap\\EntryManager::applyOperations`
145+
method to update multiple attributes at once::
146+
147+
use Symfony\Component\Ldap\Ldap;
148+
use Symfony\Component\Ldap\Entry;
149+
// ...
150+
151+
$entry = new Entry('cn=Fabien Potencier,dc=symfony,dc=com', array(
152+
'sn' => array('fabpot'),
153+
'objectClass' => array('inetOrgPerson'),
154+
));
155+
156+
$entryManager = $ldap->getEntryManager();
157+
158+
// Adding multiple email adresses at once
159+
$entryManager->applyOperations($entry->getDn(), array(
160+
new UpdateOpteration(LDAP_MODIFY_BATCH_ADD, 'mail', 'new1@example.com'),
161+
new UpdateOpteration(LDAP_MODIFY_BATCH_ADD, 'mail', 'new2@example.com'),
162+
));
163+
164+
Possible operation types are ``LDAP_MODIFY_BATCH_ADD``, ``LDAP_MODIFY_BATCH_REMOVE``,
165+
``LDAP_MODIFY_BATCH_REMOVE_ALL``, ``LDAP_MODIFY_BATCH_REPLACE``. Parameter
166+
``$values`` must be ``NULL`` when using ``LDAP_MODIFY_BATCH_REMOVE_ALL``
167+
operation type.
168+
169+
.. versionadded:: 4.2
170+
The ``applyOperations()`` method was introduced in Symfony 4.2.
171+
140172
.. versionadded:: 4.1
141173
The ``addAttributeValues()`` and ``removeAttributeValues()`` methods
142174
were introduced in Symfony 4.1.

components/messenger.rst

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Concepts
4141
Bus
4242
---
4343

44-
The bus is used to dispatch messages. The behaviour of the bus is in its ordered
44+
The bus is used to dispatch messages. The behavior of the bus is in its ordered
4545
middleware stack. The component comes with a set of middleware that you can use.
4646

4747
When using the message bus with Symfony's FrameworkBundle, the following middleware
@@ -66,9 +66,9 @@ Example::
6666

6767
$result = $bus->dispatch(new MyMessage(/* ... */));
6868

69-
.. note:
69+
.. note::
7070

71-
Every middleware needs to implement the ``MiddlewareInterface`` interface.
71+
Every middleware needs to implement the ``MiddlewareInterface``.
7272

7373
Handlers
7474
--------
@@ -92,16 +92,16 @@ that will do the required processing for your message::
9292
Transports
9393
----------
9494

95-
In order to send and receive messages, you will have to configure a transport. An
96-
transport will be responsible of communicating with your message broker or 3rd parties.
95+
In order to send and receive messages, you will have to configure a transport. A
96+
transport will be responsible for communicating with your message broker or 3rd parties.
9797

98-
Your own sender
98+
Your own Sender
9999
~~~~~~~~~~~~~~~
100100

101101
Using the ``SenderInterface``, you can easily create your own message sender.
102-
Let's say you already have an ``ImportantAction`` message going through the
103-
message bus and handled by a handler. Now, you also want to send this message as
104-
an email.
102+
Imagine that you already have an ``ImportantAction`` message going through the
103+
message bus and being handled by a handler. Now, you also want to send this
104+
message as an email.
105105

106106
First, create your sender::
107107

@@ -138,13 +138,13 @@ First, create your sender::
138138
}
139139
}
140140

141-
Your own receiver
141+
Your own Receiver
142142
~~~~~~~~~~~~~~~~~
143143

144144
A receiver is responsible for receiving messages from a source and dispatching
145145
them to the application.
146146

147-
Let's say you already processed some "orders" in your application using a
147+
Imagine you already processed some "orders" in your application using a
148148
``NewOrder`` message. Now you want to integrate with a 3rd party or a legacy
149149
application but you can't use an API and need to use a shared CSV file with new
150150
orders.
@@ -186,10 +186,10 @@ First, create your receiver::
186186
}
187187
}
188188

189-
Receiver and Sender on the same bus
189+
Receiver and Sender on the same Bus
190190
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
191191

192-
To allow us to receive and send messages on the same bus and prevent an infinite
192+
To allow sending and receiving messages on the same bus and prevent an infinite
193193
loop, the message bus is equipped with the ``WrapIntoReceivedMessage`` middleware.
194194
It will wrap the received messages into ``ReceivedMessage`` objects and the
195195
``SendMessageMiddleware`` middleware will know it should not route these

components/serializer.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1261,7 +1261,8 @@ Learn more
12611261
.. seealso::
12621262

12631263
A popular alternative to the Symfony Serializer Component is the third-party
1264-
library, `JMS serializer`_ (released under the Apache license, so incompatible with GPLv2 projects).
1264+
library, `JMS serializer`_ (versions before ``v1.12.0`` were released under
1265+
the Apache license, so incompatible with GPLv2 projects).
12651266

12661267
.. _`PSR-1 standard`: https://www.php-fig.org/psr/psr-1/
12671268
.. _`JMS serializer`: https://github.com/schmittjoh/serializer

0 commit comments

Comments
 (0)