Uploaded image for project: 'Doctrine 2 - ORM'
  1. Doctrine 2 - ORM
  2. DDC-1248

Documentation regarding prePersist and postPersist events a bit lacking


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


      Please make it more clear that prePersist and postPersist events are called only when creating new entity (that is, prior and after a database insert).

      IRC log:
      Hi. I have a question regarding (pre|post)persist events. Why are the events ignored for second persist (should fire prePersist) + flush (should fire postPersist) in the following pastie: http://pastebin.com/V8CrPWkM Is it a bug or am I missing sth?
      helmer: there is no second persist. persist() means saying Doctrine to manage the entity. Once it is managed, you are not persisting it anymore but updating it
      Stof: so basically one could define these two events for themselves as (pre|post)Insert?
      thanks beberlei&stof! though a suggestion to docteam .. perhaps make it more clear to people like me, current doc can be kind of misleading ie: "There are two ways for the prePersist event to be triggered. One is obviously when you call EntityManager#persist()" http://www.doctrine-project.org/docs/orm/2.0/en/reference/events.html#prepersist

      Pastie code (probably expired by now):
      $entity = new Entity();




        helmer Helmer Aaviksoo created issue -
        beberlei Benjamin Eberlei made changes -
        Field Original Value New Value
        Project Doctrine Website [ 10033 ] Doctrine 2 - ORM [ 10032 ]
        Key DWEB-90 DDC-1248
        Component/s Documentation [ 10013 ]
        Component/s Documentation [ 10045 ]
        beberlei Benjamin Eberlei made changes -
        Workflow jira [ 12785 ] jira-feedback [ 13944 ]
        beberlei Benjamin Eberlei made changes -
        Workflow jira-feedback [ 13944 ] jira-feedback2 [ 15808 ]
        beberlei Benjamin Eberlei made changes -
        Workflow jira-feedback2 [ 15808 ] jira-feedback3 [ 18064 ]

        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={expand=changesets[0:20].revisions[0:29],reviews, query=DDC-1248}, methodType=GET}] : Received status code 503 (Service Temporarily Unavailable)


          • Assignee:
            jwage Jonathan H. Wage
            helmer Helmer Aaviksoo
          • Votes:
            0 Vote for this issue
            0 Start watching this issue


            • Created: