# |
Aug 27th 2019, 16:11 |
ricksaccous |
oh |
# |
Aug 27th 2019, 16:10 |
ricksaccous |
so it's not properly hydrating the entity even with that? |
# |
Aug 27th 2019, 16:10 |
neon1024 |
Well as it’s a belongsToMany it’s `replace` strategy |
# |
Aug 27th 2019, 16:10 |
neon1024 |
I tried that already and it didn’t change anything |
# |
Aug 27th 2019, 16:10 |
ricksaccous |
otherwise it doesn't knwo how to smash the data together |
# |
Aug 27th 2019, 16:10 |
ricksaccous |
yeah, it should prob have the id before patchEntity is hit |
# |
Aug 27th 2019, 16:10 |
ricksaccous |
oh really |
# |
Aug 27th 2019, 16:10 |
neon1024 |
@ricksaccous No no, the resulting associated entity property is not updated |
# |
Aug 27th 2019, 16:10 |
ricksaccous |
i've had to do it before though |
# |
Aug 27th 2019, 16:09 |
ricksaccous |
lol |
# |
Aug 27th 2019, 16:09 |
ricksaccous |
you could always just set it dirty afterwards, but that's kind of a dirty solution |
# |
Aug 27th 2019, 16:09 |
ricksaccous |
it's just not dirty |
# |
Aug 27th 2019, 16:09 |
ricksaccous |
in patchEntity, actually you already said it's getting patched |
# |
Aug 27th 2019, 16:09 |
neon1024 |
@ricksaccous Plus, the book states this exact scenario works |
# |
Aug 27th 2019, 16:09 |
ricksaccous |
are you putting _joinData in associated |
# |
Aug 27th 2019, 16:09 |
ricksaccous |
oh ok |
# |
Aug 27th 2019, 16:08 |
neon1024 |
Because I have already built the entire front-end |
# |
Aug 27th 2019, 16:07 |
ricksaccous |
@neon1024 why not just save directly on the middle table, as a has many |
# |
Aug 27th 2019, 16:07 |
alexdd55976 |
i expected to see false and null in the array... thats it |
# |
Aug 27th 2019, 16:07 |
admad |
@alexdd55976 so? |
# |
Aug 27th 2019, 16:06 |
ricksaccous |
my bad |
# |
Aug 27th 2019, 16:06 |
ricksaccous |
_ids |
# |
Aug 27th 2019, 16:06 |
ricksaccous |
you want join data so you can't save with ids |
# |
Aug 27th 2019, 16:06 |
ricksaccous |
oh |
# |
Aug 27th 2019, 16:06 |
ricksaccous |
i think normally you'd save with _ids so you aren't doing things conventionally |
# |
Aug 27th 2019, 16:04 |
neon1024 |
`public '[dirty]' => array (size=0)` :,( |
# |
Aug 27th 2019, 16:02 |
neon1024 |
Ah my join data has no id’s perhaps thats it |
# |
Aug 27th 2019, 15:58 |
neon1024 |
Just like here https://book.cakephp.org/3.0/en/orm/saving-data.html#saving-additional-data-to-the-join-table |
# |
Aug 27th 2019, 15:58 |
neon1024 |
So the request should be in `questions[0][_joinData][sortorder]` |
# |
Aug 27th 2019, 15:58 |
neon1024 |
it shoud be `$form->questions->_joinData` contains a FormsQuestion entity right? |
# |
Aug 27th 2019, 15:56 |
neon1024 |
I’m not sure how to force patch entity to deal with it, as I’ve already setup my `associated` option |
# |
Aug 27th 2019, 15:56 |
neon1024 |
But the property is accessible and is not marked dirty |
# |
Aug 27th 2019, 15:56 |
neon1024 |
`public '_joinData' => object(App\Model\Entity\FormsQuestion)[316]` |
# |
Aug 27th 2019, 15:55 |
neon1024 |
it’s correctly marshalling |
# |
Aug 27th 2019, 15:55 |
neon1024 |
I have `Forms belongsToMany Questions` `through 'FormsQuestions` |
# |
Aug 27th 2019, 15:54 |
neon1024 |
I’m submitting correct request data I reckon, and it’s being patched without error, but my _joinData property is not updated |
# |
Aug 27th 2019, 15:49 |
alexdd55976 |
`{"success":false,"message":"access denied","user":null}` with json_encode() |
# |
Aug 27th 2019, 15:48 |
alexdd55976 |
cake4.x |
# |
Aug 27th 2019, 15:48 |
alexdd55976 |
@admad |
# |
Aug 27th 2019, 15:48 |
alexdd55976 |
```Array ( [success] => [message] => access denied [user] => )``` |
# |
Aug 27th 2019, 15:48 |
neon1024 |
Does `_joinData` need to be writable in the entity? |