Skip to content

Commit b1e0886

Browse files
committed
Merge branch '2.4'
2 parents 33d27cc + 780cd22 commit b1e0886

File tree

18 files changed

+158
-54
lines changed

18 files changed

+158
-54
lines changed

book/forms.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1006,7 +1006,8 @@ that will house the logic for building the task form::
10061006
{
10071007
public function buildForm(FormBuilderInterface $builder, array $options)
10081008
{
1009-
$builder->add('task')
1009+
$builder
1010+
->add('task')
10101011
->add('dueDate', null, array('widget' => 'single_text'))
10111012
->add('save', 'submit');
10121013
}

book/page_creation.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ an entry when you generated the ``AcmeHelloBundle``:
165165
$collection = new RouteCollection();
166166
$collection->addCollection(
167167
$loader->import('@AcmeHelloBundle/Resources/config/routing.php'),
168-
'/',
168+
'/'
169169
);
170170
171171
return $collection;

book/routing.rst

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -558,13 +558,15 @@ is *not* a number).
558558
As a result, a URL like ``/blog/my-blog-post`` will now properly match the
559559
``blog_show`` route.
560560

561-
+--------------------+-----------+-----------------------+
562-
| URL | route | parameters |
563-
+====================+===========+=======================+
564-
| /blog/2 | blog | {page} = 2 |
565-
+--------------------+-----------+-----------------------+
566-
| /blog/my-blog-post | blog_show | {slug} = my-blog-post |
567-
+--------------------+-----------+-----------------------+
561+
+----------------------+-----------+-------------------------+
562+
| URL | route | parameters |
563+
+======================+===========+=========================+
564+
| /blog/2 | blog | {page} = 2 |
565+
+----------------------+-----------+-------------------------+
566+
| /blog/my-blog-post | blog_show | {slug} = my-blog-post |
567+
+----------------------+-----------+-------------------------+
568+
| /blog/2-my-blog-post | blog_show | {slug} = 2-my-blog-post |
569+
+----------------------+-----------+-------------------------+
568570

569571
.. sidebar:: Earlier Routes always Win
570572

@@ -1131,7 +1133,7 @@ instead of simply ``/hello/{name}``:
11311133
$acmeHello = $loader->import(
11321134
"@AcmeHelloBundle/Resources/config/routing.php"
11331135
);
1134-
$acmeHello->setPrefix('/admin');
1136+
$acmeHello->addPrefix('/admin');
11351137
11361138
$collection->addCollection($acmeHello);
11371139

book/security.rst

Lines changed: 67 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1062,6 +1062,73 @@ the user will be redirected to ``https``:
10621062
),
10631063
),
10641064
1065+
.. _book-security-securing-controller:
1066+
1067+
Securing a Controller
1068+
~~~~~~~~~~~~~~~~~~~~~
1069+
1070+
Protecting your application based on URL patterns is easy, but may not be
1071+
fine-grained enough in certain cases. When necessary, you can easily force
1072+
authorization from inside a controller::
1073+
1074+
// ...
1075+
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
1076+
1077+
public function helloAction($name)
1078+
{
1079+
if (false === $this->get('security.context')->isGranted('ROLE_ADMIN')) {
1080+
throw new AccessDeniedException();
1081+
}
1082+
1083+
// ...
1084+
}
1085+
1086+
.. _book-security-securing-controller-annotations:
1087+
1088+
Thanks to the SensioFrameworkExtraBundle, you can also secure your controller using annotations::
1089+
1090+
// ...
1091+
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
1092+
1093+
/**
1094+
* @Security("has_role('ROLE_ADMIN')")
1095+
*/
1096+
public function helloAction($name)
1097+
{
1098+
// ...
1099+
}
1100+
1101+
For more information, see the
1102+
:doc:`FrameworkExtraBundle documentation </bundles/SensioFrameworkExtraBundle/annotations/security>`.
1103+
1104+
Securing other Services
1105+
~~~~~~~~~~~~~~~~~~~~~~~
1106+
1107+
In fact, anything in Symfony can be protected using a strategy similar to
1108+
the one seen in the previous section. For example, suppose you have a service
1109+
(i.e. a PHP class) whose job is to send emails from one user to another.
1110+
You can restrict use of this class - no matter where it's being used from -
1111+
to users that have a specific role.
1112+
1113+
For more information on how you can use the Security component to secure
1114+
different services and methods in your application, see :doc:`/cookbook/security/securing_services`.
1115+
1116+
Access Control Lists (ACLs): Securing Individual Database Objects
1117+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1118+
1119+
Imagine you are designing a blog system where your users can comment on your
1120+
posts. Now, you want a user to be able to edit their own comments, but not
1121+
those of other users. Also, as the admin user, you yourself want to be able
1122+
to edit *all* comments.
1123+
1124+
The Security component comes with an optional access control list (ACL) system
1125+
that you can use when you need to control access to individual instances
1126+
of an object in your system. *Without* ACL, you can secure your system so that
1127+
only certain users can edit blog comments in general. But *with* ACL, you
1128+
can restrict or allow access on a comment-by-comment basis.
1129+
1130+
For more information, see the cookbook article: :doc:`/cookbook/security/acl`.
1131+
10651132
Users
10661133
-----
10671134

