Maybe I am wrong, but my current interpretation is that OrphanRemoval can
be used to have the ORM 'automatically' remove Entities that are left over.
For instance, if you remove an Order Entity, then you can have the
OrderLines removed automatically. Be aware with orphanRemoval to ONLY use
it on properties that are ONLY owned / privately owned by an Entity.

So for example, if Entity A and Entity B BOTH have a property that refers
to Entity C, than you should NOT use OrphanRemoval. I had a case where
OrderLines were only used by Orders, so I used OrphanRemoval. But later
these OrderLines where referenced by InvoiceLines, at that point you can
not use OrphanRemoval anymore.

And while you are at it, and conclude you can not use OrphanRemoval, this
might be interesting as well when you need to remove stuff:
http://www.doctrine-project.org/jira/browse/DDC-956

I guess this is but one explanation of the use of OrpanRemoval. In the
documentation it is described as a concept of cascading an operation (see
it as propagating an event down a relation).

http://docs.doctrine-project.org/en/latest/reference/working-with-associations.html#orphan-removal

Enjoy!




On 2 June 2014 12:06, Nima Sadjadi <[email protected]> wrote:

> Reading wiki, I did not understand, What is the difference of
> orphanRemoval with cascade deletion with onDelete?
>
> --
> You received this message because you are subscribed to the Google Groups
> "doctrine-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/doctrine-user.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"doctrine-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to