Symfony seems to register, but not trigger my doctrine event
up vote
1
down vote
favorite
sry if something is not so accurate, but im less experienced with Symfony
I have the following orm mapping:
src/app/ExampleBundle/Resources/config/doctrine/Base.orm.yml
appExampleBundleEntityBase:
type: mappedSuperclass
fields:
createdAt:
type: datetime
nullable: true
options:
default: null
updatedAt:
type: datetime
nullable: true
options:
default: null
This creates a entity Base which i modified to be abstract
src/app/ExampleBundle/Entity/Base.php
abstract class Base {
...
}
I have some other entities they extend this abstract class e.g.
src/app/ExampleBundle/Entity/Category.php
class Category extends Base
{
...
}
Now i tried to add a listener that sets the createdAt/updatedAt datetime on every persist for every entity that extends the Base Entity
src/app/ExampleBundle/EventListener/BaseListener.php
namespace appExampleBundleEventListener;
use DoctrineORMEventLifecycleEventArgs;
use SymfonyComponentSecurityCoreAuthenticationTokenStorageTokenStorage;
use SymfonyComponentSecurityCoreUserUserInterface;
use appExampleBundleEntityBase;
class BaseListener
{
protected $tokenStorage;
public function __construct(TokenStorage $tokenStorage)
{
$this->tokenStorage = $tokenStorage;
}
public function prePersist(Base $base, LifecycleEventArgs $event)
{
$user = $this->tokenStorage->getToken()->getUser();
if (!$user instanceof UserInterface) {
$user = null;
}
if ($base->getCreatedAt() === null) {
$base->setCreated($user, new DateTime());
} else {
$base->setUpdated($user, new DateTime());
}
}
}
And added it to the bundles services.yml
src/app/ExampleBundle/Resources/config
services:
appExampleBundleEventListenerBaseListener:
arguments: ['@security.token_storage']
tags:
- { name: doctrine.orm.entity_listener, entity: appExampleBundleEntityBase, event: prePersist }
Symfony throws no Exception, but the defined event seems also not triggered.
I tried to change the entity param in services to the "real" entity Category, but still no error, nor the event triggered.
I think, i did everything as it is decribed in the documentation. But it still not working.
The command
debug:event-dispatcher
does also not show the event
So, the question is: What did i wrong?
symfony orm event-listener symfony3.4
|
show 1 more comment
up vote
1
down vote
favorite
sry if something is not so accurate, but im less experienced with Symfony
I have the following orm mapping:
src/app/ExampleBundle/Resources/config/doctrine/Base.orm.yml
appExampleBundleEntityBase:
type: mappedSuperclass
fields:
createdAt:
type: datetime
nullable: true
options:
default: null
updatedAt:
type: datetime
nullable: true
options:
default: null
This creates a entity Base which i modified to be abstract
src/app/ExampleBundle/Entity/Base.php
abstract class Base {
...
}
I have some other entities they extend this abstract class e.g.
src/app/ExampleBundle/Entity/Category.php
class Category extends Base
{
...
}
Now i tried to add a listener that sets the createdAt/updatedAt datetime on every persist for every entity that extends the Base Entity
src/app/ExampleBundle/EventListener/BaseListener.php
namespace appExampleBundleEventListener;
use DoctrineORMEventLifecycleEventArgs;
use SymfonyComponentSecurityCoreAuthenticationTokenStorageTokenStorage;
use SymfonyComponentSecurityCoreUserUserInterface;
use appExampleBundleEntityBase;
class BaseListener
{
protected $tokenStorage;
public function __construct(TokenStorage $tokenStorage)
{
$this->tokenStorage = $tokenStorage;
}
public function prePersist(Base $base, LifecycleEventArgs $event)
{
$user = $this->tokenStorage->getToken()->getUser();
if (!$user instanceof UserInterface) {
$user = null;
}
if ($base->getCreatedAt() === null) {
$base->setCreated($user, new DateTime());
} else {
$base->setUpdated($user, new DateTime());
}
}
}
And added it to the bundles services.yml
src/app/ExampleBundle/Resources/config
services:
appExampleBundleEventListenerBaseListener:
arguments: ['@security.token_storage']
tags:
- { name: doctrine.orm.entity_listener, entity: appExampleBundleEntityBase, event: prePersist }
Symfony throws no Exception, but the defined event seems also not triggered.
I tried to change the entity param in services to the "real" entity Category, but still no error, nor the event triggered.
I think, i did everything as it is decribed in the documentation. But it still not working.
The command
debug:event-dispatcher
does also not show the event
So, the question is: What did i wrong?
symfony orm event-listener symfony3.4
entity field, in tags, must refer toCategory
, notBase
– SilvioQ
Nov 21 at 21:00
@SilvioQ: 'I tried to change the entity param in services to the "real" entity Category, but still no error, nor the event triggered.'
– Squall
Nov 21 at 21:04
1
What version of doctrine are you using? If its < 2.5 you need to specify the listener on the entity as well
– Andrei Dumitrescu-Tudor
Nov 21 at 21:11
@AndreiDumitrescu-Tudor: "^2.5". I tried to set the lifecycleCallbacks, but they try to trigger some method inside the entity
– Squall
Nov 21 at 21:16
Did you try to set HasLifecycleCallbacks() insise the base entity?
– Andrei Dumitrescu-Tudor
Nov 21 at 21:28
|
show 1 more comment
up vote
1
down vote
favorite
up vote
1
down vote
favorite
sry if something is not so accurate, but im less experienced with Symfony
I have the following orm mapping:
src/app/ExampleBundle/Resources/config/doctrine/Base.orm.yml
appExampleBundleEntityBase:
type: mappedSuperclass
fields:
createdAt:
type: datetime
nullable: true
options:
default: null
updatedAt:
type: datetime
nullable: true
options:
default: null
This creates a entity Base which i modified to be abstract
src/app/ExampleBundle/Entity/Base.php
abstract class Base {
...
}
I have some other entities they extend this abstract class e.g.
src/app/ExampleBundle/Entity/Category.php
class Category extends Base
{
...
}
Now i tried to add a listener that sets the createdAt/updatedAt datetime on every persist for every entity that extends the Base Entity
src/app/ExampleBundle/EventListener/BaseListener.php
namespace appExampleBundleEventListener;
use DoctrineORMEventLifecycleEventArgs;
use SymfonyComponentSecurityCoreAuthenticationTokenStorageTokenStorage;
use SymfonyComponentSecurityCoreUserUserInterface;
use appExampleBundleEntityBase;
class BaseListener
{
protected $tokenStorage;
public function __construct(TokenStorage $tokenStorage)
{
$this->tokenStorage = $tokenStorage;
}
public function prePersist(Base $base, LifecycleEventArgs $event)
{
$user = $this->tokenStorage->getToken()->getUser();
if (!$user instanceof UserInterface) {
$user = null;
}
if ($base->getCreatedAt() === null) {
$base->setCreated($user, new DateTime());
} else {
$base->setUpdated($user, new DateTime());
}
}
}
And added it to the bundles services.yml
src/app/ExampleBundle/Resources/config
services:
appExampleBundleEventListenerBaseListener:
arguments: ['@security.token_storage']
tags:
- { name: doctrine.orm.entity_listener, entity: appExampleBundleEntityBase, event: prePersist }
Symfony throws no Exception, but the defined event seems also not triggered.
I tried to change the entity param in services to the "real" entity Category, but still no error, nor the event triggered.
I think, i did everything as it is decribed in the documentation. But it still not working.
The command
debug:event-dispatcher
does also not show the event
So, the question is: What did i wrong?
symfony orm event-listener symfony3.4
sry if something is not so accurate, but im less experienced with Symfony
I have the following orm mapping:
src/app/ExampleBundle/Resources/config/doctrine/Base.orm.yml
appExampleBundleEntityBase:
type: mappedSuperclass
fields:
createdAt:
type: datetime
nullable: true
options:
default: null
updatedAt:
type: datetime
nullable: true
options:
default: null
This creates a entity Base which i modified to be abstract
src/app/ExampleBundle/Entity/Base.php
abstract class Base {
...
}
I have some other entities they extend this abstract class e.g.
src/app/ExampleBundle/Entity/Category.php
class Category extends Base
{
...
}
Now i tried to add a listener that sets the createdAt/updatedAt datetime on every persist for every entity that extends the Base Entity
src/app/ExampleBundle/EventListener/BaseListener.php
namespace appExampleBundleEventListener;
use DoctrineORMEventLifecycleEventArgs;
use SymfonyComponentSecurityCoreAuthenticationTokenStorageTokenStorage;
use SymfonyComponentSecurityCoreUserUserInterface;
use appExampleBundleEntityBase;
class BaseListener
{
protected $tokenStorage;
public function __construct(TokenStorage $tokenStorage)
{
$this->tokenStorage = $tokenStorage;
}
public function prePersist(Base $base, LifecycleEventArgs $event)
{
$user = $this->tokenStorage->getToken()->getUser();
if (!$user instanceof UserInterface) {
$user = null;
}
if ($base->getCreatedAt() === null) {
$base->setCreated($user, new DateTime());
} else {
$base->setUpdated($user, new DateTime());
}
}
}
And added it to the bundles services.yml
src/app/ExampleBundle/Resources/config
services:
appExampleBundleEventListenerBaseListener:
arguments: ['@security.token_storage']
tags:
- { name: doctrine.orm.entity_listener, entity: appExampleBundleEntityBase, event: prePersist }
Symfony throws no Exception, but the defined event seems also not triggered.
I tried to change the entity param in services to the "real" entity Category, but still no error, nor the event triggered.
I think, i did everything as it is decribed in the documentation. But it still not working.
The command
debug:event-dispatcher
does also not show the event
So, the question is: What did i wrong?
symfony orm event-listener symfony3.4
symfony orm event-listener symfony3.4
edited Nov 21 at 22:02
asked Nov 21 at 20:48
Squall
3818
3818
entity field, in tags, must refer toCategory
, notBase
– SilvioQ
Nov 21 at 21:00
@SilvioQ: 'I tried to change the entity param in services to the "real" entity Category, but still no error, nor the event triggered.'
– Squall
Nov 21 at 21:04
1
What version of doctrine are you using? If its < 2.5 you need to specify the listener on the entity as well
– Andrei Dumitrescu-Tudor
Nov 21 at 21:11
@AndreiDumitrescu-Tudor: "^2.5". I tried to set the lifecycleCallbacks, but they try to trigger some method inside the entity
– Squall
Nov 21 at 21:16
Did you try to set HasLifecycleCallbacks() insise the base entity?
– Andrei Dumitrescu-Tudor
Nov 21 at 21:28
|
show 1 more comment
entity field, in tags, must refer toCategory
, notBase
– SilvioQ
Nov 21 at 21:00
@SilvioQ: 'I tried to change the entity param in services to the "real" entity Category, but still no error, nor the event triggered.'
– Squall
Nov 21 at 21:04
1
What version of doctrine are you using? If its < 2.5 you need to specify the listener on the entity as well
– Andrei Dumitrescu-Tudor
Nov 21 at 21:11
@AndreiDumitrescu-Tudor: "^2.5". I tried to set the lifecycleCallbacks, but they try to trigger some method inside the entity
– Squall
Nov 21 at 21:16
Did you try to set HasLifecycleCallbacks() insise the base entity?
– Andrei Dumitrescu-Tudor
Nov 21 at 21:28
entity field, in tags, must refer to
Category
, not Base
– SilvioQ
Nov 21 at 21:00
entity field, in tags, must refer to
Category
, not Base
– SilvioQ
Nov 21 at 21:00
@SilvioQ: 'I tried to change the entity param in services to the "real" entity Category, but still no error, nor the event triggered.'
– Squall
Nov 21 at 21:04
@SilvioQ: 'I tried to change the entity param in services to the "real" entity Category, but still no error, nor the event triggered.'
– Squall
Nov 21 at 21:04
1
1
What version of doctrine are you using? If its < 2.5 you need to specify the listener on the entity as well
– Andrei Dumitrescu-Tudor
Nov 21 at 21:11
What version of doctrine are you using? If its < 2.5 you need to specify the listener on the entity as well
– Andrei Dumitrescu-Tudor
Nov 21 at 21:11
@AndreiDumitrescu-Tudor: "^2.5". I tried to set the lifecycleCallbacks, but they try to trigger some method inside the entity
– Squall
Nov 21 at 21:16
@AndreiDumitrescu-Tudor: "^2.5". I tried to set the lifecycleCallbacks, but they try to trigger some method inside the entity
– Squall
Nov 21 at 21:16
Did you try to set HasLifecycleCallbacks() insise the base entity?
– Andrei Dumitrescu-Tudor
Nov 21 at 21:28
Did you try to set HasLifecycleCallbacks() insise the base entity?
– Andrei Dumitrescu-Tudor
Nov 21 at 21:28
|
show 1 more comment
2 Answers
2
active
oldest
votes
up vote
1
down vote
Here the documentation I follow https://symfony.com/doc/3.4/doctrine/event_listeners_subscribers.html
The prePersist method is called for all the entities so you must exclude non instance of appExampleBundleEntityBase. The first argument is LifecycleEventArgs.
public function prePersist(LifecycleEventArgs $event)
{
$base = $event->getObject();
if (!$base instanceof Base) {
return;
}
$user = $this->tokenStorage->getToken()->getUser();
if (!$user instanceof UserInterface) {
$user = null;
}
if ($base->getCreatedAt() === null) {
$base->setCreated($user, new DateTime());
} else {
$base->setUpdated($user, new DateTime());
}
}
I can recommend you StofDoctrineExtensionsBundle (Timestampable) that does exactly what you want. It based on DoctrineExtensions.
There is even a trait that works like a charm.
Where does$args
come from?
– cezar
Nov 21 at 21:52
My Problem is that the prePersist Method does never run. I tried to throw Exception or die() inside the prePersist method, but nothing is called. And thanks for Link to the StofBundle, i will take a look at it.
– Squall
Nov 21 at 21:59
@cezar typo... I edit the post
– EquaPro
Nov 21 at 22:01
2
May be, you must change the tag name todoctrine.event_listener
(without orm).entity
property is not necesary.
– SilvioQ
Nov 21 at 22:08
@SilvioQ +1 I missed the tag name
– EquaPro
Nov 21 at 22:24
|
show 2 more comments
up vote
0
down vote
After some research, many more tests, diving into the EntityManager and the UnitOfWork. Nothing seems to work fine. I get it so far to work on doctrine:fixtures:load
, but for any reason they still not working if i use the entity manager in the Controllers. So, i decided to try another way with a subscriber.
tags:
- { name: doctrine.event_subscriber }
class ... implements EventSubscriber
So i still dont know why the Listener did not work as expected, but with the subscribers i found a solution that does.
Thanks to all of you for support :)
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
Here the documentation I follow https://symfony.com/doc/3.4/doctrine/event_listeners_subscribers.html
The prePersist method is called for all the entities so you must exclude non instance of appExampleBundleEntityBase. The first argument is LifecycleEventArgs.
public function prePersist(LifecycleEventArgs $event)
{
$base = $event->getObject();
if (!$base instanceof Base) {
return;
}
$user = $this->tokenStorage->getToken()->getUser();
if (!$user instanceof UserInterface) {
$user = null;
}
if ($base->getCreatedAt() === null) {
$base->setCreated($user, new DateTime());
} else {
$base->setUpdated($user, new DateTime());
}
}
I can recommend you StofDoctrineExtensionsBundle (Timestampable) that does exactly what you want. It based on DoctrineExtensions.
There is even a trait that works like a charm.
Where does$args
come from?
– cezar
Nov 21 at 21:52
My Problem is that the prePersist Method does never run. I tried to throw Exception or die() inside the prePersist method, but nothing is called. And thanks for Link to the StofBundle, i will take a look at it.
– Squall
Nov 21 at 21:59
@cezar typo... I edit the post
– EquaPro
Nov 21 at 22:01
2
May be, you must change the tag name todoctrine.event_listener
(without orm).entity
property is not necesary.
– SilvioQ
Nov 21 at 22:08
@SilvioQ +1 I missed the tag name
– EquaPro
Nov 21 at 22:24
|
show 2 more comments
up vote
1
down vote
Here the documentation I follow https://symfony.com/doc/3.4/doctrine/event_listeners_subscribers.html
The prePersist method is called for all the entities so you must exclude non instance of appExampleBundleEntityBase. The first argument is LifecycleEventArgs.
public function prePersist(LifecycleEventArgs $event)
{
$base = $event->getObject();
if (!$base instanceof Base) {
return;
}
$user = $this->tokenStorage->getToken()->getUser();
if (!$user instanceof UserInterface) {
$user = null;
}
if ($base->getCreatedAt() === null) {
$base->setCreated($user, new DateTime());
} else {
$base->setUpdated($user, new DateTime());
}
}
I can recommend you StofDoctrineExtensionsBundle (Timestampable) that does exactly what you want. It based on DoctrineExtensions.
There is even a trait that works like a charm.
Where does$args
come from?
– cezar
Nov 21 at 21:52
My Problem is that the prePersist Method does never run. I tried to throw Exception or die() inside the prePersist method, but nothing is called. And thanks for Link to the StofBundle, i will take a look at it.
– Squall
Nov 21 at 21:59
@cezar typo... I edit the post
– EquaPro
Nov 21 at 22:01
2
May be, you must change the tag name todoctrine.event_listener
(without orm).entity
property is not necesary.
– SilvioQ
Nov 21 at 22:08
@SilvioQ +1 I missed the tag name
– EquaPro
Nov 21 at 22:24
|
show 2 more comments
up vote
1
down vote
up vote
1
down vote
Here the documentation I follow https://symfony.com/doc/3.4/doctrine/event_listeners_subscribers.html
The prePersist method is called for all the entities so you must exclude non instance of appExampleBundleEntityBase. The first argument is LifecycleEventArgs.
public function prePersist(LifecycleEventArgs $event)
{
$base = $event->getObject();
if (!$base instanceof Base) {
return;
}
$user = $this->tokenStorage->getToken()->getUser();
if (!$user instanceof UserInterface) {
$user = null;
}
if ($base->getCreatedAt() === null) {
$base->setCreated($user, new DateTime());
} else {
$base->setUpdated($user, new DateTime());
}
}
I can recommend you StofDoctrineExtensionsBundle (Timestampable) that does exactly what you want. It based on DoctrineExtensions.
There is even a trait that works like a charm.
Here the documentation I follow https://symfony.com/doc/3.4/doctrine/event_listeners_subscribers.html
The prePersist method is called for all the entities so you must exclude non instance of appExampleBundleEntityBase. The first argument is LifecycleEventArgs.
public function prePersist(LifecycleEventArgs $event)
{
$base = $event->getObject();
if (!$base instanceof Base) {
return;
}
$user = $this->tokenStorage->getToken()->getUser();
if (!$user instanceof UserInterface) {
$user = null;
}
if ($base->getCreatedAt() === null) {
$base->setCreated($user, new DateTime());
} else {
$base->setUpdated($user, new DateTime());
}
}
I can recommend you StofDoctrineExtensionsBundle (Timestampable) that does exactly what you want. It based on DoctrineExtensions.
There is even a trait that works like a charm.
edited Nov 21 at 22:00
answered Nov 21 at 21:31
EquaPro
1012
1012
Where does$args
come from?
– cezar
Nov 21 at 21:52
My Problem is that the prePersist Method does never run. I tried to throw Exception or die() inside the prePersist method, but nothing is called. And thanks for Link to the StofBundle, i will take a look at it.
– Squall
Nov 21 at 21:59
@cezar typo... I edit the post
– EquaPro
Nov 21 at 22:01
2
May be, you must change the tag name todoctrine.event_listener
(without orm).entity
property is not necesary.
– SilvioQ
Nov 21 at 22:08
@SilvioQ +1 I missed the tag name
– EquaPro
Nov 21 at 22:24
|
show 2 more comments
Where does$args
come from?
– cezar
Nov 21 at 21:52
My Problem is that the prePersist Method does never run. I tried to throw Exception or die() inside the prePersist method, but nothing is called. And thanks for Link to the StofBundle, i will take a look at it.
– Squall
Nov 21 at 21:59
@cezar typo... I edit the post
– EquaPro
Nov 21 at 22:01
2
May be, you must change the tag name todoctrine.event_listener
(without orm).entity
property is not necesary.
– SilvioQ
Nov 21 at 22:08
@SilvioQ +1 I missed the tag name
– EquaPro
Nov 21 at 22:24
Where does
$args
come from?– cezar
Nov 21 at 21:52
Where does
$args
come from?– cezar
Nov 21 at 21:52
My Problem is that the prePersist Method does never run. I tried to throw Exception or die() inside the prePersist method, but nothing is called. And thanks for Link to the StofBundle, i will take a look at it.
– Squall
Nov 21 at 21:59
My Problem is that the prePersist Method does never run. I tried to throw Exception or die() inside the prePersist method, but nothing is called. And thanks for Link to the StofBundle, i will take a look at it.
– Squall
Nov 21 at 21:59
@cezar typo... I edit the post
– EquaPro
Nov 21 at 22:01
@cezar typo... I edit the post
– EquaPro
Nov 21 at 22:01
2
2
May be, you must change the tag name to
doctrine.event_listener
(without orm). entity
property is not necesary.– SilvioQ
Nov 21 at 22:08
May be, you must change the tag name to
doctrine.event_listener
(without orm). entity
property is not necesary.– SilvioQ
Nov 21 at 22:08
@SilvioQ +1 I missed the tag name
– EquaPro
Nov 21 at 22:24
@SilvioQ +1 I missed the tag name
– EquaPro
Nov 21 at 22:24
|
show 2 more comments
up vote
0
down vote
After some research, many more tests, diving into the EntityManager and the UnitOfWork. Nothing seems to work fine. I get it so far to work on doctrine:fixtures:load
, but for any reason they still not working if i use the entity manager in the Controllers. So, i decided to try another way with a subscriber.
tags:
- { name: doctrine.event_subscriber }
class ... implements EventSubscriber
So i still dont know why the Listener did not work as expected, but with the subscribers i found a solution that does.
Thanks to all of you for support :)
add a comment |
up vote
0
down vote
After some research, many more tests, diving into the EntityManager and the UnitOfWork. Nothing seems to work fine. I get it so far to work on doctrine:fixtures:load
, but for any reason they still not working if i use the entity manager in the Controllers. So, i decided to try another way with a subscriber.
tags:
- { name: doctrine.event_subscriber }
class ... implements EventSubscriber
So i still dont know why the Listener did not work as expected, but with the subscribers i found a solution that does.
Thanks to all of you for support :)
add a comment |
up vote
0
down vote
up vote
0
down vote
After some research, many more tests, diving into the EntityManager and the UnitOfWork. Nothing seems to work fine. I get it so far to work on doctrine:fixtures:load
, but for any reason they still not working if i use the entity manager in the Controllers. So, i decided to try another way with a subscriber.
tags:
- { name: doctrine.event_subscriber }
class ... implements EventSubscriber
So i still dont know why the Listener did not work as expected, but with the subscribers i found a solution that does.
Thanks to all of you for support :)
After some research, many more tests, diving into the EntityManager and the UnitOfWork. Nothing seems to work fine. I get it so far to work on doctrine:fixtures:load
, but for any reason they still not working if i use the entity manager in the Controllers. So, i decided to try another way with a subscriber.
tags:
- { name: doctrine.event_subscriber }
class ... implements EventSubscriber
So i still dont know why the Listener did not work as expected, but with the subscribers i found a solution that does.
Thanks to all of you for support :)
answered Nov 23 at 12:58
Squall
3818
3818
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53420251%2fsymfony-seems-to-register-but-not-trigger-my-doctrine-event%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
entity field, in tags, must refer to
Category
, notBase
– SilvioQ
Nov 21 at 21:00
@SilvioQ: 'I tried to change the entity param in services to the "real" entity Category, but still no error, nor the event triggered.'
– Squall
Nov 21 at 21:04
1
What version of doctrine are you using? If its < 2.5 you need to specify the listener on the entity as well
– Andrei Dumitrescu-Tudor
Nov 21 at 21:11
@AndreiDumitrescu-Tudor: "^2.5". I tried to set the lifecycleCallbacks, but they try to trigger some method inside the entity
– Squall
Nov 21 at 21:16
Did you try to set HasLifecycleCallbacks() insise the base entity?
– Andrei Dumitrescu-Tudor
Nov 21 at 21:28