sonata-project/SonataPageBundle — Issue #30: The block service `XXX` referenced in the block `YY` is not linked to a cache service.
Author: pluff
Created: 2012-01-12 22:35:29+00:00
State: open

Hello everyone,
I have created my custom block service called "application.page.block.html" that basically just adds some spicific classes to textarea field to enable WYSIWYG editor in admin. In admin part service works perfectly. But after I have created a block with my new block service frontend page gives me this exception:
An exception has been thrown during the rendering of a template ("The block service 'application.page.block.html' referenced in the block '21' is not linked to a cache service.") in SonataPageBundle:Block:block_container.html.twig at line 17.

Here is my full class:

namespace Application\Sonata\PageBundle\Block;
use Sonata\PageBundle\Block\TextBlockService;
use Sonata\AdminBundle\Form\FormMapper;
use Sonata\PageBundle\Model\BlockInterface;
use Sonata\PageBundle\CmsManager\CmsManagerInterface;

/**
* @author Pavel Shutin
*/
class HtmlBlockService extends TextBlockService
{
/**
* @inheritdoc
*/
public function buildEditForm(CmsManagerInterface $manager, FormMapper $formMapper, BlockInterface $block)
{
$formMapper->add('settings', 'sonata_type_immutable_array', array(
'keys' => array(
array('content', 'textarea', array('attr'=>array('class'=>'wysiwyg'))),
)
));
}

/**
* @return string
*/
public function getName()
{
return 'Html text';
}
}

As you can see this service extends basic Text service, and changes only 2 functions. Why does my service should be linked to a cache service? As I see cache manager is related to manager, but can I add it via configs/ block service class? Also I can't find where cache service registered for basic Text block service.

Thank you.