Skip to content
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

Merged
merged 22 commits into from
Mar 22, 2012

Conversation

velovint
Copy link
Contributor

No description provided.

@@ -17,7 +17,7 @@ abstract class OrmTestCase extends DoctrineTestCase

/**
* @param array $paths
* @return \Doctrine\Common\Annotations\AnnotationReader
* @return \Doctrine\ORM\Mapping\Driver\AnnotationDriver
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please revert it

Copy link
Contributor Author

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

Copy link
Member

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.

@velovint
Copy link
Contributor Author

velovint commented Dec 8, 2011

guys, do you have any concerns or proposals on this functionality?

@guilhermeblanco
Copy link
Member

@velovint Please merge with current master.
I saw a couple of things outdated there.

Except that, I'm fine. @beberlei you fine too?

@beberlei
Copy link
Member

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

@velovint
Copy link
Contributor Author

@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.

@beberlei
Copy link
Member

@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.

@velovint
Copy link
Contributor Author

@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.

@beberlei
Copy link
Member

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.

@velovint
Copy link
Contributor Author

velovint commented Jan 8, 2012

@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(-)"

@beberlei
Copy link
Member

beberlei commented Jan 8, 2012

@velovint i get notifications, but i get so many of them and don't have infinite time ;)

@beberlei
Copy link
Member

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.

@velovint
Copy link
Contributor Author

@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.

@velovint
Copy link
Contributor Author

@beberlei I just merged in master and verified that all tests pass

@beberlei
Copy link
Member

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 beberlei merged commit 78d3f64 into doctrine:master Mar 22, 2012
@velovint
Copy link
Contributor Author

@beberlei sorry for delay. Is there still an issue with serialize/unserialize? If so how can I see it?

@beberlei
Copy link
Member

I fixed that myself.

On Tue, Mar 27, 2012 at 1:11 AM, Vitali Yakavenka <
reply@reply.github.com

wrote:

@beberlei sorry for delay. Is there still an issue with
serialize/unserialize? If so how can I see it?


Reply to this email directly or view it on GitHub:
#206 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants