symfony-cmf / block-bundle

Extends the SonataBlockBundle to integrate with PHPCR ODM
https://cmf.symfony.com
20 stars 51 forks source link

missing function #277

Open featureless opened 7 years ago

featureless commented 7 years ago

The 'exists' function is missing in the PhpcrBlockLoader class to use sonata_block_exists in twig template

dbu commented 7 years ago

then that function is not defined by the Sonata\BlockBundle\Block\BlockLoaderInterface interface? is there an additional interface to implement? or does sonata check with a method_exists? or just hope a method happens to be there even though the interface does not require it?

either way, if you want to do a pull request to do the necessary changes, i am happy to review and merge that.

featureless commented 7 years ago

When I use 'sonata_block_exists' in twig template I have this error:

request.CRITICAL: Uncaught PHP Exception Symfony\Component\Debug\Exception\UndefinedMethodException: "Attempted to call an undefined method named "exists" of class "Symfony\Cmf\Bundle\BlockBundle\Block\PhpcrBlockLoader"." at C:\projets\vendor\sonata-project\block-bundle\Block\BlockLoaderChain.php line 41 {"exception":"[object] (Symfony\Component\Debug\Exception\UndefinedMethodException(code: 0): Attempted to call an undefined method named \"exists\" of class \"Symfony\Cmf\Bundle\BlockBundle\Block\PhpcrBlockLoader\". at C:\projets\vendor\sonata-project\block-bundle\Block\BlockLoaderChain.php:41)"} []

dbu commented 7 years ago

seems like sonata_block_exists does not check the interfaces well, it should check if that method exists. as said, i am happy to review a pull request if you want to add the exists method and figure out how that method is supposed to be defined, if we should implement an interface.