-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Listener "SoftDeleteableListener" was not added to the EventManager! #380
Comments
Try to clear the cache rm -rf app/cache/* |
thanks for your reply, i have cleared the cache, but it still could not load the softdeleteable listener, I tried to remove
and debug it again, I found that the $listeners changed without sluggable, only have 3 items Gedmo\Sortable\SortableListener that means it generated all the events from doctrine_extensions.yml, but why it not load the softdeleteable listener? Did I make any mistake in define the listener? thanks... |
hard to believe it really :) you use latest extension version I guess? anyway symfony would through an exception maybe if class would not be found in DIC. @comfortablynumb any idea? |
Well, I can't think of anything besides what has been said already. Did you try to add the event subscriber manually and see what happens? /**
* @Route("/del", name="del_article")
*/
public function delAction() {
$em = $this->getDoctrine()->getEntityManager();
$em->addEventSubscriber(new \Gedmo\SoftDeleteable\SoftDeleteableListener());
$article = $em->find('Article', 3);
$em->remove($article);
$em->flush();
} If this works, you have a configuration problem. BTW, did you try to use the extensions with this bundle? |
Thanks all you guys help, I very appreciated it... I finally fixed this problem. Sorry about my carelessness.... @comfortablynumb , I tried to add:
and it works, that mean it's my configuration problem, then I checked it, I found that I have predefined the listener before at the bottom of my config.yml file
because of this, it overwrites my previous configuration and did not configure properly, now it describes why I added softdeleteable listener to doctrine_extension.yml, which makes no sense, as it has been overwritten by a new one which did not configure properly...
|
For the record you have to enable the extension:
|
Just for information, I had this problem with symfony 4.
on the latest code, adding the calls options
throw an error "not valid yaml" |
Works for me, thanks! |
@etshy @annotation_reader must be inside single/double quote, like so:
|
thank you for this idea @comfortablynumb, im now slightly closer to realizing I have a config issue and am still rather numb. |
php 8.0 return types compatible
Hi, everyone
I followed the instruction
https://github.com/l3pp4rd/DoctrineExtensions/blob/master/doc/softdeleteable.md to test softdeteable extension under
Symfony 2.1.0-DEV, I configured my config.yml like below:
and my controller file:
when I run the code, it always show the exception: Listener "SoftDeleteableListener" was not added to the EventManager!
And I use netbeans xdebug the code, I found that the class "SoftDeleteableFilter" function "getListener()",
the $listeners has no instanceof SoftDeleteableListener, but it has other listeners, such as
Gedmo\Tree\TreeListener
Gedmo\Sortable\SortableListener
Gedmo\Sluggable\SluggableListener
Gedmo\Loggable\LoggableListener
Gedmo\Timestampable\TimestampableListener
Gedmo\Translatable\TranslatableListener
which all generated from loadClassMetadata, I think it might generate from my doctrine_extensions.yml service listener:
services:
extension.listener:
class: Infinitz\UserBundle\Listener\DoctrineExtensionListener
calls:
- [ setContainer, [ @service_container ] ]
tags:
- { name: kernel.event_listener, event: kernel.request, method: onLateKernelRequest, priority: -10 }
- { name: kernel.event_listener, event: kernel.request, method: onKernelRequest }
And I tried to add:
it still showing "Listener "SoftDeleteableListener" was not added to the EventManager! "....
Do I need to add an listener which instance of SoftDeleteableListener ?
Any help will be very appreciated...Thanks.
The text was updated successfully, but these errors were encountered: