Override entity
Replies: 3   Views: 932  Subscribers: 5

Posted by cmolin · 10-03-2014 - 10:02

Hello, I want to override an entity for example Forum but I have this error and I don't understand. 

Catchable Fatal Error: Argument 1 passed to CCDNForum\ForumBundle\Component\Security\Authorizer::canShowForum() must be an instance of CCDNForum\ForumBundle\Entity\Forum, instance of PA\TribuneLibreBundle\Entity\Forum given, called in /var/www/planete-asm/vendor/codeconsortium/ccdn-forum-bundle/CCDNForum/ForumBundle/Controller/UserCategoryController.php on line 45 and defined in /var/www/planete-asm/vendor/codeconsortium/ccdn-forum-bundle/CCDNForum/ForumBundle/Component/Security/Authorizer.php line 65­
Thank you for your help.­

Posted by reece · 13-03-2014 - 14:20

Make sure your entity extends the original Forum entity, and they you just override what you need.

Im pretty sure PHP allows this, but if it does not, then maybe we need to implement some interfaces for our entities.­

Posted by Kir · 18-03-2014 - 15:22

Hello,  I'm trying to extend CCDNForumBundle\Entity\Board in my own bundle. Could you give a hint how correct to do it?­

Posted by [email protected] · 06-08-2014 - 13:38

I'm trying to extend this bundle for more then week now. This is really PITA. I think this Bundle is not supposed to be extended. If you want to change some more than simple configuration or template, you are pretty much screwed :/
If you don't want to code forum from scratch and use this bundle probably the best solution is to download code and put whole bundle in src folder, and then modify it, instead of trying to extend this bundle. This is not nice or elegant solution, but probably the simplest one.

@reece PHP allows, but we have here something more than only PHP e.g. Symfony2, Doctrine2, this specific bundle.­