It seems that the only way is to change column schema type from 'date' to 'string'.
Maybe could be a good idea to have a function to do such changes on an easy way. El miércoles, 13 de mayo de 2015, 21:33:08 (UTC+1), Aday Talavera escribió: > > First off, sorry for the "question spam". I'm just posting all issues of > the last two weeks in a short period of time. I hope that this isn't > disturbing anyone. > > While trying to figure how to use combine with collections and entities > (is in other thread) I didn't found an easy way to avoid date / datetime > fields of DB been converted to Time instances. > > $query->hydrate(false); > > Didn't work, date / datetime field is also converted to a Cake/Time > instance > > There exists an easy way to avoid that conversion? > > I was forced to do something like this in the collection to use combine or > indexBy groupBy collection functions with date fields: > > ->each(function ($entity){ > $entity->dateStr = $entity->date->toDateString(); > return $entity; > }) > ->combine('dateStr', 'id') > ->indexBy('dateStr') > ->GroupBy('dateStr') > > Cheers. > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.