This doesn't seem like a doctrine bug, but simply a normal issue with
soft-deletes.

You don't have a concept of garbage collection when you actually designed
your DB to keep garbage with a "deleted" flag :-)

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/

On 16 December 2014 at 11:12, Alessandro <[email protected]> wrote:
>
> Hi
>
> I developed a crud that allows you to set a field "deleted" to perform a
> softdelete; any entity has deleted field.
>
> My problem are the Foreign Keys, with softdelete i cant  check if Foreign
> Keys are valid.
>
>
> There is a Doctrine function to simulate this:
> ....
> //check fk
>  try {
>                     $em->getConnection()->beginTransaction();
>                     $em->remove($entity);
>                     $em->flush();
>                     $em->getConnection()->commit();
>                 } catch (Exception $e) {
>                    //row is used show msg
> }
> //row is not used
> //rollback real delete
> $em->rollback();
>
> //softdeleted
> $entity->setDeleted(1);
> ....
>
> p.s.
> I used Codeignitter 2 + Doctrine 2
>
> Best Regards
>
>  --
> 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