# |
Feb 18th 2020, 14:05 |
neon1024 |
Did you pass it in? |
# |
Feb 18th 2020, 12:54 |
jotpe |
(even if loaded with Plugin Syntax) |
# |
Feb 18th 2020, 12:54 |
jotpe |
Anybody uses https://github.com/lorenzo/cakephp-email-queue and knows how to user helpers in the mail templates? For some reason it didn't find my Plugin Helper |
# |
Feb 18th 2020, 12:40 |
ndm |
It's basically an option that is passed down to `Collection::combine()` |
# |
Feb 18th 2020, 12:40 |
ndm |
No, `valueField` is being evaluated after the query was executed. |
# |
Feb 18th 2020, 12:38 |
val |
Hi, is is possible to use QueryExpression for 'valueField' with `find('list')` in 3.x? |
# |
Feb 18th 2020, 12:28 |
arthurb |
Also dont *debug* things thats not broke :) |
# |
Feb 18th 2020, 12:27 |
arthurb |
*lesson learnt* thank you ! |
# |
Feb 18th 2020, 12:18 |
ndm |
Yup, PHP will abort and kill all database connections, and they will issue rollbacks on all open transactions. |
# |
Feb 18th 2020, 12:16 |
arthurb |
@ndm So if I use `exit` in the calling transaction it kills all of it? |
# |
Feb 18th 2020, 12:12 |
arthurb |
:egg::face_palm: |
# |
Feb 18th 2020, 12:11 |
arthurb |
@ndm It does kill my initial save yes, but thats not the problematic one. But let me try without the exit. |
# |
Feb 18th 2020, 12:09 |
ndm |
@arthurb Could it be that you're in a transaction, and the `exit` kills that? |
# |
Feb 18th 2020, 12:02 |
arthurb |
Was going to add the field to the access list :) |
# |
Feb 18th 2020, 12:02 |
arthurb |
Yeah, I’m also a bit rusty |
# |
Feb 18th 2020, 12:01 |
neon1024 |
My first thought was mark the entity property dirty, but that’s Cake 3 :face_palm: |
# |
Feb 18th 2020, 12:01 |
neon1024 |
@arthurb I’m a bit too rusty with Cake 2 to give any advice, sorry! |
# |
Feb 18th 2020, 11:47 |
arthurb |
There is no emoji for perplexed |
# |
Feb 18th 2020, 11:46 |
slackebot |
crud(this works 100%) The shortened version of the two model files: https://gist.github.com/abarkhuysen/0a7a95b02520566d73662e7461373a71 Any suggestions would be great :) |
# |
Feb 18th 2020, 11:46 |
arthurb |
Hi there, Using Cakephp 2.10 and I’m trying to save a count to a single field. I’m using ClassRegistry to load the model and then pass arg to my function. The $this->save() returns the data array but nothing is saved to the db. There is also no entries in debug.log or error.log. What I have tried so far: 1. Clear the cache 2. Disable validation 3. Create whitelist 4. Specified the data type of my field (int) 5. Edit the record using |
# |
Feb 18th 2020, 11:36 |
lilhermit |
Thanks for your time though |
# |
Feb 18th 2020, 11:35 |
lilhermit |
@conehead No luck with that either going to use the id method |
# |
Feb 18th 2020, 11:13 |
rochasmarcelo |
By the way there is one pull request in the way |
# |
Feb 18th 2020, 11:11 |
lilhermit |
I didn't because I thought that meant it would save the User too. I'll try thanks for your help |
# |
Feb 18th 2020, 11:01 |
conehead |
Did you try using 'associated' ? |
# |
Feb 18th 2020, 11:00 |
conehead |
@lilhermit Although this here says otherwise: https://book.cakephp.org/3/en/orm/saving-data.html#saving-belongsto-associations |
# |
Feb 18th 2020, 10:59 |
kaliel |
@challgren https://gist.github.com/kaliel86/d404aecebccadbee9ba84674081bdc12 |
# |
Feb 18th 2020, 10:58 |
conehead |
When using multiple entities you can set the model directly. I think you cannot do it with a "single entity" like belongsTo |
# |
Feb 18th 2020, 10:57 |
conehead |
So "`awarding_user_id` with `$awarding_user->id` " should be the way to go |
# |
Feb 18th 2020, 10:57 |
lilhermit |
@conehead was that in reply to me? Because I'm sure i've done it before |
# |
Feb 18th 2020, 10:56 |
conehead |
Think I had this discussion here already that I thought it is not that convinient :P Was told that it is convinient that way and you have to do it that way |
# |
Feb 18th 2020, 10:54 |
lilhermit |
It works if I assign `awarding_user_id` with `$awarding_user->id` |
# |
Feb 18th 2020, 10:52 |
lilhermit |
This is my `belongsTo` ``` $this->belongsTo('AwardingUsers', [ 'className' => 'Users' ]) ->setForeignKey('awarding_user_id') ->setProperty('awarding_user') ->setJoinType('INNER');``` |
# |
Feb 18th 2020, 10:50 |
slackebot |
], '[dirty]' => [ 'points' => true, 'reason' => true, 'awarding_user' => true ], '[original]' => [], '[virtual]' => [], '[hasErrors]' => false, '[errors]' => [], '[invalid]' => [], '[repository]' => 'Points' }``` |
# |
Feb 18th 2020, 10:50 |
slackebot |
=> 33, 'reason' => 'because', 'awarding_user' => $awarding_user ]); ``` The resulting entity is ```object(App\Model\Entity\Point) { 'points' => (int) 33, 'reason' => 'because', 'awarding_user' => null, '[new]' => true, '[accessible]' => [ 'points' => true, 'reason' => true, 'awarding_user_id' => true, 'created_at' => true, 'updated_at' => true, 'awarding_user' => true |
# |
Feb 18th 2020, 10:50 |
lilhermit |
Hi I have a `PointsTable` which is belongsTo `Users` (twice) the points tables as an awarding_user_id field and if I insert manually into the table and find with contains it pulls in the awarding_user. However when I create a newEntity with User assigned to `awarding_user` property it doesn't nest the `awarding_user` nor set the `awarding_user_id` ``` $points = $this->Points->newEntity([ 'points' |
# |
Feb 18th 2020, 10:45 |
martin |
`Cake\Utility\Hash::*sort*` does not understand sorting on datetime? I do `Hash::sort($users, '{n}.orders.{n}.created', 'asc');` but it is in a strange order :P |
# |
Feb 18th 2020, 10:26 |
ndm |
Should be pretty easy, just query the recommendations on `recommendationgroup_id` (or whatever you've named the foreign key) with the selected IDs from the frontend |
# |
Feb 18th 2020, 10:18 |
FunkadelicRelic |
Obvs just recommendation 1 and 2 but at least I know it is now working! Just need to figure out getting the array of ID's now instead of hard coding. |
# |
Feb 18th 2020, 10:18 |
FunkadelicRelic |
} |
# |
Feb 18th 2020, 10:18 |
FunkadelicRelic |
$data['recommendations']['_ids'] = [1,2]; |