8000 Merge branch '4.0' into 4.1 · symfony/symfony-docs@da8025c · GitHub
[go: up one dir, main page]

Skip to content

Commit da8025c

Browse files
committed
Merge branch '4.0' into 4.1
* 4.0: Remove useless $request Improve the docs about custom form theme config Use callable classes for custom Monolog processors Mentioned the audit_trail workflow option Problem with transactions Update custom_password_authenticator.rst Updated one screencast URL for Symfony 4 Update dependency_injection.rst Update http_kernel_httpkernel_class.rst Remove example of register a service where its id match to its class
2 parents 01e8ed4 + 224138e commit da8025c

File tree

11 files changed

+34
-21
lines changed

11 files changed

+34
-21
lines changed

create_framework/dependency_injection.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ Create a new file to host the dependency injection container configuration::
121121
->setArguments(array('UTF-8'))
122122
;
123123
$containerBuilder->register('listener.exception', HttpKernel\EventListener\ExceptionListener::class)
124-
->setArguments(array('Calendar\Controller\ErrorController::exceptionAction'))
124+
->setArguments(array('Calendar\Controller\ErrorController::exception'))
125125
;
126126
$containerBuilder->register('dispatcher', EventDispatcher\EventDispatcher::class)
127127
->addMethodCall('addSubscriber', array(new Reference('listener.router')))

create_framework/http_kernel_httpkernel_class.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ display. It can take any valid controller as an exception handler, so you can
8282
create an ErrorController class instead of using a Closure::
8383

8484
$listener = new HttpKernel\EventListener\ExceptionListener(
85-
'Calendar\Controller\ErrorController::exceptionAction'
85+
'Calendar\Controller\ErrorController::exception'
8686
);
8787
$dispatcher->addSubscriber($listener);
8888

doctrine.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ Take a look at the previous example in more detail:
402402
is thrown. See `Transactions and Concurrency`_.
403403

404404
Whether you're creating or updating objects, the workflow is always the same: Doctrine
405-
is smart enough to know if it should INSERT of UPDATE your entity.
405+
is smart enough to know if it should INSERT or UPDATE your entity.
406406

407407
Fetching Objects from the Database
408408
----------------------------------

doctrine/pdo_session_storage.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ To use it, first register a new handler service:
2929
# If you're using Doctrine & want to re-use that connection, then:
3030
# comment-out the above 2 lines and uncomment the line below
3131
# - !service { class: PDO, factory: 'database_connection:getWrappedConnection' }
32+
# If you get transaction issues (e.g. after login) uncomment the line below
33+
# - { lock_mode: 1 }
3234
3335
.. code-block:: xml
3436

form/form_themes.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ file:
182182
# config/packages/twig.yaml
183183
twig:
184184
form_themes:
185+
- '...'
185186
- 'form/fields.html.twig'
186187
# ...
187188
@@ -197,6 +198,7 @@ file:
197198
http://symfony.com/schema/dic/twig http://symfony.com/schema/dic/twig/twig-1.0.xsd">
198199
199200
<twig:config>
201+
<twig:theme>...</twig:theme>
200202
<twig:theme>form/fields.html.twig</twig:theme>
201203
<!-- ... -->
202204
</twig:config>
@@ -207,11 +209,17 @@ file:
207209
// config/packages/twig.php
208210
$container->loadFromExtension('twig', array(
209211
'form_themes' => array(
212+
'...',
210213
'form/fields.html.twig',
211214
),
212215
// ...
213216
));
214217
218+
.. note::
219+
220+
Add your custom theme at the end of the ``form_themes`` list because each
221+
theme overrides all the previous themes.
222+
215223
Any blocks inside the ``fields.html.twig`` template are now used globally
216224
to define form output.
217225

logging/processors.rst

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ using a processor::
3030
$this->session = $session;
3131
}
3232

