@@ -30,10 +30,10 @@ the location where the RSS feed should be shown. The easiest way is to extend
30
30
free to do create your own document. At least, you have to implement
31
31
``Sonata\BlockBundle\Model\BlockInterface ``. In your document, you
32
32
need 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 ``::
34
34
35
- // src/Acme/MainBundle /Document/RssBlock.php
36
- namespace Acme\MainBundle \Document;
35
+ // src/AppBundle /Document/RssBlock.php
36
+ namespace AppBundle \Document;
37
37
38
38
use Doctrine\ODM\PHPCR\Mapping\Annotations as PHPCR;
39
39
@@ -56,7 +56,7 @@ for instance ``acme_main.block.rss``::
56
56
57
57
public function getType()
58
58
{
59
- return 'acme_main.block.rss ';
59
+ return 'app.rss_block ';
60
60
}
61
61
62
62
public function getOptions()
@@ -97,8 +97,8 @@ services provided by the CmfBlockBundle are in the namespace
97
97
For your RSS block, you need a custom service
98
98
that knows how to fetch the feed data of an ``RssBlock ``::
99
99
100
- // src/Acme/MainBundle /Block/RssBlockService.php
101
- namespace Acme\MainBundle \Block;
100
+ // src/AppBundle /Block/RssBlockService.php
101
+ namespace AppBundle \Block;
102
102
103
103
use Symfony\Component\HttpFoundation\Response;
104
104
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
@@ -125,7 +125,8 @@ that knows how to fetch the feed data of an ``RssBlock``::
125
125
$resolver->setDefaults(array(
126
126
'url' => false,
127
127
'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',
129
130
));
130
131
}
131
132
@@ -308,33 +309,37 @@ handles, as per the ``getType`` method of the block. The second argument is the
308
309
309
310
.. code-block :: yaml
310
311
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" }
318
321
319
322
.. code-block :: xml
320
323
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" >
322
326
<tag name =" sonata.block" />
323
327
324
- <argument >acme_main.block.rss </argument >
328
+ <argument >app.rss_block </argument >
325
329
<argument type =" service" id =" templating" />
326
330
</service >
327
331
328
332
.. code-block :: php
329
333
334
+ // app/config/services.php
330
335
use Symfony\Component\DependencyInjection\Definition;
331
336
use Symfony\Component\DependencyInjection\Reference;
332
337
333
338
$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',
336
341
array(
337
- 'acme_main.block.rss ',
342
+ 'app.rss_block ',
338
343
new Reference('templating'),
339
344
)
340
345
))
0 commit comments