Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.4.2
    • Component/s: None
    • Security Level: All
    • Labels:
      None

      Description

      This issue is created automatically through a Github pull request on behalf of gwagner:

      Url: https://github.com/doctrine/doctrine2/pull/902

      Message:

      Remove a bit of code that breaks lifecycle callbacks of parent MappedSuperclasses

      Lets say we are working with this code:

      ```php
      /**

      • @MappedSuperclass
        */
        abstract class BaseClass
        {
        /**
      • @ORM\Column(name="last_modified", type="datetimetz", nullable=false)
      • @var \DateTime
        */
        protected $lastModified;

      /**

      • @ORM\PrePersist
      • @ORM\PreUpdate
        */
        public function setLastModifiedPreUpdate() { $this->setLastModified(new \DateTime()); }

      /**

      • @param \DateTime $lastModified
        */
        public function setLastModified( $lastModified ) { $this->lastModified = $lastModified; }

      /**

      • @return \DateTime
        */
        public function getLastModified() { return $this->lastModified; }

        }

      /**

      • Class MyClass
        *
      • @Entity
      • @HasLifecycleCallbacks
        */
        class MyClass extends BaseClass { // Whatever you want in here }

        ```

      And you want to save MyClass and have it call the Lifecycle callbacks for your BaseClass. If you leave things they way they are programmed today, the BaseClass will never get its callbacks registered.

      By removing the little bit of code there [Lines 472-475], you now get lifecycle callbacks through the entire stack, not just the top most class.

        Activity

        Hide
        Doctrine Bot added a comment -

        A related Github Pull-Request [GH-902] was closed:
        https://github.com/doctrine/doctrine2/pull/902

        Show
        Doctrine Bot added a comment - A related Github Pull-Request [GH-902] was closed: https://github.com/doctrine/doctrine2/pull/902

          People

          • Assignee:
            Benjamin Eberlei
            Reporter:
            Doctrine Bot
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: