@@ -50,6 +50,7 @@ setting to your configuration. Example config:
5050
5151 .. code-block :: yaml
5252
53+ # app/config/config.yml
5354 cmf_menu :
5455 voters :
5556 content_identity :
@@ -58,6 +59,7 @@ setting to your configuration. Example config:
5859
5960 .. code-block :: xml
6061
62+ <!-- app/config/config.xml -->
6163 <?xml version =" 1.0" encoding =" UTF-8" ?>
6264 <container xmlns =" http://symfony.com/schema/dic/services" >
6365 <config xmlns =" http://cmf.symfony.com/schema/dic/menu" >
@@ -69,14 +71,15 @@ setting to your configuration. Example config:
6971
7072 .. code-block :: php
7173
72- $container->loadFromExtension('cmf_menu', array(
73- 'voters' => array(
74- 'content_identity' => array(
74+ // app/config/config.php
75+ $container->loadFromExtension('cmf_menu', [
76+ 'voters' => [
77+ 'content_identity' => [
7578 'enabled' => true,
7679 'content_key' => 'myKey',
77- ) ,
78- ) ,
79- ) );
80+ ] ,
81+ ] ,
82+ ] );
8083
8184 .. note ::
8285
@@ -107,7 +110,7 @@ article which can be reached at ``/articles/computers/laptops/acme/A200``::
107110
108111 use Symfony\Cmf\Bundle\RoutingBundle\Doctrine\Phpcr\Route;
109112 use Symfony\Cmf\Bundle\MenuBundle\Doctrine\Phpcr\MenuItem;
110- use Acme\FooBundle \Document\Article;
113+ use AppBundle \Document\Article;
111114
112115 $dm = ...; // get an instance of the document manager
113116
@@ -162,11 +165,11 @@ configuration.
162165 .. code-block :: php
163166
164167 // app/config/config.php
165- $container->loadFromExtension('cmf_menu', array(
166- 'voters' => array(
168+ $container->loadFromExtension('cmf_menu', [
169+ 'voters' => [
167170 'uri_prefix' => true,
168- ) ,
169- ) );
171+ ] ,
172+ ] );
170173
171174 RequestParentContentIdentityVoter
172175~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -206,11 +209,11 @@ voters (see below), except you do not need to write your own PHP code:
206209
207210 # app/config/services.yml
208211 services :
209- my_bundle.menu_voter.parent :
212+ app.menu_voter_parent :
210213 class : Symfony\Cmf\Bundle\MenuBundle\Voter\RequestParentContentIdentityVoter
211214 arguments :
212215 - contentDocument
213- - ' %my_bundle.my_model_class% '
216+ - AppBundle\Document\Article
214217 tags :
215218 - { name: "knp_menu.voter", request: true }
216219
@@ -223,10 +226,10 @@ voters (see below), except you do not need to write your own PHP code:
223226 xsi : schemaLocation =" http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd" >
224227
225228 <services >
226- <service id =" my_bundle.menu_voter.parent "
229+ <service id =" app.menu_voter_parent "
227230 class =" Symfony\Cmf\Bundle\MenuBundle\Voter\RequestParentContentIdentityVoter" >
228231 <argument >contentDocument</argument >
229- <argument >%my_bundle.my_model_class% </argument >
232+ <argument >AppBundle\Document\Article </argument >
230233
231234 <tag name =" knp_menu.voter" request =" true" />
232235 </service >
@@ -236,22 +239,24 @@ voters (see below), except you do not need to write your own PHP code:
236239 .. code-block :: php
237240
238241 // app/config/services.php
242+ use AppBundle\Document\Article;
243+ use Symfony\Cmf\Bundle\MenuBundle\Voter\RequestParentContentIdentityVoter;
239244 use Symfony\Component\DependencyInjection\Definition;
240245
241246 $definition = new Definition(
242- 'Symfony\Cmf\Bundle\MenuBundle\Voter\ RequestParentContentIdentityVoter' ,
243- array( 'contentDocument', '%my_bundle.my_model_class%')
247+ RequestParentContentIdentityVoter,
248+ [ 'contentDocument', Article::class]
244249 ));
245- $definition->addMethodCall('setRequest', array(
250+ $definition->addMethodCall('setRequest', [
246251 new Reference(
247252 'request',
248253 ContainerInterface::NULL_ON_INVALID_REFERENCE,
249254 false
250255 )
251- ) );
252- $definition->addTag('knp_menu.voter', array( 'request' => true) );
256+ ] );
257+ $definition->addTag('knp_menu.voter', [ 'request' => true] );
253258
254- $container->setDefinition('my_bundle.menu_voter.parent ', $definition);
259+ $container->setDefinition('app.menu_voter_parent ', $definition);
255260
256261 .. _bundles_menu_voters_custom_voter :
257262
0 commit comments