Log message #4185310

# At Username Text
# 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'?
# May 2nd 2019, 09:15 neon1024 Could do with a logo update I guess :thinking_face:
# May 2nd 2019, 09:14 neon1024 https://www.openhub.net/p/cakephp
# May 2nd 2019, 09:14 neon1024 I was looking at the project openhub page
# May 2nd 2019, 09:01 admad "COCOMO model" I vaguely remember that term from college days :P
# May 2nd 2019, 08:43 conehead Haha. I might join one day
# May 2nd 2019, 08:42 neon1024 Will be an exciting moment when CakePHP breaks 1000 contributors
# May 2nd 2019, 08:41 neon1024 To build CakePHP
# May 2nd 2019, 08:41 neon1024 > took an estimated 54 years of effort (COCOMO model)