# |
Sep 12th 2019, 15:36 |
ricksaccous |
but find('all') is still a thing |
# |
Sep 12th 2019, 15:36 |
ricksaccous |
@this.impetus not really you should specify contain |
# |
Sep 12th 2019, 15:36 |
jotpe |
hm; I'll dig a bit, thanks @ricksaccous @inoas |
# |
Sep 12th 2019, 15:35 |
this.impetus |
Hey guys, is there an equivalent to this ```$this->Model->find('all')->contain('all')```? |
# |
Sep 12th 2019, 15:34 |
ricksaccous |
@jotpe likely an association is set up using the wrong fk/binding key |
# |
Sep 12th 2019, 15:33 |
admad |
@jh no, use your own table locator if you want that |
# |
Sep 12th 2019, 15:30 |
jotpe |
Doesn't set the fk |
# |
Sep 12th 2019, 15:30 |
jotpe |
Error: SQLSTATE[HY000]: General error: 1364 Field 'id' doesn't have a default value |
# |
Sep 12th 2019, 15:30 |
jotpe |
but didn't seem to work neither o.O |
# |
Sep 12th 2019, 15:30 |
ricksaccous |
cool, glad you got it figured out |
# |
Sep 12th 2019, 15:30 |
ricksaccous |
lol |
# |
Sep 12th 2019, 15:30 |
jotpe |
I guess the problem was that 'name' wasn't $_accessible in the Entity |
# |
Sep 12th 2019, 15:29 |
jh |
also see this gist - automagic are bad but automagic table classes often break your code https://gist.github.com/inoas/78f24f3024a449af3e2675ae61d439b7 |
# |
Sep 12th 2019, 15:29 |
jh |
@jotpe see my gist |
# |
Sep 12th 2019, 15:29 |
ricksaccous |
@jotpe to debug this first try querying the users with those associations, pay attention to the child entity names when you do this, and pay attention to the patchEntity, you should see that name resolves to an entity after patch and same for emailaddresses |
# |
Sep 12th 2019, 15:29 |
jh |
@jh throwing exceptions if table or entity classes are missing instead of falling back to generic/automagic tables/entities |
# |
Sep 12th 2019, 15:28 |
jh |
https://gist.github.com/inoas/cfa9aee7a7509e8c66e53f57f48c5687 |
# |
Sep 12th 2019, 15:28 |
jh |
try this |
# |
Sep 12th 2019, 15:28 |
admad |
@jh not sure what you mean |
# |
Sep 12th 2019, 15:27 |
jh |
https://book.cakephp.org/3.0/en/orm/saving-data.html#saving-hasmany-associations |
# |
Sep 12th 2019, 15:27 |
jh |
https://book.cakephp.org/3.0/en/orm/saving-data.html#saving-hasone-associations |
# |
Sep 12th 2019, 15:26 |
jh |
it should be the association name |
# |
Sep 12th 2019, 15:26 |
jotpe |
'associated' => should be always plural, right? |
# |
Sep 12th 2019, 15:26 |
jh |
@jotpe that call should only persist but not save |
# |
Sep 12th 2019, 15:25 |
jh |
@admad did that make it into 404 for tables/entities (aka no automagic by default?) |
# |
Sep 12th 2019, 15:25 |
jotpe |
it's not gonna work. Changed the request data, but nit persosted |
# |
Sep 12th 2019, 15:25 |
jh |
https://gist.github.com/inoas/78f24f3024a449af3e2675ae61d439b7 |
# |
Sep 12th 2019, 15:25 |
jh |
place this at the end of your bootstrap.php- wihtout the php prologue |
# |
Sep 12th 2019, 15:24 |
jh |
yes just a bad table/class name |
# |
Sep 12th 2019, 15:24 |
ricksaccous |
emailaddresses is prob fine my bad |
# |
Sep 12th 2019, 15:24 |
ricksaccous |
oh nvm |
# |
Sep 12th 2019, 15:24 |
jh |
well depends on the table name |
# |
Sep 12th 2019, 15:23 |
ricksaccous |
please actually look at the result of patch entity |
# |
Sep 12th 2019, 15:23 |
jh |
for has one |
# |
Sep 12th 2019, 15:23 |
ricksaccous |
and email adresses should be email_addresses |
# |
Sep 12th 2019, 15:23 |
ricksaccous |
in the request data |
# |
Sep 12th 2019, 15:23 |
ricksaccous |
names should be name |
# |
Sep 12th 2019, 15:23 |
jh |
2. there is missing the primary entity as far as it looks like |
# |
Sep 12th 2019, 15:23 |
ricksaccous |
it isn't patching correctly |
# |
Sep 12th 2019, 15:22 |
slackebot |
<jotpe> |
# |
Sep 12th 2019, 15:22 |
jh |
1. jotpe do you have associations defined correctly? |