The problem:
Any time I try to access the application I get this error:
ContextErrorException: Catchable Fatal Error: Argument 1 passed to
PL\OrderBundle\Entity\OrderHasComment::__construct() must implement
interface Symfony\Component\Security\Core\SecurityContextInterface,
none given, called in
/var/www/html/apps/portal_de_logistica/vendor/sonata-project/doctrine-orm-admin-bundle/Model/ModelManager.php
on line 416 and defined in
/var/www/html/apps/portal_de_logistica/src/PL/OrderBundle/Entity/OrderHasComment.php
line 48
What I'm doing wrong?
Best Answer
PL\OrderBundle\Entity\OrderHasComment
's constructor asks for a mandatory argument but don't you provide it when you create a new instance of the object.You're creating a new OrderHasComment (whatever that is) like this:
Remove that - it won't be needed anymore once your listener calls something like
setContext(...)
and it's not needed to create the object ... so it shouldn't be mandatory anyways.... should become:
This solves the issue that's responsible for the exception.