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.

Reply via email to