Skip to content

Commit b0e07b4

Browse files
committed
Merge branch '2.3' into 2.4
2 parents c75b1a7 + e15afe0 commit b0e07b4

File tree

4 files changed

+17
-17
lines changed

4 files changed

+17
-17
lines changed

.travis.yml

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ python:
44
- "2.7"
55

66
install:
7-
- "git submodule update --init"
87
- "bash install.sh"
98
- "pip install -q -r requirements.txt --use-mirrors"
109

book/installation.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ If there are any issues, correct them now before moving on.
233233
$ rm -rf app/cache/*
234234
$ rm -rf app/logs/*
235235
236-
$ APACHEUSER=`ps aux | grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data' | grep -v root | head -1 | cut -d\ -f1`
236+
$ APACHEUSER=`ps aux | grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data|[n]ginx' | grep -v root | head -1 | cut -d\ -f1`
237237
$ sudo chmod +a "$APACHEUSER allow delete,write,append,file_inherit,directory_inherit" app/cache app/logs
238238
$ sudo chmod +a "`whoami` allow delete,write,append,file_inherit,directory_inherit" app/cache app/logs
239239
@@ -248,7 +248,7 @@ If there are any issues, correct them now before moving on.
248248

249249
.. code-block:: bash
250250
251-
$ APACHEUSER=`ps aux | grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data' | grep -v root | head -1 | cut -d\ -f1`
251+
$ APACHEUSER=`ps aux | grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data|[n]ginx' | grep -v root | head -1 | cut -d\ -f1`
252252
$ sudo setfacl -Rn -m u:"$APACHEUSER":rwX -m u:`whoami`:rwX app/cache app/logs
253253
$ sudo setfacl -dRn -m u:"$APACHEUSER":rwX -m u:`whoami`:rwX app/cache app/logs
254254

cookbook/form/dynamic_form_modification.rst

+10-10
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ creating that particular field is delegated to an event listener::
9999
{
100100
$builder->add('price');
101101

102-
$builder->addEventListener(FormEvents::PRE_SET_DATA, function(FormEvent $event) {
102+
$builder->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) {
103103
// ... adding the name field if needed
104104
});
105105
}
@@ -116,7 +116,7 @@ the event listener might look like the following::
116116
public function buildForm(FormBuilderInterface $builder, array $options)
117117
{
118118
// ...
119-
$builder->addEventListener(FormEvents::PRE_SET_DATA, function(FormEvent $event) {
119+
$builder->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) {
120120
$product = $event->getData();
121121
$form = $event->getForm();
122122

@@ -254,7 +254,7 @@ Using an event listener, your form might look like this::
254254
->add('subject', 'text')
255255
->add('body', 'textarea')
256256
;
257-
$builder->addEventListener(FormEvents::PRE_SET_DATA, function(FormEvent $event) {
257+
$builder->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) {
258258
// ... add a choice list of friends of the current application user
259259
});
260260
}
@@ -330,13 +330,13 @@ and fill in the listener logic::
330330

331331
$builder->addEventListener(
332332
FormEvents::PRE_SET_DATA,
333-
function(FormEvent $event) use ($user) {
333+
function (FormEvent $event) use ($user) {
334334
$form = $event->getForm();
335335

336336
$formOptions = array(
337337
'class' => 'Acme\DemoBundle\Entity\User',
338338
'property' => 'fullName',
339-
'query_builder' => function(EntityRepository $er) use ($user) {
339+
'query_builder' => function (EntityRepository $er) use ($user) {
340340
// build a custom query
341341
// return $er->createQueryBuilder('u')->addOrderBy('fullName', 'DESC');
342342

@@ -496,7 +496,7 @@ sport like this::
496496

497497
$builder->addEventListener(
498498
FormEvents::PRE_SET_DATA,
499-
function(FormEvent $event) {
499+
function (FormEvent $event) {
500500
$form = $event->getForm();
501501

502502
// this would be your entity, i.e. SportMeetup
@@ -565,7 +565,7 @@ The type would now look like::
565565
));
566566
;
567567

568-
$formModifier = function(FormInterface $form, Sport $sport = null) {
568+
$formModifier = function (FormInterface $form, Sport $sport = null) {
569569
$positions = null === $sport ? array() : $sport->getAvailablePositions();
570570

571571
$form->add('position', 'entity', array(
@@ -577,7 +577,7 @@ The type would now look like::
577577

578578
$builder->addEventListener(
579579
FormEvents::PRE_SET_DATA,
580-
function(FormEvent $event) use ($formModifier) {
580+
function (FormEvent $event) use ($formModifier) {
581581
// this would be your entity, i.e. SportMeetup
582582
$data = $event->getData();
583583

@@ -587,7 +587,7 @@ The type would now look like::
587587

588588
$builder->get('sport')->addEventListener(
589589
FormEvents::POST_SUBMIT,
590-
function(FormEvent $event) use ($formModifier) {
590+
function (FormEvent $event) use ($formModifier) {
591591
// It's important here to fetch $event->getForm()->getData(), as
592592
// $event->getData() will get you the client data (that is, the ID)
593593
$sport = $event->getForm()->getData();
@@ -739,7 +739,7 @@ all of this, use a listener::
739739

740740
public function buildForm(FormBuilderInterface $builder, array $options)
741741
{
742-
$builder->addEventListener(FormEvents::POST_SUBMIT, function($event) {
742+
$builder->addEventListener(FormEvents::POST_SUBMIT, function ($event) {
743743
$event->stopPropagation();
744744
}, 900); // Always set a higher priority than ValidationListener
745745

cookbook/security/voters_data_permission.rst

+5-4
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ edit a particular object. Here's an example implementation::
6464
use Symfony\Component\Security\Core\Authorization\Voter\VoterInterface;
6565
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
6666
use Symfony\Component\Security\Core\User\UserInterface;
67-
use Acme\DemoBundle\Entity\Post;
6867

6968
class PostVoter implements VoterInterface
7069
{
@@ -79,9 +78,11 @@ edit a particular object. Here's an example implementation::
7978
));
8079
}
8180

82-
public function supportsClass($obj)
81+
public function supportsClass($class)
8382
{
84-
return $obj instanceof Post;
83+
$supportedClass = 'Acme\DemoBundle\Entity\Post';
84+
85+
return $supportedClass === $class || is_subclass_of($class, $supportedClass);
8586
}
8687

8788
/**
@@ -90,7 +91,7 @@ edit a particular object. Here's an example implementation::
9091
public function vote(TokenInterface $token, $post, array $attributes)
9192
{
9293
// check if class of this object is supported by this voter
93-
if (!$this->supportsClass($post)) {
94+
if (!$this->supportsClass(get_class($post))) {
9495
return VoterInterface::ACCESS_ABSTAIN;
9596
}
9697

0 commit comments

Comments
 (0)