# |
Sep 6th 2019, 11:26 |
spriz |
anything else stated in php.ini ? :) |
# |
Sep 6th 2019, 10:43 |
neon1024 |
I’d like to extend my session time to 30 minutes, but this configuration doesn’t seem to be working for me. What have I missed? |
# |
Sep 6th 2019, 10:42 |
slackebot |
<neon1024> |
# |
Sep 6th 2019, 10:39 |
spriz |
And with core translations behavior :) I'll live with the auto tables for now it seems! ;P |
# |
Sep 6th 2019, 10:35 |
alexdd55976 |
you shouldn't do it in the controller anyway. `$EmailTable->YourMethodName($params)`... no need to make any querys in the controller. |
# |
Sep 6th 2019, 10:34 |
spriz |
Welp, this also fails if using default Cake DB sessions setup :P |
# |
Sep 6th 2019, 10:31 |
ndm |
I think there have been discussions, but since this "issue" exists forever already and there hasn't been any changes yet, the conclusion was probably to not do that. |
# |
Sep 6th 2019, 10:28 |
spriz |
has it been considered to add that to cakephp/app ? :P |
# |
Sep 6th 2019, 10:28 |
spriz |
much love! |
# |
Sep 6th 2019, 10:26 |
ndm |
@spriz There is a way... kind of... https://book.cakephp.org/3.0/en/development/configuration.html#disabling-generic-tables |
# |
Sep 6th 2019, 10:22 |
jotpe |
Thanks everybody for your help :slightly_smiling_face: |
# |
Sep 6th 2019, 10:21 |
neon1024 |
Would be a nice config option in `bootstrap.php` :slightly_smiling_face: |
# |
Sep 6th 2019, 10:21 |
neon1024 |
I think perhaps it was @ionas who disabled it |
# |
Sep 6th 2019, 10:20 |
neon1024 |
To be fair if you do get an exception, the exception text does tell you about auto-generated tables |
# |
Sep 6th 2019, 10:20 |
neon1024 |
I * think* that you can, but I don’t recall how |
# |
Sep 6th 2019, 10:20 |
spriz |
Seems like a lot of people hits these issues, including myself in early 3.x days |
# |
Sep 6th 2019, 10:19 |
spriz |
would rather get an exception right off the bat |
# |
Sep 6th 2019, 10:19 |
spriz |
I would love for some way to disable the auto usage of that `\Cake\Orm\Table` :P |
# |
Sep 6th 2019, 10:19 |
jotpe |
$emailTable = TableRegistry::getTableLocator()->get(' *Users.* Emailaddresses'); instead of $emailTable = TableRegistry::getTableLocator()->get('Emailaddresses'); |
# |
Sep 6th 2019, 10:18 |
spriz |
that is because `findByUserId` is auto magic on `Cake\Orm\Table` :slightly_smiling_face: |
# |
Sep 6th 2019, 10:18 |
jotpe |
I hate magic. The Model is in a plugin. Correct way to get the Table was `$emailTable = TableRegistry::getTableLocator()->get(' *Users.* Emailaddresses');`. But for some reason `$emailTable->findByUserId($user->getIdentifier());` worked nevertheless |
# |
Sep 6th 2019, 10:18 |
neon1024 |
I did think this was odd `EmailaddressesTable` instead of `EmailAddressesTable` |
# |
Sep 6th 2019, 10:16 |
jotpe |
gosh. |
# |
Sep 6th 2019, 10:12 |
ndm |
@jotpe Listen to @spriz, he knows what's up... your table object is an "auto-table", an instance of `\Cake\ORM\Table` instead of a concrete extending class thereof. Check your spelling, namespaces, filenames, etc, for some reason your table class cannot be found. |
# |
Sep 6th 2019, 10:07 |
david098 |
so you can do something like $jobs = $this->Jobs->Users->Emailaddresses->find('ownedBy', ['user' => 2])->first(); |
# |
Sep 6th 2019, 10:07 |
jotpe |
Wait, I'll check check for another Model... |
# |
Sep 6th 2019, 10:06 |
david098 |
is there an association between emailaddresses and jobs? |
# |
Sep 6th 2019, 10:05 |
jotpe |
Yes, but not working. |
# |
Sep 6th 2019, 10:04 |
david098 |
i used different models :slightly_smiling_face: |
# |
Sep 6th 2019, 10:04 |
david098 |
$query= $emailTable->find('ownedBy', ['user' => 2])->first(); |
# |
Sep 6th 2019, 10:02 |
jotpe |
Unknown finder method "ownedBy" :thinking_face: |
# |
Sep 6th 2019, 10:00 |
david098 |
Testing had to add ->first() to my controller $query= $this->EmailTable->find('ownedBy', ['user' => 2])->first(); |
# |
Sep 6th 2019, 09:59 |
jotpe |
and this is working $emailTable->findByUserId($user->getIdentifier()); |
# |
Sep 6th 2019, 09:58 |
jotpe |
@spriz it's object(Cake\ORM\Table) |
# |
Sep 6th 2019, 09:57 |
jotpe |
@david098 already changed this |
# |
Sep 6th 2019, 09:57 |
javier.villanueva |
$this->User->EmailAddress->find()->where(['user_id' => $user->id])->first(); |
# |
Sep 6th 2019, 09:56 |
david098 |
dont call $options['user']->id |
# |
Sep 6th 2019, 09:56 |
david098 |
$options['user'] is already the id of the user |
# |
Sep 6th 2019, 09:56 |
jotpe |
@alexdd55976 In my Model a user can Has Many EmailAdresses. Since i need a function at some places in my code to get the most recent Emailaddress of the user and didn't want to the query everytime in a controller. |
# |
Sep 6th 2019, 09:56 |
spriz |
is it Cake\Orm\Table or your actual Table instance? |
# |
Sep 6th 2019, 09:55 |
spriz |
@jotpe what is output `debug($emailTable)`? |