# |
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? |
# |
Aug 27th 2019, 15:48 |
alexdd55976 |
somehow.. still empty |
# |
Aug 27th 2019, 15:35 |
admad |
Yes |
# |
Aug 27th 2019, 15:22 |
alexdd55976 |
@admad didn't you say that return values of boolean should be true and false now, not true and empty value? |
# |
Aug 27th 2019, 15:21 |
rudy1976s |
I am facing lots of problems searching some keyword against some translated fields |
# |
Aug 27th 2019, 15:21 |
rudy1976s |
good afternoon to all! |
# |
Aug 27th 2019, 13:45 |
dereuromark |
find = expect possible null result |
# |
Aug 27th 2019, 13:45 |
dereuromark |
and also if you find or get (duuh) |
# |
Aug 27th 2019, 13:45 |
dereuromark |
depends on if the primary key is available :slightly_smiling_face: |
# |
Aug 27th 2019, 13:43 |
ricksaccous |
I mostly firstOrFail() |
# |
Aug 27th 2019, 13:34 |
spriz |
dereuromark do you mostly `->get()`, even with conditions over `->find()->where()->firstOrFail()`? :slightly_smiling_face: |
# |
Aug 27th 2019, 13:30 |
np |
ok, thanks ppl :slightly_smiling_face: |
# |
Aug 27th 2019, 13:30 |
spriz |
Ah whack, `->find()` kinda kills that :) |
# |
Aug 27th 2019, 13:30 |
dereuromark |
If you try it you will easily find the answer yourself :slightly_smiling_face: |
# |
Aug 27th 2019, 13:30 |
spriz |
`@method \StateMachine\Model\Entity\StateMachineItemState|null first($finder, $options = [])` |
# |
Aug 27th 2019, 13:29 |
spriz |
@dereuromark why is `first()` not a part of that? :) |
# |
Aug 27th 2019, 13:27 |
dereuromark |
You will see that it annotates all the right types everywhere then for you and your tooling ( https://github.com/spryker/cakephp-statemachine/blob/master/src/Model/Table/StateMachineItemStatesTable.php#L21 etc). Easily possible to get to phpstan level 7 with these approaches then as I did for my plugins. |
# |
Aug 27th 2019, 13:26 |
dereuromark |
use ModelAwareTrait and IdeHelper annotations. that fixes it by design. You arent supposed to use the static access. |
# |
Aug 27th 2019, 13:25 |
np |
@spriz yeah https://scrutinizer-ci.com |
# |
Aug 27th 2019, 13:23 |
spriz |
so you could put something like `/** @var \App\Model\Entity\VendorProduct $integrationSettings */` above it probably - replacing `VendorProduct` with your entity class and `$integrationSettings` with `$request` |
# |
Aug 27th 2019, 13:23 |
np |
``` $requestsTable = TableRegistry::getTableLocator()->get('Requests'); $request = $requestsTable->get($request_id, ['contain' => ['Orders', 'Appointments']]);` $request->created->format('Y-m-d'); ``` |
# |
Aug 27th 2019, 13:22 |
spriz |
so that parser do not know what `$request` is but that it implements `EntityInterface` which does not have a `created` property |
# |
Aug 27th 2019, 13:21 |
spriz |
@np I guess that's from some CI tool or something? phpcs? phpstan? |
# |
Aug 27th 2019, 13:21 |
dereuromark |
Surrounding code is vital to give a good answer. |
# |
Aug 27th 2019, 13:17 |
neon1024 |
Knew if I asked, I’d find it! https://book.cakephp.org/3.0/en/orm/saving-data.html#saving-additional-data-to-the-join-table |
# |
Aug 27th 2019, 13:16 |
neon1024 |
I’ve lost the bit in the book about how to create form fields for writing to`_joinData` |
# |
Aug 27th 2019, 13:15 |
np |
Can you give one example? |