@@ -646,13 +646,12 @@ a closure as the default value of the ``spool`` option with a :class:`Symfony\\C
646
646
argument. Based on this instance, you can define the options under ``spool `` and its desired default
647
647
value::
648
648
649
- // ...
650
649
class Mailer
651
650
{
652
651
// ...
652
+
653
653
public function configureOptions(OptionsResolver $resolver)
654
654
{
655
- // ...
656
655
$resolver->setDefault('spool', function (OptionsResolver $spoolResolver) {
657
656
$spoolResolver->setDefaults(array(
658
657
'type' => 'file',
@@ -683,20 +682,18 @@ normalization and more.
683
682
If the default value of a child option depend on another option defined in parent level,
684
683
adds a second ``Options `` argument to the closure::
685
684
686
- // ...
687
685
class Mailer
688
686
{
689
687
// ...
688
+
690
689
public function configureOptions(OptionsResolver $resolver)
691
690
{
692
- // ...
693
691
$resolver->setDefault('sandbox', false);
694
692
$resolver->setDefault('spool', function (OptionsResolver $spoolResolver, Options $parent) {
695
693
$spoolResolver->setDefaults(array(
696
694
'type' => $parent['sandbox'] ? 'memory' : 'file',
697
695
// ...
698
696
));
699
- // ...
700
697
});
701
698
}
702
699
}
@@ -708,10 +705,10 @@ adds a second ``Options`` argument to the closure::
708
705
709
706
In same way, parent options can access the child option as follows::
710
707
711
- // ...
712
708
class Mailer
713
709
{
714
710
// ...
711
+
715
712
public function configureOptions(OptionsResolver $resolver)
716
713
{
717
714
// ...
@@ -720,7 +717,6 @@ In same way, parent options can access the child option as follows::
720
717
'type' => 'file',
721
718
// ...
722
719
));
723
- // ...
724
720
});
725
721
$resolver->setDefault('profiling', function (Options $options) {
726
722
return 'file' === $options['spool']['type'];
0 commit comments