GC doctrine emulation

My idea is to use the database (through ORM) as a carefree, since you are dealing with simple objects in a GC environment.

The basic idea is to use cascade-removefor most joins between tables and just skip the failed steps. A simple example:

Country (id, name)
1, UK
2, Germany

City (id, name, country)
1, London, 1
2, Brighton, 1
3, Schweinfurt, 2

Thus, when you delete City (3), the deletion will be cascaded to Country (2), and it will also be deleted (since it is no longer referenced).

If, on the other hand, you want to delete City (2), then deleting the country (1) will fail - because City (1) still refers to it - and only the City object itself will be deleted.

The problem is that Doctrine will roll back the entire transaction so that neither Country nor City is deleted. Is there any way to change this behavior?

+3

All Articles