# |
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? |
# |
Aug 27th 2019, 12:57 |
dereuromark |
You need to give proper context here. |
# |
Aug 27th 2019, 12:47 |
np |
Hello, `'orderDate' => $request->created->format('Y-m-d'),` > Accessing created on the interface Cake\Datasource\EntityInterface suggest that you code against a concrete implementation. How to fix this? |
# |
Aug 27th 2019, 12:32 |
vossen.steven |
https://github.com/dereuromark/cakephp-tools/blob/master/docs/Entity/Enum.md |
# |
Aug 27th 2019, 12:31 |
conehead |
https://www.dereuromark.de/2010/06/24/static-enums-or-semihardcoded-attributes/ |
# |
Aug 27th 2019, 12:31 |
conehead |
@turkles Maybe have a look at this |
# |
Aug 27th 2019, 12:24 |
turkles |
Howdy, if I have a set of values (like.. V. Poor, Poor, Avg, Good, V.Good) is there an easy way to show these as text but save in my db as a tinyint where my model switches them as it sets/gets? |
# |
Aug 27th 2019, 10:45 |
neon1024 |
Ah, actually, I’ll add a condition to the association |
# |
Aug 27th 2019, 10:44 |
neon1024 |
When I am using `belongsToMany()` with `through` option, how can I sort on a field in the through table? Do I need to expand the association to belongsTo and hasMany? |