Log message #4185318

# At Username Text
# May 2nd 2019, 11:40 charolastra bootstrapCli() doesn't seem to be called either. i can put in invalid expressions and it doesn't complain :/
# May 2nd 2019, 11:39 lorro Apparently yes. Have left it out now and am getting the same error response. I also tested to put it back in bootstrap.php by Plugin::load and that works. Loading the plugin in bootstrapCli() doesn't fix it either by the way
# May 2nd 2019, 11:37 neon1024 CLI and App bootstrap are different methods https://github.com/cakephp/app/blob/master/src/Application.php#L87
# May 2nd 2019, 11:34 charolastra lorro: what happens i you leave the addPlugin() in bootstrap() out completly? i think it gets ignored completly for CLI
# May 2nd 2019, 11:32 slackebot (shell) functions that need to be running. Apparently there the bootstrap values don't get loaded in the application. Any idea what could be causing this?
# May 2nd 2019, 11:32 lorro Hi all, I recently updated to version 3.7, don't know if my issue is directly related to that. Before I loaded my plugins by Plugin::load in bootstrap.php and have now moved that code to Application.php to reflect the changes in the newest cakePHP. I load it like this: `$this->addPlugin('Eav', ['bootstrap' => true]);` the bootstrap of the plugin gets loaded fine when I open the application in the browser. However I've also got some CLI
# May 2nd 2019, 11:29 charolastra how different is the execution of the CLI to the server execution? why does the app know about Queue.Queue when the plugin isn't loaded in bootstrap.php nor bootstrap()?
# May 2nd 2019, 11:13 neon1024 Schema cache perhaps
# May 2nd 2019, 11:05 hippo thanks though
# May 2nd 2019, 11:05 hippo nvm my errors went awat for some reason
# May 2nd 2019, 11:03 neon1024 @hippo Then I have no idea. ;)
# May 2nd 2019, 11:03 hippo where you return fields that don't match the tables schema
# May 2nd 2019, 11:02 hippo @neon1024 yup get that with the tables schema, but im doing a query with a aliased column doing sql functions.
# May 2nd 2019, 11:02 roel I mean like, will be rewriten to the timezone i set it to
# May 2nd 2019, 11:01 roel Hello everyone, In my database every datetime is saved as UTC. I've created an REST API with the CRUD API plugin. Is there a way to set a timezone, that way all the datetimes that will be fetched from the database will be automaticly rewriten to the right timezone?
# May 2nd 2019, 10:55 neon1024 I’d think would do it :slightly_smiling_face:
# May 2nd 2019, 10:55 neon1024 With `$schema->columnType('date', 'integer');`
# May 2nd 2019, 10:55 neon1024 This is the method you’re after
# May 2nd 2019, 10:54 slackebot <neon1024>
# May 2nd 2019, 10:54 neon1024 Rather than \Cake\I18n\DateTime, or whatever date class is in vogue these days
# May 2nd 2019, 10:54 neon1024 Then when it’s marshalled, it’ll be cast to int
# May 2nd 2019, 10:54 neon1024 https://book.cakephp.org/3.0/en/orm/database-basics.html#data-types
# May 2nd 2019, 10:53 neon1024 @hippo In your table class, you’d specify in the schema that the field is an int and not a date
# May 2nd 2019, 10:53 slackebot <yannickfogang>
# May 2nd 2019, 10:53 yannickfogang Hello everyone, I used PDO directly in a model Cakephp to make a request a little complex and for reasons of performance, after that my Models lose the connection to my database, how can I reconnect my Models automatically?
# May 2nd 2019, 10:48 hippo Is there a way to map the it like `['date' => 'integer']`
# May 2nd 2019, 10:47 hippo for something like that though
# May 2nd 2019, 10:47 hippo ``` ->select([ 'date' => $queryDate ]) ```
# May 2nd 2019, 10:45 neon1024 I tend to use type for Telephone, Postcode, and EncryptedString :slightly_smiling_face:
# May 2nd 2019, 10:45 neon1024 You can create your own Type classes
# May 2nd 2019, 10:43 hippo to avoid errors like > Notice (8): Undefined index: "date" [CORE/src/Database/FieldTypeConverter.php, line 81]
# May 2nd 2019, 10:42 hippo Is there a way I can add to the typeMap of a query?
# May 2nd 2019, 10:12 hippo Going to go with the second one for now :slightly_smiling_face:
# May 2nd 2019, 10:11 hippo Only that last one worked.. Tried this as well (`->func()->extract('dow', 'Test.timestamp', ['Test.timestamp' => 'literal']);`)
# May 2nd 2019, 10:08 hippo Would a function like this quote identifiers? (with identifier quoting enabled) ``` ->func()->extract('dow', 'Test.timestamp') ``` Or would this be correct? ``` ->func()->extract('dow', new \Cake\Database\Expression\IdentifierExpression('Test.timestamp')) ```
# May 2nd 2019, 09:49 conehead Similar to what I got, but still a bit more clever. Will adjust my code!
# May 2nd 2019, 09:44 conehead Looks exactly like what I was looking for ;)
# May 2nd 2019, 09:44 conehead Cheers! I will have a look
# May 2nd 2019, 09:43 dereuromark Sandbox shows the examples, and Setup plugin has a demo bake template that can auto create everything including forms for it based on the methods.
# May 2nd 2019, 09:42 dereuromark See either different enum behavior strategies in awesome list, or use what I recommend and call semi-static-enums ( https://www.dereuromark.de/2010/06/24/static-enums-or-semihardcoded-attributes/ ), I use entities for it.
# May 2nd 2019, 09:34 conehead Hm just wondering....if you have an integer field in a model and each value stands for a specific string. where would you put the logic to transform the integer value to the correct string. Create a helper for that specific model that turns 1 => 'Foo', 2 => 'Bar'?