DDC-1127: LifeCycleCallbacks for parent classes #1411

Open
opened 2026-01-22 13:13:30 +01:00 by admin · 0 comments
Owner

Originally created by @doctrinebot on GitHub (Apr 27, 2011).

Originally assigned to: @beberlei on GitHub.

Jira issue originally created by user jasper:

LifeCycleCallbacks for parent classes do not work anymore.

Before, I used RC2 and declared a class Model which is not an entity, but the parent class of all my models. This class depends on LifeCycleCallbacks and has a few @PrePersist / @PreUpdate methods that apply for all the subclasses. However, due to the fact that the latter version of Doctrine only supports LifeCycleCallbacks from the actual class itself, makes this impossible.

Could this maybe become an option? I now did a quick fix by omitting the second check in line 396 in the Doctrine\ORM\Mapping\Driver\AnnotationDriver:

if ($method->isPublic() && $method->getDeclaringClass()->getName() == $class->name) {
Originally created by @doctrinebot on GitHub (Apr 27, 2011). Originally assigned to: @beberlei on GitHub. Jira issue originally created by user jasper: LifeCycleCallbacks for parent classes do not work anymore. Before, I used RC2 and declared a class Model which is not an entity, but the parent class of all my models. This class depends on LifeCycleCallbacks and has a few @PrePersist / @PreUpdate methods that apply for all the subclasses. However, due to the fact that the latter version of Doctrine only supports LifeCycleCallbacks from the actual class itself, makes this impossible. Could this maybe become an option? I now did a quick fix by omitting the second check in line 396 in the Doctrine\ORM\Mapping\Driver\AnnotationDriver: ``` if ($method->isPublic() && $method->getDeclaringClass()->getName() == $class->name) { ```
admin added the Improvement label 2026-01-22 13:13:30 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#1411