Log message #4223556

# At Username Text
# 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!
# Jan 23rd 2020, 13:05 spriz we have `->countBy(function (Entity $entity) { return (int)$entity->created->hour(12)->minute(12)->second(0)->format('U') * 1000; })` - So I'd say something is wrong with your `$calls` maybe?
# Jan 23rd 2020, 13:05 ndm @etibor Realistically, there is no reliable way to check whether a user exists, as @neon1024 suggested, you can use the MX checking functionality of the email validation, it will help to verify that the domain has an MX record, but that doesn't tell you anything about whether the given user/account exists. The only reliable way is to sent a confirmation email, and live with the crap in your DB that you need to clean up regularly.
# Jan 23rd 2020, 13:04 spriz @neon1024 Looks pretty equal to the example :thinking_face: https://api.cakephp.org/3.8/class-Cake.Collection.CollectionInterface.html#_countBy
# Jan 23rd 2020, 13:02 neon1024 ```$completedCalls = $calls->countBy(function ($call) { return $call->finished !== null ? 'complete' : 'incomplete'; });```
# Jan 23rd 2020, 13:02 neon1024 Even though DebugKit is showing the numbers I want to output
# Jan 23rd 2020, 13:02 neon1024 Mostly about using Collection as Array or can’t convert Collection to String
# Jan 23rd 2020, 13:02 neon1024 When using Collections countBy, how do I output the data? I am getting lots of errors with the things I’m trying
# Jan 23rd 2020, 13:01 neon1024 In 3.x