# |
Jul 5th 2017, 14:25 |
neon1024 |
Or if you want to download the repo to it’s own folder and try out the test suite :slightly_smiling_face: |
# |
Jul 5th 2017, 14:25 |
jeremyharris |
@pedroseco can you gist the entity after you add the _joinData property to it? |
# |
Jul 5th 2017, 14:25 |
neon1024 |
Hmm, can you submit and issue for it please? Then I can try and take a look at it :slightly_smiling_face: |
# |
Jul 5th 2017, 14:25 |
jarard01 |
in the process method of ProfferBehavior if I debug($uploadList); it is empty |
# |
Jul 5th 2017, 14:24 |
jarard01 |
yes, and yes - I use the multi upload on another model |
# |
Jul 5th 2017, 14:24 |
neon1024 |
The plugin is loaded isn’t it? |
# |
Jul 5th 2017, 14:24 |
neon1024 |
jarard01, ..and the edit template is the Links edit form? |
# |
Jul 5th 2017, 14:23 |
pedroseco |
@jeremyharris it seems I can’t set the _joinData after I created the newEntity() for the foreign model. Any more ideas? |
# |
Jul 5th 2017, 14:23 |
jarard01 |
mine is consistent: https://gist.github.com/spacebiscuit/0008bf634f24f15d4b41a392c3131700 |
# |
Jul 5th 2017, 14:19 |
neon1024 |
https://github.com/davidyell/CakePHP3-Proffer-Example/blob/master/src/Template/Posts/edit.ctp#L16-L30 |
# |
Jul 5th 2017, 14:19 |
neon1024 |
https://github.com/davidyell/CakePHP3-Proffer-Example/blob/master/src/Model/Table/PostsTable.php#L42-L49 |
# |
Jul 5th 2017, 14:18 |
neon1024 |
Perhaps this will help? https://github.com/davidyell/CakePHP3-Proffer-Example |
# |
Jul 5th 2017, 14:18 |
jarard01 |
they do match, I just posted old mark-up |
# |
Jul 5th 2017, 14:17 |
neon1024 |
The post data field should match the upload field |
# |
Jul 5th 2017, 14:17 |
neon1024 |
jarard01, Why do you have a field called ‘image’ and a data array called ‘link’ ? These are not consistant |
# |
Jul 5th 2017, 14:17 |
jeremyharris |
what issue with pagination are you running into? It’s pretty battle tested but it’s not impossible there’s a bug |
# |
Jul 5th 2017, 14:16 |
jarard01 |
i've debugged both issues to death and now I'm starting to think they are bugs |
# |
Jul 5th 2017, 14:14 |
jeremyharris |
that’s how it goes sometimes ;) hang in there |
# |
Jul 5th 2017, 14:14 |
jarard01 |
I had two epic days of development, absolutely nailed most of my app, I have now come skidding to a halt because of two simple features, pagination and an image upload. |
# |
Jul 5th 2017, 14:08 |
pedroseco |
Ah i see… because on Cake 2 I think it was “direct” |
# |
Jul 5th 2017, 14:08 |
jeremyharris |
but going through $table->newEntity might add it — try and see :slightly_smiling_face: |
# |
Jul 5th 2017, 14:08 |
jeremyharris |
entities are pretty “dumb” objects - they aren’t aware that they are a join table so I doubt it would create a _joinData prop |
# |
Jul 5th 2017, 14:07 |
jeremyharris |
that I don’t know. I believe it’s only available when you contain an association that has a through table |
# |
Jul 5th 2017, 14:07 |
jarard01 |
I'm not so sure that it is mis-configured though |
# |
Jul 5th 2017, 14:06 |
pedroseco |
@jeremyharris I used a manual save() on that table before, but I would like to use the “proper” way this time. Isn the _joinData available after i initiated the newEntity() ? |
# |
Jul 5th 2017, 14:06 |
cleptric |
gutts: I tested it, and I get ``` 'data' => [ 'user_id' => '36', 'text' => 'ffff', 'foo' => 'bar' ], ``` When I alter the request data before I pass it to `patchEntity` |
# |
Jul 5th 2017, 14:05 |
jeremyharris |
see: https://book.cakephp.org/3.0/en/orm/saving-data.html#saving-additional-data-to-the-join-table |
# |
Jul 5th 2017, 14:05 |
pedroseco |
in this case i’m trying to just save a “sort” column value on the already populated joinTable |
# |
Jul 5th 2017, 14:05 |
jeremyharris |
I think you want _joinData @pedroseco |
# |
Jul 5th 2017, 14:05 |
jarard01 |
if anyone wants to answer my SO question on paginator the link is https://stackoverflow.com/questions/44928493/cake3-paginator-sort-error |
# |
Jul 5th 2017, 14:04 |
pedroseco |
hi guys! how do we save a extra field on a join table just by using the save() on the foreign model? It seems i can only save both id’s and not the extra field even if i add it into the object. |
# |
Jul 5th 2017, 14:00 |
gutts |
actually, this is an associated model. $context['data'] only contains the fields for that field. hm |
# |
Jul 5th 2017, 14:00 |
cleptric |
> You can access the other submitted field values using the $context[‘data’] array. |
# |
Jul 5th 2017, 13:59 |
cleptric |
$this->request->getData() |
# |
Jul 5th 2017, 13:58 |
cleptric |
Just pass `$this->request->getData()` to `patchEntity()` |
# |
Jul 5th 2017, 13:57 |
cleptric |
Would also be better to avoid strange side effects. |
# |
Jul 5th 2017, 13:57 |
gutts |
cleptric: do you know how to access all of the request data or all the data in a validation rule? |
# |
Jul 5th 2017, 13:57 |
gutts |
ah, ok |
# |
Jul 5th 2017, 13:56 |
cleptric |
If you’re using `$this->request->data` you can modifiy it. If you use the new `$this->request->getData()` and `$this->request->withData()` no, as the request is immutable then. Just save it to a new variable and change that. |
# |
Jul 5th 2017, 13:56 |
jarard01 |
fields have been whitelsited |
# |
Jul 5th 2017, 13:56 |
gutts |
but i'd also like to know the other way just for my own information.. i still can't access all the request params in my validation rule, on 'when' or 'notEmpty' 3rd param |