33-
public function processRecord(array $record)
33+
public function __invoke(array $record)
3434
{
3535
if (!$this->session->isStarted()) {
3636
return $record;
@@ -62,7 +62,7 @@ information:
6262
6363
App\Logger\SessionRequestProcessor:
6464
tags:
65-
- { name: monolog.processor, method: processRecord }
65+
- { name: monolog.processor }
6666
6767
.. code-block:: xml
6868
@@ -84,7 +84,7 @@ information:
8484
</service>
8585
8686
<service id="App\Logger\SessionRequestProcessor">
87-
<tag name="monolog.processor" method="processRecord" />
87+
<tag name="monolog.processor" />
8888
</service>
8989
</services>
9090
</container>
@@ -173,7 +173,7 @@ the ``monolog.processor`` tag:
173173
services:
174174
App\Logger\SessionRequestProcessor:
175175
tags:
176-
- { name: monolog.processor, method: processRecord, handler: main }
176+
- { name: monolog.processor, handler: main }
177177
178178
.. code-block:: xml
179179
@@ -189,7 +189,7 @@ the ``monolog.processor`` tag:
189189
190190
<services>
191191
<service id="App\Logger\SessionRequestProcessor">
192-
<tag name="monolog.processor" method="processRecord" handler="main" />
192+
<tag name="monolog.processor" handler="main" />
193193
</service>
194194
</services>
195195
</container>
@@ -201,7 +201,7 @@ the ``monolog.processor`` tag:
201201
// ...
202202
$container
203203
->register(SessionRequestProcessor::class)
204-
->addTag('monolog.processor', array('method' => 'processRecord', 'handler' => 'main'));
204+
->addTag('monolog.processor', array('handler' => 'main'));
205205
206206
Registering Processors per Channel
207207
----------------------------------
@@ -217,7 +217,7 @@ the ``monolog.processor`` tag:
217217
services:
218218
App\Logger\SessionRequestProcessor:
219219
tags:
220-
- { name: monolog.processor, method: processRecord, channel: main }
220+
- { name: monolog.processor, channel: main }
221221
222222
.. code-block:: xml
223223
@@ -233,7 +233,7 @@ the ``monolog.processor`` tag:
233233
234234
<services>
235235
<service id="App\Logger\SessionRequestProcessor">
236-
<tag name="monolog.processor" method="processRecord" channel="main" />
236+
<tag name="monolog.processor" channel="main" />
237237
</service>
238238
</services>
239239
</container>
@@ -245,4 +245,4 @@ the ``monolog.processor`` tag:
245245
// ...
246246
$container
247247
->register(SessionRequestProcessor::class)
248-
->addTag('monolog.processor', array('method' => 'processRecord', 'channel' => 'main'));
248+
->addTag('monolog.processor', array('channel' => 'main'));

security.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1348,4 +1348,4 @@ Other Security Related Topics
13481348
.. _`frameworkextrabundle documentation`: https://symfony.com/doc/current/bundles/SensioFrameworkExtraBundle/index.html
13491349
.. _`HWIOAuthBundle`: https://github.com/hwi/HWIOAuthBundle
13501350
.. _`Symfony ACL bundle`: https://github.com/symfony/acl-bundle
1351-
.. _`Symfony Security screencast series`: https://knpuniversity.com/screencast/symfony-security
1351+
.. _`Symfony Security screencast series`: https://knpuniversity.com/screencast/symfony4-security

security/custom_password_authenticator.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ the user::
6363
if ('' === ($givenPassword = $token->getCredentials())) {
6464
throw new BadCredentialsException('The given password cannot be empty.');
6565
}
66-
if (!$this->encoderFactory->getEncoder($user)->isPasswordValid($user->getPassword(), $givenPassword, $user->getSalt())) {
66+
if (!$this->encoder->isPasswordValid($user->getPassword(), $givenPassword, $user->getSalt())) {
6767
throw new BadCredentialsException('The given password is invalid.');
6868
}
6969
}

security/form_login_setup.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,15 +91,14 @@ configuration (``login``):
9191
// src/Controller/SecurityController.php
9292
9393
// ...
94-
use Symfony\Component\HttpFoundation\Request;
9594
use Symfony\Component\Routing\Annotation\Route;
9695
9796
class SecurityController extends Controller
9897
{
9998
/**
10099
* @Route("/login", name="login")
101100
*/
102-
public function login(Request $request)
101+
public function login()
103102
{
104103
}
105104
}
@@ -144,7 +143,7 @@ Great! Next, add the logic to ``login()`` that displays the login form::
144143
// src/Controller/SecurityController.php
145144
use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
146145

147-
public function login(Request $request, AuthenticationUtils $authenticationUtils)
146+
public function login(AuthenticationUtils $authenticationUtils)
148147
{
149148
// get the login error if there is one
150149
$error = $authenticationUtils->getLastAuthenticationError();

service_container/definitions.rst

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,6 @@ There are some helpful methods for working with the service definitions::
3838
// shortcut for the previous method
3939
$container->register('app.number_generator', \App\NumberGenerator::class);
4040

41-
// or create a service whose id matches its class
42-
$container->register(\App\NumberGenerator::class);
43-
4441
Working with a Definition
4542
-------------------------
4643

workflow/usage.rst

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ like this:
4040
workflows:
4141
blog_publishing:
4242
type: 'workflow' # or 'state_machine'
43+
audit_trail: 'enabled'
4344
marking_store:
4445
type: 'multiple_state' # or 'single_state'
4546
arguments:
@@ -75,7 +76,7 @@ like this:
7576
>
7677
7778
<framework:config>
78-
<framework:workflow name="blog_publishing" type="workflow">
79+
<framework:workflow name="blog_publishing" type="workflow" audit_trail="enabled">
7980
<framework:marking-store type="single_state">
8081
<framework:argument>currentPlace</framework:argument>
8182
</framework:marking-store>
@@ -119,6 +120,7 @@ like this:
119120
'workflows' => array(
120121
'blog_publishing' => array(
121122
'type' => 'workflow', // or 'state_machine'
123+
'audit_trail' => 'enabled',
122124
'marking_store' => array(
123125
'type' => 'multiple_state', // or 'single_state'
124126
'arguments' => array('currentPlace')
@@ -170,6 +172,11 @@ like this:
170172
value ``marking``) attributes of the ``marking_store`` option are optional.
171173
If omitted, their default values will be used.
172174

175+
.. tip::
176+
177+
Setting the ``audit_trail`` option to ``enabled`` makes the application
178+
generate detailed log messages for the workflow activity.
179+
173180
Using a Workflow
174181
----------------
175182

0 commit comments

Comments
 (0)
0