DDC-1707: Lifecycle events not fired #2149

Closed
opened 2026-01-22 13:42:43 +01:00 by admin · 2 comments
Owner

Originally created by @doctrinebot on GitHub (Mar 15, 2012).

Originally assigned to: @beberlei on GitHub.

Jira issue originally created by user dswindle:

I didn't notice this before, but I have a mapped entity whereby the lifecycle events are not getting fired. Example:

---- entity ----
namespace blah\foo\bar;

/****

  • @Entity
  • @HasLifecycleCallbacks
  • @InheritanceType("SINGLE_TABLE")
  • @Table(name="users")
  • @DiscriminatorColumn(name="usr_type", type="integer")
  • @DiscriminatorMap({"1" = "blah\foo\bar\User", "2" = "blah\laa\dee\Member"})
    /
    class BaseUser {
    /
    ** @PostLoad **/
    public function onPostLoad() {
    // do something
    }
    }

---- entity ----
namespace blah\laa\dee;

/****

  • @Entity
    */
    class Member extends \blah\foo\bar\BaseUser {

}

---- code ----
$this->getEntityManager()->createQueryBuilder()
->select('m')
->from('blah\laa\dee\Member','m')
->where('m.id=?1 and m.deleted=false and m.canceled=false')
->getQuery()
->setParameter(1, $memberID)
->getSingleResult()

In release 2.1.6 the code above fires the @PostLoad method in BaseUser. In release 2.2.1 the @PostLoad is not fired.

Originally created by @doctrinebot on GitHub (Mar 15, 2012). Originally assigned to: @beberlei on GitHub. Jira issue originally created by user dswindle: I didn't notice this before, but I have a mapped entity whereby the lifecycle events are not getting fired. Example: ---- entity ---- namespace blah\foo\bar; /**** - @Entity - @HasLifecycleCallbacks - @InheritanceType("SINGLE_TABLE") - @Table(name="users") - @DiscriminatorColumn(name="usr_type", type="integer") - @DiscriminatorMap({"1" = "blah\foo\bar\User", "2" = "blah\laa\dee\Member"}) _/ class BaseUser { /_*\* @PostLoad **/ public function onPostLoad() { // do something } } ---- entity ---- namespace blah\laa\dee; /**** - @Entity */ class Member extends \blah\foo\bar\BaseUser { } ---- code ---- $this->getEntityManager()->createQueryBuilder() ->select('m') ->from('blah\laa\dee\Member','m') ->where('m.id=?1 and m.deleted=false and m.canceled=false') ->getQuery() ->setParameter(1, $memberID) ->getSingleResult() In release 2.1.6 the code above fires the @PostLoad method in BaseUser. In release 2.2.1 the @PostLoad is not fired.
admin added the Bug label 2026-01-22 13:42:43 +01:00
admin closed this issue 2026-01-22 13:42:44 +01:00
Author
Owner

@doctrinebot commented on GitHub (Jul 7, 2012):

Comment created by @beberlei:

Cannot reproduce this, please reopen if problem persists. I added a DDC1707Test.php to master branch that shows it works, i tried this with 2.2 branch aswell.

@doctrinebot commented on GitHub (Jul 7, 2012): Comment created by @beberlei: Cannot reproduce this, please reopen if problem persists. I added a DDC1707Test.php to master branch that shows it works, i tried this with 2.2 branch aswell.
Author
Owner

@doctrinebot commented on GitHub (Jul 7, 2012):

Issue was closed with resolution "Cannot Reproduce"

@doctrinebot commented on GitHub (Jul 7, 2012): Issue was closed with resolution "Cannot Reproduce"
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#2149