You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
All in all, this all boils down to annotation and reading them thus there's nothing we can do within
ODM to change the behaviour. Could you please submit an issue to https://github.com/doctrine/annotations as that's where the work needs to be done?
Bug Report
Q
A
BC Break
formally yes, but practically no :)
Version
1.6.0
Summary
We use traits to customize features for our Documents. It however looks like Doctrine ignores annotations from traits. Changing annotations for the class in trait doesn't have any effect.
Current behavior
ID's are native Mongo instead of autoincremental even if autoincrement is specified in the fields overloaded version in trait.
How to reproduce
Let's say we have our base document set up to have id.
And this does not work and trait is ignored whatsoever. We also cannot implement abstract class because the autoincremental documents need to extend other classes. E.g. we have several classes of users, some of them need to be autoincremental some not.
Expected behavior
ID of class should be autoincremental when this is specified in trait.
Sorry, my bad, as I copied the text form the different package (doctrine/mongodb-odm), I copied the version of that package. I am on doctrine/annotations v 1.6.0.
I can confirm this issue with the latest doctrine/annotations version (1.13.0).
Our case is a @ORM\Column property defined in a base entity without assertions. An entity extending this one uses a trait where we add an @Assert\NotBlank annotation to the property. (The same is used in multiple extending entites, thus the trait).
Here we see that the NotBlank assertion is ignored. If we embed the property+annotation directly in the extending entity, the assertion works.
I am copying this from doctrine/mongodb-odm#1842 as requested by mr. @malarzm :
Bug Report
Summary
We use traits to customize features for our Documents. It however looks like Doctrine ignores annotations from traits. Changing annotations for the class in trait doesn't have any effect.
Current behavior
ID's are native Mongo instead of autoincremental even if autoincrement is specified in the fields overloaded version in trait.
How to reproduce
Let's say we have our base document set up to have
id
.Then we set up concrete document like this:
And we want have its id incremental instead of native Mongo id.
But we want to do it with trait. Because this behaviour is repeated in other documents.
And this does not work and trait is ignored whatsoever. We also cannot implement abstract class because the autoincremental documents need to extend other classes. E.g. we have several classes of users, some of them need to be autoincremental some not.
Expected behavior
ID of class should be autoincremental when this is specified in trait.
Please, follow this doctrine/mongodb-odm#1842 discussion with @malarzm that explains why I think this is a bug.
The text was updated successfully, but these errors were encountered: