Log message #4170865

# At Username Text
# Oct 8th 2018, 21:00 rightscoreanalysis If i know the 'id' of PropertyPeriod:
# Oct 8th 2018, 20:14 rightscoreanalysis brb
# Oct 8th 2018, 20:13 rightscoreanalysis what I need is something like: $roomPricesByPeriod = $collection->groupBy('id'. 'start_date', 'end_date');
# Oct 8th 2018, 20:12 rightscoreanalysis $collection = new Collection($propertyTest); $roomPricesByPeriod = $collection->groupBy('id');
# Oct 8th 2018, 20:12 rightscoreanalysis so far I did this to group the ids which is what I need
# Oct 8th 2018, 20:11 rightscoreanalysis I just need to extract the start_date and end_date from each index and put it in the top level
# Oct 8th 2018, 20:11 rightscoreanalysis https://gist.github.com/spacebiscuit/dabfda259d39fd0cdcfc8032a3f58570
# Oct 8th 2018, 20:11 rightscoreanalysis @ricksaccous see this gist
# Oct 8th 2018, 20:09 rightscoreanalysis I tried to read the book... after a while all of the methods look the same and I can't differentiate one form the other
# Oct 8th 2018, 20:09 rightscoreanalysis yeah it looks super powerful
# Oct 8th 2018, 20:09 ricksaccous it changes your life
# Oct 8th 2018, 20:09 ricksaccous whatever you find works, but i'd recommend using collection magic
# Oct 8th 2018, 20:08 rightscoreanalysis I might try and just hack it with a foreach
# Oct 8th 2018, 20:08 ricksaccous is different than extract() via collection
# Oct 8th 2018, 20:08 ricksaccous prob should share exactly what you are trying to extract, it's worth mentioning the extract that EntityInterface implements
# Oct 8th 2018, 20:07 ricksaccous @rightscoreanalysis yeah i would think so :slightly_smiling_face:
# Oct 8th 2018, 20:01 rightscoreanalysis I am really stuck on something that really doesn't look to be difficult
# Oct 8th 2018, 20:00 rightscoreanalysis can i extraxt objects with collections?
# Oct 8th 2018, 19:24 ricksaccous oh, neat
# Oct 8th 2018, 19:14 beakman @nk-sonu There's also `->sql()`;
# Oct 8th 2018, 18:57 ricksaccous https://book.cakephp.org/3.0/en/orm/query-builder.html#selecting-rows-from-a-table
# Oct 8th 2018, 18:57 ricksaccous @nk-sonu If you try to call debug() on a Query object, you will see its internal state and the SQL that will be executed in the database:
# Oct 8th 2018, 18:48 nk-sonu because i can see its only giving object.. but i need mysql query like this "SELECT * from `seminars` where (DATE(specific_date) IN ('2018-10-24', '2018-10-25', '2018-10-29')) OR week_day IN (1,4,3,6)"
# Oct 8th 2018, 18:47 nk-sonu is there any way in cakephp 3 to print raw mysql from cakephp query ?
# Oct 8th 2018, 18:46 rightscoreanalysis sure: https://gist.github.com/spacebiscuit/92e6a99cd0cd45174f54b843660e2856
# Oct 8th 2018, 18:44 yuzl use pastebin/gist pls
# Oct 8th 2018, 18:44 rightscoreanalysis I want to extraxt the strat_date and and end_date and put them in an index below the top/main
# Oct 8th 2018, 18:43 slackebot <rightscoreanalysis>
# Oct 8th 2018, 18:43 rightscoreanalysis hi anyone able to help with this: my collection is in this format
# Oct 8th 2018, 18:39 yuzl someone here for help?
# Oct 8th 2018, 18:39 yuzl hi guys. i'm having some troubles saving associated data
# Oct 8th 2018, 18:34 beakman I know, I was building on top of your suggestion of using `IN`.
# Oct 8th 2018, 18:33 edgaras.jan you can't ``` 'OR' => [ 'DATE(specific_date)' => '2018-10-24', 'DATE(specific_date)' => '2018-10-24', ] ```
# Oct 8th 2018, 18:32 edgaras.jan yes, only there is problem when you need same field (array key), then you need use subarray
# Oct 8th 2018, 18:30 beakman I think the `'OR' => [...]` part is what he was looking for.
# Oct 8th 2018, 18:29 beakman ``` 'OR' => [ ['DATE(specific_date) IN ' => '2018-10-24', '2018-10-25], ['DATE(specific_date)' => '2018-10-24'], ['DATE(specific_date)' => '2018-10-24'], 'week_day IN' => [1,4,3,6], ] ```
# Oct 8th 2018, 18:28 edgaras.jan or if you wish first form ``` 'OR' => [ ['DATE(specific_date)' => '2018-10-24'], ['DATE(specific_date)' => '2018-10-24'], ['DATE(specific_date)' => '2018-10-24'], 'week_day IN' => [1,4,3,6], ] ```
# Oct 8th 2018, 18:25 edgaras.jan `SELECT * from `seminars` where (DATE(specific_date) IN ('2018-10-24', '2018-10-25', '2018-10-29')) OR week_day IN (1,4,3,6)`
# Oct 8th 2018, 18:25 nk-sonu in dated we can use IN ? @edgaras.jan
# Oct 8th 2018, 18:25 nk-sonu i am confused in "OR"
# Oct 8th 2018, 18:24 edgaras.jan use `IN`