Log message #4191651

# At Username Text
# Jul 1st 2019, 16:02 admad Oh that's what you said, sorry I misread
# Jul 1st 2019, 16:00 admad niel512: timestamp are always in UTC
# Jul 1st 2019, 15:52 niel512 @kyleweishaupt, I'm not familiar with moment.js, if it can output a timestamp that's always assumed to be UTC so no need to change anything about it
# Jul 1st 2019, 15:50 neon1024 Is there a neater or more elegant way to achieve this type of nested / hierarchical routing?
# Jul 1st 2019, 15:48 kyleweishaupt It is going into the db, but was hoping to reuse the logic anywhere there's a datetime (since front-end is all moment.js based - utc). I can change the format in beforeSave/beforeMarshall, but didn't want to repeat it for every model. Thank you for the help though! :slightly_smiling_face: Much appreciated!
# Jul 1st 2019, 15:46 niel512 @kyleweishaupt, not sure about a custom class. If the date is going into your Db you can put some custom code on the field to do that for you.
# Jul 1st 2019, 15:43 sjorgefabi Hello, how are you ?, I make an open query, is it possible to migrate from version 2.x to 3.x ?. I tried using the tool from: https://github.com/dereuromark/upgrade, but I'm not successful. I have errors like the following: ErrorHandler is not in the implicit class map CakeSession is not in the implicit class map HtmlHelper is not in the implicit class map .................................
# Jul 1st 2019, 15:40 kyleweishaupt Is this something I can do in a custom DateTime type, so any request data get automatically adjusted?
# Jul 1st 2019, 15:37 niel512 If you're passing it into a DateTime object, you think you need to strip the 'Z' and specify UTC as the TZ. i.e. new DateTime('2019-06-30T13:28:00.043', 'UTC')
# Jul 1st 2019, 15:31 kyleweishaupt Tried with quoting the TandZ, without, etc. Essentially one of my dates looks like `2019-06-30T13:28:00.043Z`
# Jul 1st 2019, 15:30 kyleweishaupt Typo on my part :P
# Jul 1st 2019, 15:30 niel512 why is the T quoted?
# Jul 1st 2019, 15:26 kyleweishaupt Does anyone know an easy adjustment to have Cake 3.8 validate datetimes in UTC coming from moment.js? I can't seem to get my custom DateTimeType to handle `YYYY-MM-DD'T'HH:MM:ss.uZ`. I keep getting the "Provided value is invalid" but can't seem to get it right.
# Jul 1st 2019, 15:06 ndm @barry.chapman What's special about SAML requests?
# Jul 1st 2019, 14:54 barry.chapman anyone know how to generate a saml request in cake?
# Jul 1st 2019, 14:09 slackebot $newsletter_id); })
# Jul 1st 2019, 14:09 ndm ``` ->where(function (\Cake\Database\Expression\QueryExpression $exp) use ($newsletter_id) { return $exp->eq('MD5(CONCAT("newsletter-", Newsletters.id))', $newsletter_id); }) ``` ``` ->where(function (\Cake\Database\Expression\QueryExpression $exp, \Cake\ORM\Query $query) use ($newsletter_id) { $func = $query->func()->md5( [$query->func()->concat(['newsletter-', 'Newsletters.id' => 'identifier'])] ); return $exp->eq($func,
# Jul 1st 2019, 14:08 ndm eh, sorry, I ment expressions, not functions @david, but you could use the functions builder in conjunction with expressions of course
# Jul 1st 2019, 14:00 ndm You need to use either the functions builder, or bindings
# Jul 1st 2019, 14:00 david cakephp convert queries from OriginalCase to "everylowercase"
# Jul 1st 2019, 13:59 david I am having issues with concat and LowerCase table names...
# Jul 1st 2019, 13:48 ndm @ionas I can't quite wrap my head around that snippet... but `innerJoinWith()` is for associations, in order to join a subquery, you'd have to use `innerJoin()` or `join()`... an example of what data you have, and what you want to retrieve might help. Are trying to pull of some kind of "greatest n per group" query?
# Jul 1st 2019, 13:47 dereuromark I had the bug that tags have been saved multiple times, with a count of 1 each. instead of proper reusing. So no, I didnt find another solution, this one works now.
# Jul 1st 2019, 13:46 ricksaccous that prob won't work for what you're trying to do i suppose
# Jul 1st 2019, 13:46 ricksaccous @dereuromark save and replace strategy? lol
# Jul 1st 2019, 13:44 dereuromark admad: the problem is specifically patchEntity and uniqueness only for existing in DB ( https://github.com/dereuromark/cakephp-tags/pull/28/files#diff-33b2925318abc4cc41b83442ae327efbR170 ) it would need to do uniqueness check also on already patched data, not sure if someone already coded sth here.
# Jul 1st 2019, 13:43 ndm *wouldn't
# Jul 1st 2019, 13:43 david how would you do this WHERE clause in the CakePHP Way? $newsletter = $this->Newsletters->find() ->where(['MD5(CONCAT("newsletter-", Newsletters.id)) =' => $newsletter_id]) ->first();
# Jul 1st 2019, 13:43 ndm @ionas it really depends on what exactly you are trying to do... but you probably would use `IN`, but `ON`, like `JOIN (SELECT ...) AS sub ON sub.id = parent.id`
# Jul 1st 2019, 13:43 inoas https://gist.github.com/inoas/9195c4526642fd68dc72506e607ac576
# Jul 1st 2019, 13:42 inoas because for me it doesnt
# Jul 1st 2019, 13:42 inoas do you have a very small working snipplet
# Jul 1st 2019, 13:40 inoas ndm you mean using IN against a subquery within a join?
# Jul 1st 2019, 13:40 dereuromark admad: that aint working in this case. it creates duplicates.
# Jul 1st 2019, 13:40 ndm @ionas it should
# Jul 1st 2019, 13:39 inoas ndm limit in innerjoin should work?
# Jul 1st 2019, 13:35 admad best it's best to do your stop in beforeMarshal and let normal patching process work
# Jul 1st 2019, 13:34 admad to avoid having them updated
# Jul 1st 2019, 13:34 admad might also need to clear dirty fields
# Jul 1st 2019, 13:34 dereuromark ah, or this: $joinData = $tag->_joinData; $tag = $existing; $tag->_joinData = $joinData; $entity->tags[$k] = $tag; ^^
# Jul 1st 2019, 13:33 admad @dereuromark set id field for the entity and set `isNew()` to false :slightly_smiling_face: