Open mehov opened 3 months ago
How are you marshalling data into your entity? Is slug
part of the data that is being set into the entity?
How are you marshalling data into your entity?
Normal find()
, nothing special
Is slug part of the data that is being set into the entity?
No, it isn't
Is slug
in the accessible fields list of your entity?
Normal find(), nothing special
find()
doesn't marshal anything, newEntity()
or patchEntity()
does.
Is slug part of the data that is being set into the entity?
No, it isn't
The field transformer won't run then. Field marshalling only happens for fields that exist in the data being set into the entity.
See https://github.com/dereuromark/cakephp-tools/blob/a917b0d2bf2721a083d44b89c0ea53e0221c9db5/src/Model/Behavior/SluggedBehavior.php#L219 for how you can add a slug into the entity based on certain other fields present when the callback is run.
Hi everyone
Please clarify the documentation for Transforming Request Data into Entity Properties. Currently it's unclear how to get the custom fields from Behaviour into Entities of the Table said Behaviour is attached to. It only shows a small snippet out of context.
I created a behaviour and copied that snipet from documentation.
When I call
->slug
on an entity, I get anull
. I'm clearly missing something, but I can't understand what from the documentation.Additional resources I checked: