Skip to content

Commit 9a533ce

Browse files
committed
Merge branch '2.4' into 2.5
2 parents 3e3004f + bc0fe91 commit 9a533ce

File tree

6 files changed

+25
-17
lines changed

6 files changed

+25
-17
lines changed

book/security.rst

+8-3
Original file line numberDiff line numberDiff line change
@@ -451,16 +451,21 @@ Next, create the controller that will display the login form::
451451
$error = $request->attributes->get(
452452
SecurityContextInterface::AUTHENTICATION_ERROR
453453
);
454-
} else {
454+
} elseif (null !== $session && $session->has(SecurityContextInterface::AUTHENTICATION_ERROR)) {
455455
$error = $session->get(SecurityContextInterface::AUTHENTICATION_ERROR);
456456
$session->remove(SecurityContextInterface::AUTHENTICATION_ERROR);
457+
} else {
458+
$error = '';
457459
}
460+
461+
// last username entered by the user
462+
$lastUsername = (null === $session) ? '' : $session->get(SecurityContextInterface::LAST_USERNAME);
458463

459464
return $this->render(
460465
'AcmeSecurityBundle:Security:login.html.twig',
461466
array(
462467
// last username entered by the user
463-
'last_username' => $session->get(SecurityContextInterface::LAST_USERNAME),
468+
'last_username' => $lastUsername,
464469
'error' => $error,
465470
)
466471
);
@@ -1259,7 +1264,7 @@ this by creating a ``User`` class and configuring the ``entity`` provider.
12591264
.. tip::
12601265

12611266
A high-quality open source bundle is available that allows your users
1262-
to be stored via the Doctrine ORM or ODM. Read more about the `FOSUserBundle`_
1267+
to be stored in a database. Read more about the `FOSUserBundle`_
12631268
on GitHub.
12641269

12651270
With this approach, you'll first create your own ``User`` class, which will

book/testing.rst

+5
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,11 @@ force him with the ``followRedirects()`` method::
501501

502502
$client->followRedirects();
503503

504+
If you pass ``false`` to the ``followRedirects()`` method, the redirects
505+
will no longer be followed::
506+
507+
$client->followRedirects(false);
508+
504509
.. index::
505510
single: Tests; Crawler
506511

components/http_foundation/session_configuration.rst

+2-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ Example usage::
8383
use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage;
8484
use Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler;
8585

86-
$storage = new NativeSessionStorage(array(), new PdoSessionHandler());
86+
$pdo = new \PDO('mysql:dbname=testdb;host=127.0.0.1');
87+
$storage = new NativeSessionStorage(array(), new PdoSessionHandler($pdo));
8788
$session = new Session($storage);
8889

8990
Configuring PHP Sessions

cookbook/assetic/uglifyjs.rst

+4-3
Original file line numberDiff line numberDiff line change
@@ -232,15 +232,16 @@ helper:
232232

233233
.. code-block:: html+jinja
234234

235-
{% stylesheets '@AcmeFooBundle/Resources/public/css/*' filter='uglifycss' %}
235+
{% stylesheets 'bundles/AcmeFoo/css/*' filter='uglifycss' filter='cssrewrite' %}
236236
<link rel="stylesheet" href="{{ asset_url }}" />
237237
{% endstylesheets %}
238238
239239
.. code-block:: html+php
240240

241241
<?php foreach ($view['assetic']->stylesheets(
242-
array('@AcmeFooBundle/Resources/public/css/*'),
243-
array('uglifycss')
242+
array('bundles/AcmeFoo/css/*'),
243+
array('uglifycss'),
244+
array('cssrewrite')
244245
) as $url): ?>
245246
<link rel="stylesheet" href="<?php echo $view->escape($url) ?>" />
246247
<?php endforeach; ?>

cookbook/security/voters_data_permission.rst

+2-6
Original file line numberDiff line numberDiff line change
@@ -206,20 +206,16 @@ from the security context is called.
206206
207207
class PostController extends Controller
208208
{
209-
public function showAction()
209+
public function showAction($id)
210210
{
211211
// get a Post instance
212212
$post = ...;
213-
213+
214214
// keep in mind, this will call all registered security voters
215215
if (false === $this->get('security.context')->isGranted('view', $post)) {
216216
throw new AccessDeniedException('Unauthorised access!');
217217
}
218218
219-
$product = $this->getDoctrine()
220-
->getRepository('AcmeStoreBundle:Post')
221-
->find($id);
222-
223219
return new Response('<h1>'.$post->getName().'</h1>');
224220
}
225221
}

cookbook/service_container/scopes.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -281,10 +281,10 @@ argument is the ``ClientConfiguration`` object:
281281
<!-- src/Acme/HelloBundle/Resources/config/services.xml -->
282282
<services>
283283
<service id="my_mailer"
284-
class="Acme\HelloBundle\Mail\Mailer"
285-
scope="client"
286-
/>
287-
<argument type="service" id="client_configuration" />
284+
class="Acme\HelloBundle\Mail\Mailer"
285+
scope="client">
286+
<argument type="service" id="client_configuration" />
287+
</service>
288288
</services>
289289
290290
.. code-block:: php

0 commit comments

Comments
 (0)