# |
Jan 23rd 2020, 14:53 |
jotpe |
I did `bin/cake cache clear_all` and `bin/cake orm_cache clear` |
# |
Jan 23rd 2020, 14:52 |
val |
@ndm. hmmm... doesn't happen in my case |
# |
Jan 23rd 2020, 14:51 |
neon1024 |
@jotpe Local model cache? |
# |
Jan 23rd 2020, 14:49 |
jotpe |
Even weirder: The code in production does work o.O |
# |
Jan 23rd 2020, 14:48 |
ndm |
@val That should happen automatically. |
# |
Jan 23rd 2020, 14:47 |
jotpe |
so should be correct |
# |
Jan 23rd 2020, 14:47 |
jotpe |
my table name for that is: ```invoice_itemgroups``` |
# |
Jan 23rd 2020, 14:46 |
neon1024 |
Shouldn’t that be InvoiceItemGroups? |
# |
Jan 23rd 2020, 14:46 |
neon1024 |
Might be this one? InvoiceItemgroups |
# |
Jan 23rd 2020, 14:45 |
slackebot |
<jotpe> |
# |
Jan 23rd 2020, 14:45 |
jotpe |
Hm. Yeah, @neon1024 I saved this nested. For some reason The query does not fail, if I comment out this part (of one method in RegistrationsTable): |
# |
Jan 23rd 2020, 14:41 |
slackebot |
<jotpe> |
# |
Jan 23rd 2020, 14:41 |
neon1024 |
I wonder if the query is containing other tables then? Perhaps you’ve typo’d one of those |
# |
Jan 23rd 2020, 14:41 |
slackebot |
<jotpe> |
# |
Jan 23rd 2020, 14:41 |
neon1024 |
Items belongsToMany Registrations? |
# |
Jan 23rd 2020, 14:41 |
jotpe |
The jointable is defined here: |
# |
Jan 23rd 2020, 14:40 |
jotpe |
Ah yeah, it's just a typo. My table is named items_registrations |
# |
Jan 23rd 2020, 14:40 |
neon1024 |
`items_registrations` perhaps |
# |
Jan 23rd 2020, 14:40 |
neon1024 |
Lower case `i` ? |
# |
Jan 23rd 2020, 14:39 |
jotpe |
Cake outputs this: Please try correcting the issue for the following table aliases: • *ItemsRegistrations* |
# |
Jan 23rd 2020, 14:38 |
jotpe |
My table is named: Items_registrations. |
# |
Jan 23rd 2020, 14:38 |
jotpe |
Hmmmm |
# |
Jan 23rd 2020, 14:38 |
neon1024 |
Which would mean you’re using SQL for a table which isn’t there, causing an SQL error I would guess |
# |
Jan 23rd 2020, 14:37 |
neon1024 |
Sounds like Cake cannot find your join table, and so is making an instance for you |
# |
Jan 23rd 2020, 14:36 |
jotpe |
`Could this be caused by using Auto-Tables?` `Some of the Table objects in your application were created by instantiating "*Cake\ORM\Table*" instead of any other specific subclass.` |
# |
Jan 23rd 2020, 14:35 |
jotpe |
What could cause an *Error:* SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; for a join table? |
# |
Jan 23rd 2020, 14:34 |
val |
@dereuromark? |
# |
Jan 23rd 2020, 14:34 |
jotpe |
Hey, folks! |
# |
Jan 23rd 2020, 14:34 |
val |
Is there an easy way to trigger `beforeFind` on associated model in 3.x? F.ex. PostsTable uses BitmaskedBehavior that formats the result set (https://github.com/dereuromark/cakephp-tools/blob/master/src/Model/Behavior/BitmaskedBehavior.php#L120). What is needed is that when `$this->Users->find()->contain(['Posts'])` is called the posts results would be adjusted by that behavior. |
# |
Jan 23rd 2020, 13:57 |
admad |
the return value of `countBy()` would be a collection, not an array. You would get an array upon iterating it or calling `->toArray()` on it |
# |
Jan 23rd 2020, 13:53 |
neon1024 |
Which is what confused me |
# |
Jan 23rd 2020, 13:53 |
neon1024 |
So did I, but if you try `$completedCalls['complete']` you can an exception that Collection cannot be used as Array |
# |
Jan 23rd 2020, 13:22 |
spriz |
Wat - I thought it would be an array directly |
# |
Jan 23rd 2020, 13:21 |
spriz |
Sweet! |
# |
Jan 23rd 2020, 13:09 |
neon1024 |
Anyway, I have a pie chart now 8) |
# |
Jan 23rd 2020, 13:09 |
neon1024 |
Or firstMatch |
# |
Jan 23rd 2020, 13:09 |
neon1024 |
Otherwise I’d need ->first() :face_palm: |
# |
Jan 23rd 2020, 13:09 |
neon1024 |
But casting to array gives it keys I can access :) |
# |
Jan 23rd 2020, 13:08 |
neon1024 |
Well it is a collection |
# |
Jan 23rd 2020, 13:07 |
spriz |
But yeah `$completedCalls` is an array - not a `Collection` |
# |
Jan 23rd 2020, 13:05 |
neon1024 |
@spriz Hm, I totally missed that. Thanks! |