mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
on-delete attribute not working with xml mapping #5924
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @nicolaspetitjean on GitHub (Mar 19, 2018).
Hello there,
Not sure if it is a bug or i 'm doing something wrong, but i have 2 simple entities:
First a person:
Then a book
And then the xml mapping:
Then i update the db schema:
As you can see, the foreign key is not set properly. Here is what i get in my db:

Maybe i m doing something wrong ?
Thanks !
@Ocramius commented on GitHub (Mar 19, 2018):
@nicolaspetitjean what version did you try this against?
@nicolaspetitjean commented on GitHub (Mar 20, 2018):
Sorry i forgot this
So:
doctrine/orm v2.6.1 Object-Relational-Mapper for PHPThanks !
@Ocramius commented on GitHub (Mar 20, 2018):
@nicolaspetitjean can you maybe dump the
$em->getClassMetadata(\App\Entity\Person::class)output and see if theon-deleteis there?@nicolaspetitjean commented on GitHub (Mar 20, 2018):
Sure here the result:
@Ocramius commented on GitHub (Mar 21, 2018):
So the metadata was picked up correctly, but then wasn't applied at schema level:
Can you dump the
orm:schema:create --dump-sqlfor this?@nicolaspetitjean commented on GitHub (Mar 21, 2018):
Yep, looks like the on-removed has been lost during the process:
@Ocramius commented on GitHub (Mar 21, 2018):
@nicolaspetitjean can you try this also on
2.5.xto see if this is an accidental regression?@nicolaspetitjean commented on GitHub (Mar 22, 2018):
Oh my bad.
In order to try version 2.5.x, i first created a simple project (only doctrine, no more packages) with only 2 entities, and guess what it works with 2.6.
The project i'm working on is a symfony project, so i think there is a problem with it. But unfortunately, the answer was : 'Doctrine is not part of Symfony, please report this (if not already reported) to the Doctrine project'.
By the way thank you for your help.
@Ocramius commented on GitHub (Mar 22, 2018):
@nicolaspetitjean can you clarify if the issue affects 2.5.x or 2.6.x (or both) then?
@nicolaspetitjean commented on GitHub (Mar 23, 2018):
So to sum it up:
== doctrine 2.6.1 ==
It works
== doctrine 2.5.14 ==
It works
== doctrine 2.6.1 bundled in symfony ==
It does not work