@@ -30,10 +30,10 @@ the location where the RSS feed should be shown. The easiest way is to extend
3030free to do create your own document. At least, you have to implement
3131``Sonata\BlockBundle\Model\BlockInterface ``. In your document, you
3232need to define the ``getType `` method which returns the type name of your block,
33- for instance ``acme_main.block.rss ``::
33+ for instance ``rss_block ``::
3434
35- // src/Acme/MainBundle /Document/RssBlock.php
36- namespace Acme\MainBundle \Document;
35+ // src/AppBundle /Document/RssBlock.php
36+ namespace AppBundle \Document;
3737
3838 use Doctrine\ODM\PHPCR\Mapping\Annotations as PHPCR;
3939
@@ -56,7 +56,7 @@ for instance ``acme_main.block.rss``::
5656
5757 public function getType()
5858 {
59- return 'acme_main.block.rss ';
59+ return 'app.rss_block ';
6060 }
6161
6262 public function getOptions()
@@ -97,8 +97,8 @@ services provided by the CmfBlockBundle are in the namespace
9797For your RSS block, you need a custom service
9898that knows how to fetch the feed data of an ``RssBlock ``::
9999
100- // src/Acme/MainBundle /Block/RssBlockService.php
101- namespace Acme\MainBundle \Block;
100+ // src/AppBundle /Block/RssBlockService.php
101+ namespace AppBundle \Block;
102102
103103 use Symfony\Component\HttpFoundation\Response;
104104 use Symfony\Component\OptionsResolver\OptionsResolverInterface;
@@ -125,7 +125,8 @@ that knows how to fetch the feed data of an ``RssBlock``::
125125 $resolver->setDefaults(array(
126126 'url' => false,
127127 'title' => 'Feed items',
128- 'template' => 'AcmeMainBundle:Block:rss.html.twig',
128+ // template is at app/Resources/views/block/rss.html.twig
129+ 'template' => 'block/rss.html.twig',
129130 ));
130131 }
131132
@@ -308,33 +309,37 @@ handles, as per the ``getType`` method of the block. The second argument is the
308309
309310 .. code-block :: yaml
310311
311- sandbox_main.block.rss :
312- class : Acme\MainBundle\Block\RssBlockService
313- arguments :
314- - " acme_main.block.rss"
315- - " @templating"
316- tags :
317- - {name: "sonata.block"}
312+ # app/config/services.yml
313+ services :
314+ app.rss_block :
315+ class : AppBundle\Block\RssBlockService
316+ arguments :
317+ - " app.rss_block"
318+ - " @templating"
319+ tags :
320+ - { name: "sonata.block" }
318321
319322 .. code-block :: xml
320323
321- <service id =" sandbox_main.block.rss" class =" Acme\MainBundle\Block\RssBlockService" >
324+ <!-- app/config/services.xml -->
325+ <service id =" app.rss_block" class =" AppBundle\Block\RssBlockService" >
322326 <tag name =" sonata.block" />
323327
324- <argument >acme_main.block.rss </argument >
328+ <argument >app.rss_block </argument >
325329 <argument type =" service" id =" templating" />
326330 </service >
327331
328332 .. code-block :: php
329333
334+ // app/config/services.php
330335 use Symfony\Component\DependencyInjection\Definition;
331336 use Symfony\Component\DependencyInjection\Reference;
332337
333338 $container
334- ->addDefinition('sandbox_main.block.rss ', new Definition(
335- 'Acme\MainBundle \Block\RssBlockService',
339+ ->addDefinition('app.rss_block ', new Definition(
340+ 'AppBundle \Block\RssBlockService',
336341 array(
337- 'acme_main.block.rss ',
342+ 'app.rss_block ',
338343 new Reference('templating'),
339344 )
340345 ))
0 commit comments