@@ -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 ``block.rss ``::
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 'block.rss';
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,7 @@ 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' => 'AppBundle :Block:rss.html.twig',
129
129
));
130
130
}
131
131
@@ -308,33 +308,37 @@ handles, as per the ``getType`` method of the block. The second argument is the
308
308
309
309
.. code-block :: yaml
310
310
311
- sandbox_main.block.rss :
312
- class : Acme\MainBundle\Block\RssBlockService
311
+ # app/config/services.yml
312
+ block.rss :
313
+ class : AppBundle\Block\RssBlockService
313
314
arguments :
314
- - " acme_main. block.rss"
315
+ - " block.rss"
315
316
- " @templating"
316
317
tags :
317
318
- {name: "sonata.block"}
318
319
319
320
.. code-block :: xml
320
321
321
- <service id =" sandbox_main.block.rss" class =" Acme\MainBundle\Block\RssBlockService" >
322
+ <!-- app/config/services.xml -->
323
+ <service id =" sandbox_main.block.rss" class =" AppBundle\Block\RssBlockService" >
322
324
<tag name =" sonata.block" />
323
325
324
- <argument >acme_main. block.rss</argument >
326
+ <argument >block.rss</argument >
325
327
<argument type =" service" id =" templating" />
326
328
</service >
327
329
328
330
.. code-block :: php
329
331
332
+ // app/config/services.php
333
+
330
334
use Symfony\Component\DependencyInjection\Definition;
331
335
use Symfony\Component\DependencyInjection\Reference;
332
336
333
337
$container
334
338
->addDefinition('sandbox_main.block.rss', new Definition(
335
- 'Acme\MainBundle \Block\RssBlockService',
339
+ 'AppBundle \Block\RssBlockService',
336
340
array(
337
- 'acme_main. block.rss',
341
+ 'block.rss',
338
342
new Reference('templating'),
339
343
)
340
344
))
0 commit comments