mgonyan
mgonyan

Reputation: 21

Set doctrine entities attribute in cascade (Symfony2 app)

I am working in a Symfony2 application (using Doctrine) where that contains the following entities:

One of the Apps requirement is we must keep in the database all the rows and just set them as deleted in case we need to remove an A, B or C from the database.

Currently every entity has a Manager service that allow to us managing and working with the entities.

However when we need to remove one element of the entities A (isDeleted = true) we must to trigger an action for setting as isDeleted = true all the children relations, in this particular case we need to set as deleted B and C.

Is there any design pattern or good practice (using event dispatcher, doctrine life cycles event or Service way) to achieve this ? In order to keep the code clean and maintainable if we need to add more relationship.

Thanks.

Upvotes: 0

Views: 135

Answers (1)

Related Questions