@@ -2091,7 +2158,6 @@ Learn more from the Cookbook
20912158
* :doc:`Access Control Lists (ACLs) </cookbook/security/acl>`
20922159
* :doc:`/cookbook/security/remember_me`
20932160

2094-
.. _`JMSSecurityExtraBundle`: http://jmsyst.com/bundles/JMSSecurityExtraBundle/1.2
20952161
.. _`FOSUserBundle`: https://github.com/FriendsOfSymfony/FOSUserBundle
20962162
.. _`implement the \Serializable interface`: http://php.net/manual/en/class.serializable.php
20972163
.. _`functions-online.com`: http://www.functions-online.com/sha1.html

book/validation.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1148,7 +1148,7 @@ section .
11481148
The ``validateValue`` method returns a :class:`Symfony\\Component\\Validator\\ConstraintViolationList`
11491149
object, which acts just like an array of errors. Each error in the collection
11501150
is a :class:`Symfony\\Component\\Validator\\ConstraintViolation` object,
1151-
which holds the error message on its `getMessage` method.
1151+
which holds the error message on its ``getMessage`` method.
11521152

11531153
Final Thoughts
11541154
--------------

components/console/introduction.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ You can also set these colors and options inside the tagname::
160160
// bold text on a yellow background
161161
$output->writeln('<bg=yellow;options=bold>foo</bg=yellow;options=bold>');
162162

163-
.. verbosity-levels:
163+
.. _verbosity-levels:
164164

165165
Verbosity Levels
166166
~~~~~~~~~~~~~~~~

components/dependency_injection/factories.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ factory itself as a service:
125125
126126
$container->setDefinition('newsletter_factory', new Definition(
127127
'%newsletter_factory.class%'
128-
))
128+
));
129129
$container->setDefinition('newsletter_manager', new Definition(
130130
'%newsletter_manager.class%'
131131
))->setFactoryService(
@@ -193,7 +193,7 @@ in the previous example takes the ``templating`` service as an argument:
193193
194194
$container->setDefinition('newsletter_factory', new Definition(
195195
'%newsletter_factory.class%'
196-
))
196+
));
197197
$container->setDefinition('newsletter_manager', new Definition(
198198
'%newsletter_manager.class%',
199199
array(new Reference('templating'))

components/form/introduction.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,12 @@ object to read data off of the correct PHP superglobals (i.e. ``$_POST`` or
8484
:class:`Symfony\\Component\\Form\\Extension\\HttpFoundation\\HttpFoundationExtension`
8585
to your form factory::
8686

87-
use Symfony\Component\Form\Forms;
88-
use Symfony\Component\Form\Extension\HttpFoundation\HttpFoundationExtension;
87+
use Symfony\Component\Form\Forms;
88+
use Symfony\Component\Form\Extension\HttpFoundation\HttpFoundationExtension;
8989

90-
$formFactory = Forms::createFormFactoryBuilder()
91-
->addExtension(new HttpFoundationExtension())
92-
->getFormFactory();
90+
$formFactory = Forms::createFormFactoryBuilder()
91+
->addExtension(new HttpFoundationExtension())
92+
->getFormFactory();
9393

9494
Now, when you process a form, you can pass the :class:`Symfony\\Component\\HttpFoundation\\Request`
9595
object to :method:`Symfony\\Component\\Form\\Form::handleRequest`::

components/process.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ and :method:`Symfony\\Component\\Process\\Process::getIncrementalErrorOutput`
4343
methods returns the new outputs since the last call.
4444

4545
.. versionadded:: 2.4
46-
The ``flushOutput()`` and ``flushErrorOutput()`` methods were added in Symfony 2.4.
46+
The ``clearOutput()`` and ``clearErrorOutput()`` methods were added in Symfony 2.4.
4747

48-
The :method:`Symfony\\Component\\Process\\Process::flushOutput` method flushes
48+
The :method:`Symfony\\Component\\Process\\Process::clearOutput` method clears
4949
the contents of the output and
50-
:method:`Symfony\\Component\\Process\\Process::flushErrorOutput` flushes
50+
:method:`Symfony\\Component\\Process\\Process::clearErrorOutput` clears
5151
the contents of the error output.
5252

5353
Getting real-time Process Output

cookbook/bundles/remove.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ starting a project, but you'll probably want to eventually remove it.
1717
---------------------------------------------
1818

1919
To disconnect the bundle from the framework, you should remove the bundle from
20-
the ``Appkernel::registerBundles()`` method. The bundle is normally found in
20+
the ``AppKernel::registerBundles()`` method. The bundle is normally found in
2121
the ``$bundles`` array but the AcmeDemoBundle is only registered in a
2222
development environment and you can find him in the if statement after::
2323

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy