I have two models Contents and Terms, where Contents HABTM Terms.
CreateContent form, I have built a structure as shown in the following
part of the
terms => [
columns' => [
'single_select' => [
'id' => '3'
'tags' => [
'unlimited_select' => [
'vocabulary_id' => '1',
'names' => 'tag2,another,war,tag1'
That is because there is the possibility of picking a term from a set of existing ones (using
or typing terms (within an
<input> tag) which creates new ones.
Since that format is not following the CakePHP conventions I want to re-structure the data.
I tried to use the
Model.beforeMarshal event as indicated in the Modifying request data before building entities section on the Book but with no luck.
When I call the
patchEntity($content, $this->request->getData(), ['associated' => ['Terms']]) method, the Terms are not patched at all. After digging and scratching a little bit the cakePHP code (classes
Marshaller I found out that the original data are passed to the corresponding methods
beforeMarshal() modifies the actual data or not?
What am I missing in this context?
Thank you very much in advance