Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-987

How to register lifecycle callbacks from YAML is not done correctly in the Events section of the documentation.

    Details

    • Type: Documentation Documentation
    • Status: Awaiting Feedback
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Documentation
    • Security Level: All
    • Labels:
      None

      Description

      http://www.doctrine-project.org/docs/orm/2.0/en/reference/events.html

      The above URL has an example of how to register lifecycle callbacks from YAML, but actually it does not work. The correct way of doing it is mentioned on the page: http://www.doctrine-project.org/docs/orm/2.0/en/reference/yaml-mapping.html

        Activity

        Amir created issue -
        Benjamin Eberlei made changes -
        Field Original Value New Value
        Workflow jira [ 12303 ] jira-feedback [ 13900 ]
        Benjamin Eberlei made changes -
        Workflow jira-feedback [ 13900 ] jira-feedback2 [ 15764 ]
        Benjamin Eberlei made changes -
        Workflow jira-feedback2 [ 15764 ] jira-feedback3 [ 18021 ]
        Hide
        Jeremy Postlethwaite added a comment -

        Please close this issue

        Both pages now have the same documentation.

        Doctrine example
          lifecycleCallbacks:
            prePersist: [ doStuffOnPrePersist, doOtherStuffOnPrePersistToo ]
            postPersist: [ doStuffOnPostPersist ]
        
        Partial stack trace exhibiting call:
        /redacted-path/vendor/doctrine/orm/lib/Doctrine/ORM/Event/ListenersInvoker.php(73) : eval()'d code :: Tue, 26 Nov 2013 22:05:03 -0800 $eventName
        
        prePersist
        
        /redacted-path/src/Application/Modules/System/Entity/Sites.php(161) : eval()'d code :: Tue, 26 Nov 2013 22:05:03 -0800 $args
        
        object(Doctrine\ORM\Event\LifecycleEventArgs)[839]
          private 'objectManager' (Doctrine\Common\Persistence\Event\LifecycleEventArgs) => 
            object(Doctrine\ORM\EntityManager)[330]
              private 'config' => 
                object(Doctrine\ORM\Configuration)[156]
        
        /redacted-path/src/Application/Base.php(371) : eval()'d code :: Tue, 26 Nov 2013 22:05:03 -0800
        
        #0 /redacted-path/src/Application/Modules/System/Entity/Sites.php(161): Application\Base::puke(Object(Doctrine\ORM\Event\LifecycleEventArgs), '/www/sites/loca...', true)
        #1 /redacted-path/vendor/doctrine/orm/lib/Doctrine/ORM/Event/ListenersInvoker.php(104): Application\Modules\System\Entity\Sites->prePersist(Object(Doctrine\ORM\Event\LifecycleEventArgs))
        #2 /redacted-path/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php(845): Doctrine\ORM\Event\ListenersInvoker->invoke(Object(Doctrine\ORM\Mapping\ClassMetadata), 'prePersist', Object(Application\Modules\System\Entity\Sites), Object(Doctrine\ORM\Event\LifecycleEventArgs), 2)
        #3 /redacted-path/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php(1621): Doctrine\ORM\UnitOfWork->persistNew(Object(Doctrine\ORM\Mapping\ClassMetadata), Object(Application\Modules\System\Entity\Sites))
        #4 /redacted-path/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php(1577): Doctrine\ORM\UnitOfWork->doPersist(Object(Application\Modules\System\Entity\Sites), Array)
        #5 /redacted-path/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php(624): Doctrine\ORM\UnitOfWork->persist(Object(Application\Modules\System\Entity\Sites))
        #6 /redacted-path/src/Application/Modules/Application/Controller/AbstractEntityFormActionController.php(128): Doctrine\ORM\EntityManager->persist(Object(Application\Modules\System\Entity\Sites))
        

        My configuration was slightly different from the example.

        • Changed some of the details to protect the innocent.
        My configuration inherited from a mappedSuperclass
          lifecycleCallbacks:
            prePersist: [ prePersist ]
            preFlush: [ preFlush ]
        
        Show
        Jeremy Postlethwaite added a comment - Please close this issue Both pages now have the same documentation. http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/yaml-mapping.html http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/events.html Doctrine example lifecycleCallbacks: prePersist: [ doStuffOnPrePersist, doOtherStuffOnPrePersistToo ] postPersist: [ doStuffOnPostPersist ] Partial stack trace exhibiting call: /redacted-path/vendor/doctrine/orm/lib/Doctrine/ORM/Event/ListenersInvoker.php(73) : eval()'d code :: Tue, 26 Nov 2013 22:05:03 -0800 $eventName prePersist /redacted-path/src/Application/Modules/ System /Entity/Sites.php(161) : eval()'d code :: Tue, 26 Nov 2013 22:05:03 -0800 $args object(Doctrine\ORM\Event\LifecycleEventArgs)[839] private 'objectManager' (Doctrine\Common\Persistence\Event\LifecycleEventArgs) => object(Doctrine\ORM\EntityManager)[330] private 'config' => object(Doctrine\ORM\Configuration)[156] /redacted-path/src/Application/Base.php(371) : eval()'d code :: Tue, 26 Nov 2013 22:05:03 -0800 #0 /redacted-path/src/Application/Modules/ System /Entity/Sites.php(161): Application\Base::puke( Object (Doctrine\ORM\Event\LifecycleEventArgs), '/www/sites/loca...', true ) #1 /redacted-path/vendor/doctrine/orm/lib/Doctrine/ORM/Event/ListenersInvoker.php(104): Application\Modules\ System \Entity\Sites->prePersist( Object (Doctrine\ORM\Event\LifecycleEventArgs)) #2 /redacted-path/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php(845): Doctrine\ORM\Event\ListenersInvoker->invoke( Object (Doctrine\ORM\Mapping\ClassMetadata), 'prePersist', Object (Application\Modules\ System \Entity\Sites), Object (Doctrine\ORM\Event\LifecycleEventArgs), 2) #3 /redacted-path/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php(1621): Doctrine\ORM\UnitOfWork->persistNew( Object (Doctrine\ORM\Mapping\ClassMetadata), Object (Application\Modules\ System \Entity\Sites)) #4 /redacted-path/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php(1577): Doctrine\ORM\UnitOfWork->doPersist( Object (Application\Modules\ System \Entity\Sites), Array) #5 /redacted-path/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php(624): Doctrine\ORM\UnitOfWork->persist( Object (Application\Modules\ System \Entity\Sites)) #6 /redacted-path/src/Application/Modules/Application/Controller/AbstractEntityFormActionController.php(128): Doctrine\ORM\EntityManager->persist( Object (Application\Modules\ System \Entity\Sites)) My configuration was slightly different from the example. Changed some of the details to protect the innocent. My configuration inherited from a mappedSuperclass lifecycleCallbacks: prePersist: [ prePersist ] preFlush: [ preFlush ]
        Jeremy Postlethwaite made changes -
        Status Open [ 1 ] Awaiting Feedback [ 10000 ]

        This list may be incomplete, as errors occurred whilst retrieving source from linked applications:

        • Request to http://www.doctrine-project.org/fisheye/ failed: Error in remote call to 'FishEye 0 (http://www.doctrine-project.org/fisheye/)' (http://www.doctrine-project.org/fisheye) [AbstractRestCommand{path='/rest-service-fe/search-v1/crossRepositoryQuery', params={query=DDC-987, expand=changesets[0:20].revisions[0:29],reviews}, methodType=GET}] : Received status code 503 (Service Temporarily Unavailable)

          People

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

            Dates

            • Created:
              Updated: