Skip to content

Support for custom ID generator #726

@dantleech

Description

@dantleech

I would like to automatically name a node based on a given prefix then an auto-generated numeric suffix, e.g.:

node1/
    foobar-0/
    foobar-1/
    foobar-2/

This allows children to be mapped and accessed as an array (e.g. @Children(filter=foobar-*).

This is not currently possible with event listeners as, on update, the child node name is required and the generator is invoked before the event is fired.

It would seem better to me to use a custom generator for this purpose. Doctrine allows a mapping for @CustomIdGenerator:

    /**
     * @Id @Column(type="string") @GeneratedValue(strategy="CUSTOM")
     * @CustomIdGenerator(class="stdClass")
     */
    public $id;

I don't really see why this cannot be a service, but we could at least copy this in the PHPCR-ODM.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions