diff --git a/book/security.rst b/book/security.rst index 2e68e0c6c57..ffbd58bb316 100644 --- a/book/security.rst +++ b/book/security.rst @@ -450,16 +450,21 @@ Next, create the controller that will display the login form:: $error = $request->attributes->get( SecurityContextInterface::AUTHENTICATION_ERROR ); - } else { + } elseif (null !== $session && $session->has(SecurityContextInterface::AUTHENTICATION_ERROR)) { $error = $session->get(SecurityContextInterface::AUTHENTICATION_ERROR); $session->remove(SecurityContextInterface::AUTHENTICATION_ERROR); + } else { + $error = ''; } + + // last username entered by the user + $lastUsername = (null === $session) ? '' : $session->get(SecurityContextInterface::LAST_USERNAME); return $this->render( 'AcmeSecurityBundle:Security:login.html.twig', array( // last username entered by the user - 'last_username' => $session->get(SecurityContextInterface::LAST_USERNAME), + 'last_username' => $lastUsername, 'error' => $error, ) ); @@ -1252,7 +1257,7 @@ this by creating a ``User`` class and configuring the ``entity`` provider. .. tip:: A high-quality open source bundle is available that allows your users - to be stored via the Doctrine ORM or ODM. Read more about the `FOSUserBundle`_ + to be stored in a database. Read more about the `FOSUserBundle`_ on GitHub. With this approach, you'll first create your own ``User`` class, which will diff --git a/book/testing.rst b/book/testing.rst index 0e53f1dfb2f..d5dcd0c504d 100644 --- a/book/testing.rst +++ b/book/testing.rst @@ -501,6 +501,11 @@ force him with the ``followRedirects()`` method:: $client->followRedirects(); +If you pass ``false`` to the ``followRedirects()`` method, the redirects +will no longer be followed:: + + $client->followRedirects(false); + .. index:: single: Tests; Crawler diff --git a/components/http_foundation/session_configuration.rst b/components/http_foundation/session_configuration.rst index ca1332cfaa1..bcd992128eb 100644 --- a/components/http_foundation/session_configuration.rst +++ b/components/http_foundation/session_configuration.rst @@ -83,7 +83,8 @@ Example usage:: use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage; use Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler; - $storage = new NativeSessionStorage(array(), new PdoSessionHandler()); + $pdo = new \PDO('mysql:dbname=testdb;host=127.0.0.1'); + $storage = new NativeSessionStorage(array(), new PdoSessionHandler($pdo)); $session = new Session($storage); Configuring PHP Sessions diff --git a/cookbook/assetic/uglifyjs.rst b/cookbook/assetic/uglifyjs.rst index 19413842ca9..1c0d4d11a58 100644 --- a/cookbook/assetic/uglifyjs.rst +++ b/cookbook/assetic/uglifyjs.rst @@ -232,15 +232,16 @@ helper: .. code-block:: html+jinja - {% stylesheets '@AcmeFooBundle/Resources/public/css/*' filter='uglifycss' %} + {% stylesheets 'bundles/AcmeFoo/css/*' filter='uglifycss' filter='cssrewrite' %} {% endstylesheets %} .. code-block:: html+php stylesheets( - array('@AcmeFooBundle/Resources/public/css/*'), - array('uglifycss') + array('bundles/AcmeFoo/css/*'), + array('uglifycss'), + array('cssrewrite') ) as $url): ?> diff --git a/cookbook/security/voters_data_permission.rst b/cookbook/security/voters_data_permission.rst index 7e2db803b36..f6f52904f7a 100644 --- a/cookbook/security/voters_data_permission.rst +++ b/cookbook/security/voters_data_permission.rst @@ -204,20 +204,16 @@ from the security context is called. class PostController extends Controller { - public function showAction() + public function showAction($id) { // get a Post instance $post = ...; - + // keep in mind, this will call all registered security voters if (false === $this->get('security.context')->isGranted('view', $post)) { throw new AccessDeniedException('Unauthorised access!'); } - $product = $this->getDoctrine() - ->getRepository('AcmeStoreBundle:Post') - ->find($id); - return new Response('

'.$post->getName().'

'); } } diff --git a/cookbook/service_container/scopes.rst b/cookbook/service_container/scopes.rst index 657ac81284f..cf338caff60 100644 --- a/cookbook/service_container/scopes.rst +++ b/cookbook/service_container/scopes.rst @@ -281,10 +281,10 @@ argument is the ``ClientConfiguration`` object: - + class="Acme\HelloBundle\Mail\Mailer" + scope="client"> + + .. code-block:: php