Logs for #cakephp

Page 4 of 36,478, showing 100 records out of 3,647,755 total, starting on record 301, ending on 400

# At Username Text
# Jan 23rd, 16:01 ndm As you can see in the stacktrace, it happens when retrieving the target models for associations. So maybe your CMS models do not have associations, or the table classes already exists and have the CMS connection set as default. And/or the table classes for the associations for your pdfPlatform connection already exist and don't have their default connection changed. That's probably something that would need to be fixed in bake anyhow, not sure
# Jan 23rd, 16:01 slackebot though what the right way would be...
# Jan 23rd, 15:54 k4t if I rename "PdfPlatform" source to "default" it will work of course
# Jan 23rd, 15:51 k4t I can bake models from "CMS" source, but not from "pdfPlatform"
# Jan 23rd, 15:51 k4t I have two datasources defined, one is "pdfPlatform" and second one is "CMS"
# Jan 23rd, 15:49 k4t looks like --connection parameter is ignored somewhere by bake plugin
# Jan 23rd, 15:48 k4t here you can see full log
# Jan 23rd, 15:47 slackebot <k4t>
# Jan 23rd, 15:44 ndm Look at the stacktrace to see where and for what operation exactly the exception is being thrown
# Jan 23rd, 15:41 k4t as you can see
# Jan 23rd, 15:41 k4t but result is the same
# Jan 23rd, 15:41 k4t bin\cake bake model PPlaces --connection pdfPlatform One moment while associations are detected. Exception: The datasource configuration "default" was not found.
# Jan 23rd, 15:41 k4t I also tried
# Jan 23rd, 15:38 k4t but it works when you just want to list all tables from db
# Jan 23rd, 15:38 k4t it looks like passing connection name when you want to bake a model does not work
# Jan 23rd, 15:36 k4t CakePHP 3.8
# Jan 23rd, 15:36 k4t any ideas?
# Jan 23rd, 15:36 k4t bin\cake bake model PPlaces -c pdfPlatform -> will give me error Exception: The datasource configuration "default" was not found.
# Jan 23rd, 15:35 k4t bin\cake bake model -c pdfPlatform -> will give me list of all models in database
# Jan 23rd, 15:34 k4t Hi
# Jan 23rd, 15:34 val @ndm, ah, foreign key must be selected :)
# Jan 23rd, 15:30 spriz like /foo/bar/baz/action would be hitting the controller in this path `/plugins/Foo/src/Controller/Bar/Baz/ActionController`?
# Jan 23rd, 15:30 val @ndm any idea why 'select' strategy would not generate a query?
# Jan 23rd, 15:29 spriz is there a sneaky way to make more nested levels of prefix controllers available in cake 3.x ? :P
# Jan 23rd, 15:13 ndm https://book.cakephp.org/4/en/orm/retrieving-data-and-resultsets.html#changing-fetching-strategies
# Jan 23rd, 15:13 ndm Should work via the `strategy` option for the containment I think
# Jan 23rd, 15:11 val @ndm is there a way to change the association strategy 'join' to 'select' on the fly?
# Jan 23rd, 15:09 val @ndm it looks like the mapper closure is not invoked
# Jan 23rd, 15:02 val @ndm indeed, beforeFind is invoked but the mapper does not work as expected
# Jan 23rd, 15:00 ndm That's only for delete operations if I'm not mistaken
# Jan 23rd, 14:59 neon1024 If it’s a bulk operation and it’s not set true, the callback would be skipped right
# Jan 23rd, 14:58 neon1024 @ndm Could it be to do with cascadeCallbacks in the association?
# Jan 23rd, 14:58 ndm @val Have you checked that the method really isn't being invoked (as opposed to the mapper maybe not working as expected)?
# Jan 23rd, 14:53 jotpe I did `bin/cake cache clear_all` and `bin/cake orm_cache clear`
# Jan 23rd, 14:52 val @ndm. hmmm... doesn't happen in my case
# Jan 23rd, 14:51 neon1024 @jotpe Local model cache?
# Jan 23rd, 14:49 jotpe Even weirder: The code in production does work o.O
# Jan 23rd, 14:48 ndm @val That should happen automatically.
# Jan 23rd, 14:47 jotpe so should be correct
# Jan 23rd, 14:47 jotpe my table name for that is: ```invoice_itemgroups```
# Jan 23rd, 14:46 neon1024 Shouldn’t that be InvoiceItemGroups?
# Jan 23rd, 14:46 neon1024 Might be this one? InvoiceItemgroups
# Jan 23rd, 14:45 slackebot <jotpe>
# Jan 23rd, 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, 14:41 slackebot <jotpe>
# Jan 23rd, 14:41 neon1024 I wonder if the query is containing other tables then? Perhaps you’ve typo’d one of those
# Jan 23rd, 14:41 slackebot <jotpe>
# Jan 23rd, 14:41 neon1024 Items belongsToMany Registrations?
# Jan 23rd, 14:41 jotpe The jointable is defined here:
# Jan 23rd, 14:40 jotpe Ah yeah, it's just a typo. My table is named items_registrations
# Jan 23rd, 14:40 neon1024 `items_registrations` perhaps
# Jan 23rd, 14:40 neon1024 Lower case `i` ?
# Jan 23rd, 14:39 jotpe Cake outputs this: Please try correcting the issue for the following table aliases: • *ItemsRegistrations*
# Jan 23rd, 14:38 jotpe My table is named: Items_registrations.
# Jan 23rd, 14:38 jotpe Hmmmm
# Jan 23rd, 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, 14:37 neon1024 Sounds like Cake cannot find your join table, and so is making an instance for you
# Jan 23rd, 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, 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, 14:34 val @dereuromark?
# Jan 23rd, 14:34 jotpe Hey, folks!
# Jan 23rd, 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, 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, 13:53 neon1024 Which is what confused me
# Jan 23rd, 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, 13:22 spriz Wat - I thought it would be an array directly
# Jan 23rd, 13:21 spriz Sweet!
# Jan 23rd, 13:09 neon1024 Anyway, I have a pie chart now 8)
# Jan 23rd, 13:09 neon1024 Or firstMatch
# Jan 23rd, 13:09 neon1024 Otherwise I’d need ->first() :face_palm:
# Jan 23rd, 13:09 neon1024 But casting to array gives it keys I can access :)
# Jan 23rd, 13:08 neon1024 Well it is a collection
# Jan 23rd, 13:07 spriz But yeah `$completedCalls` is an array - not a `Collection`
# Jan 23rd, 13:05 neon1024 @spriz Hm, I totally missed that. Thanks!
# Jan 23rd, 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, 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, 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, 13:02 neon1024 ```$completedCalls = $calls->countBy(function ($call) { return $call->finished !== null ? 'complete' : 'incomplete'; });```
# Jan 23rd, 13:02 neon1024 Even though DebugKit is showing the numbers I want to output
# Jan 23rd, 13:02 neon1024 Mostly about using Collection as Array or can’t convert Collection to String
# Jan 23rd, 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, 13:01 neon1024 In 3.x
# Jan 23rd, 13:01 neon1024 Yeah, just use the second param of email validation
# Jan 23rd, 12:56 etibor is it possible to check an email address if it real e-mail address?i have to send a confirmation email, but if it not valid i dont want to save anything to db
# Jan 23rd, 12:55 etibor hello mates
# Jan 23rd, 11:18 neon1024 Ah, I can include regular elements :thumbsup: Apologies, should have TIAS
# Jan 23rd, 11:16 neon1024 I presume, as they’re an instance of View, I can use Elements?
# Jan 23rd, 11:16 neon1024 How do I share markup when working in Cell templates? I have some shared HTML in my navigation cells
# Jan 23rd, 10:54 mark.mikkelson cheers
# Jan 23rd, 10:54 ndm if your cache isn't cleared properly in debug mode, check your `bootstrap.php`, the config change might be missing: https://github.com/cakephp/app/blob/3.7.1/config/bootstrap.php#L90-L95
# Jan 23rd, 10:53 ndm no problem
# Jan 23rd, 10:52 mark.mikkelson thanks again!
# Jan 23rd, 10:52 mark.mikkelson clearly the last 4 hours driving my self nuts was the jeffing cache :)
# Jan 23rd, 10:51 mark.mikkelson i thought in debug mode caches refreshed constantly
# Jan 23rd, 10:51 mark.mikkelson that was it
# Jan 23rd, 10:51 mark.mikkelson thanks
# Jan 23rd, 10:51 mark.mikkelson oh god damn it!
# Jan 23rd, 10:50 ndm In that case maybe it's your route caching, you are still registering the CSRF middleware, so it might apply it for a cached route... ie clear the cache
# Jan 23rd, 10:50 mark.mikkelson i did look at this but have no idea how it's being included, without me going back through http and a bunch of other classes I found and commenting out/deleting all the csrf stuff?
# Jan 23rd, 10:48 mark.mikkelson "message": "Missing CSRF token cookie", "url": "/tickets/update", "code": 403, "file": "\vendor\\cakephp\\cakephp\\src\\Http\\Middleware\\CsrfProtectionMiddleware.php", "line": 196