mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
DDC-3961: orm:validate-schema exits with exception instead of reporting ManyToMany mapping error #4842
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 @doctrinebot on GitHub (Oct 24, 2015).
Originally assigned to: @beberlei on GitHub.
Jira issue originally created by user benjamin:
When using bi-directional many-to-many associations, and forgetting to use
mappedByandindexedBy, the error is not reported when validating the mapping (orm:validate-schema --skip-sync).Example code:
Furthermore, it triggers an exception when validating the sync with the database (
orm:validate-schema [--skip-mapping]).The exception is:
{quote}
[Doctrine\DBAL\Schema\SchemaException]
The table with name 'mydb.CuisineDish' already exists.
{quote}
This exception should not be thrown, and its message is really confusing to the end user, as it suggests that Doctrine is attempting to create a table in the database, whereas this action is read-only.
@beberlei commented on GitHub (Feb 16, 2020):
The check that is missing here in the validate schema functionality is to see that two entities have many to many pointing to each other that both use the same join table name. If this happens its a violation.