phpcr-odm
phpcr-odm copied to clipboard
[WIP] Field slugifier id generator
Just an idea of how this might work.
After some reflection I think if anything this should be about normalization and not slugification. After all it is perfectly valid to have spaces and non-url-safe characters in a node name.
hey, cool. i think this is almost ready.
agree that this could be called NormalizedFieldIdGenerator or something. when you want to use the path in a URL, you do want it to be slugified. otherwise you want potentially unsupported characters replaced. and in all cases, you must translate /
and the other forbidden characters in a name. documentation should be clear about that. we could provide a very simple normalizer by default that just replaces /:[]|*
with -
.
that default normalizer could also get us rid of adding a dependency for a slugifier. we can then explain how to use that instead of the default normalizer in the doc.
@dantleech something for an upcoming phpcr-odm 2.0? or should we drop this and leave it to other layers of the application to generate ids?