Skip to content

Conversation

lsmith77
Copy link
Member

@lsmith77 lsmith77 commented Mar 7, 2011

this is a quick adaption of the CouchDB ODM code for id generation. for now i am leaving the question of renaming "path" to "id" open (aka $this->identifier vs. $this->path in ClassMetadata). the SlugifiedGenerator is just an illustration of how things could potentially look like.

one obvious issue with the code that i took from CouchDB is that its currently not possible to register custom ID generators. aka it would be nice to be able to register a generator that does some custom logic using some properties (like category, creation date) to automatically generate a path that distributes content over subnodes to prevent hitting performance limits of Jackrabbit.

Copy link
Member

Choose a reason for hiding this comment

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

people lost their degree for copy paste lately ;-)

Copy link
Member Author

Choose a reason for hiding this comment

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

hehe .. you are still listed as the author :)

Copy link
Member Author

Choose a reason for hiding this comment

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

or in other words .. i started implementing it .. and then got lazy :)

…fied (replaced by a repository callback). still needs support in mapping drivers, also can we provide a default implementation in the repository class (then we can remove the interface and default to the repository generator)
@lsmith77
Copy link
Member Author

Copy link
Member

Choose a reason for hiding this comment

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

Inside the Doctrine code you can use $cm->reflFields->getValue($document, $cm->path); for performance reasons.

@lsmith77
Copy link
Member Author

I think I will add another generator ParentRelativePathGenerator.
This one requires the Document to implement an interface to be able to fetch the parent node and a relativePath property.

@Seldaek Seldaek merged commit 44b9462 into doctrine:master Mar 17, 2011
@lsmith77 lsmith77 mentioned this pull request Feb 24, 2014
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.

3 participants