-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support custom id generators #206
Support custom id generators #206
Conversation
…ors to follow current implementation
…uplicates one in AbstractMappingDriverTest
…h name in other mapping types
@@ -17,7 +17,7 @@ abstract class OrmTestCase extends DoctrineTestCase | |||
|
|||
/** | |||
* @param array $paths | |||
* @return \Doctrine\Common\Annotations\AnnotationReader | |||
* @return \Doctrine\ORM\Mapping\Driver\AnnotationDriver |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please revert it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please explain why? do I miss something? that method returns AnnotationDriver and not reader
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah right. I missed the fact that it said the annotation reader by reading too fast. I was just looking at the new code putting the base drivers in Common at the same time and thought it was a reverting of a recent change.
guys, do you have any concerns or proposals on this functionality? |
There is a change missing on ClassMetadata that adds the customIdGenerator of ClassMetadataInfo to the serialized fields and reconstructs it on wakeup. Additionally i don't like the way additional arguments are passed to the generator. This is something that should be placed in a greater context of Dependency Injection which i plan for 2.3 |
@guilhermeblanco done. Have only 34 skipped test, the rest is passing fine. @beberlei there is no ClassMetadataInfo::customIdGenerator. ID generator is stored in ClassMetadataInfo::idGenerator which is serialized. Generator definition is stored in customGeneratorDefinition and is not serialized. I simply followed Sequence Generator approach. I agree with you that passing parameters this was isn't ideal, but I couldn't find a way to have usability of named arguments along with flexibility. Do you think current implementation of custom ID generator will complicate moving ID generator definitions inside of Dependency Injection context? I think that having something more generic at the base of ID generators can simplify current implementation of other ID generators configuration. |
@velovint If sequenceGenerator is not serialized, then this is a bug as well. Not serialized means, Doctrine forgets it in the first cached request. Regarding DI, i just don't want this API now, since then i have to maintain it forever. Can we make it without parameters for now? (I hope thats still useful, however you can create a sub-class per configuration). Then we don't have to maintain two APIs. |
@beberlei it's not sequenceGenerator or customIdGenerator not serialized, they both stored in idGenerator property which is serialized. Their definitions aren't serialized, however (sequenceGeneratorDefinition), but this shouldn't be a problem, as it's used only during initialization. So, do you want me to add generator definitions to the list of serialized properties? I totally understand you concert regarding API. If we can have support without parameters this works for my purpose and others like "UUID Generator" as well. I'll modify it. |
ah yes, now i get it with the properties, sometimes i miss the picture :) Perfect with the refactoring. This probably makes the patch much simpler also. |
@beberlei not sure if you get notifications when I push new commits. I removed support to pass arguments to generator's constructor reducing total changeset to "15 files changed, 245 insertions(+), 34 deletions(-)" from "295 insertions(+), 34 deletions(-)" |
@velovint i get notifications, but i get so many of them and don't have infinite time ;) |
Sorry that i didnt write back on this yet, this will be in 2.3, however i want to get 2.2 out before coming back to this ticket. |
@beberlei thanks for update. please let me know when you have time to check it out, so that I can merge latest changes from master. |
…portCustomIdGenerators
@beberlei I just merged in master and verified that all tests pass |
During review i realized this has a bug, its not handling serialize/unserialize correctly and will not work in combination with a cache therefore. |
@beberlei sorry for delay. Is there still an issue with serialize/unserialize? If so how can I see it? |
I fixed that myself. On Tue, Mar 27, 2012 at 1:11 AM, Vitali Yakavenka <
|
No description provided.