Log message #4170936

# At Username Text
# Oct 8th 2018, 22:19 rightscoreanalysis either the book is not very well written or I am lacking
# Oct 8th 2018, 22:19 rightscoreanalysis $result = Hash::remove($propertyPeriods, '{n}.[0].Data');
# Oct 8th 2018, 22:19 rightscoreanalysis why does this not shift the array up one index?
# Oct 8th 2018, 22:08 rightscoreanalysis man alive this is challenging
# Oct 8th 2018, 21:57 rightscoreanalysis actually I don't think the Hash class will work in this case
# Oct 8th 2018, 21:53 rightscoreanalysis that what I was thinking
# Oct 8th 2018, 21:53 dereuromark also Hash::extract, combine etc can help here
# Oct 8th 2018, 21:52 dereuromark instead, if you need, assign it to a different array.
# Oct 8th 2018, 21:52 dereuromark dont do these kind of things
# Oct 8th 2018, 21:51 rightscoreanalysis removing the [0] index from an array's index
# Oct 8th 2018, 21:50 rightscoreanalysis foreach($propertyPeriods as and$period) { $period = $period[0]; }
# Oct 8th 2018, 21:50 rightscoreanalysis is there a cake shorthand way to do this
# Oct 8th 2018, 21:21 dereuromark foreach over it
# Oct 8th 2018, 21:20 rightscoreanalysis back to the drawing board :slightly_smiling_face:
# Oct 8th 2018, 21:17 rightscoreanalysis my known is the id - 103
# Oct 8th 2018, 21:17 rightscoreanalysis 0 in an unknown
# Oct 8th 2018, 21:17 rightscoreanalysis I have to use $property->property_periods[0] to gain access to the entity that has id 103
# Oct 8th 2018, 21:16 rightscoreanalysis but if in my template my date is in the var: $property->property_periods
# Oct 8th 2018, 21:14 dereuromark you probably are.
# Oct 8th 2018, 21:14 rightscoreanalysis i guess I am over-complicating this
# Oct 8th 2018, 21:13 rightscoreanalysis I want to select the object by an id
# Oct 8th 2018, 21:13 rightscoreanalysis yeah so I have an entity with 5 objects
# Oct 8th 2018, 21:12 dereuromark but that is still the same entity
# Oct 8th 2018, 21:12 rightscoreanalysis the entity is got through a contain on the sql query
# Oct 8th 2018, 21:11 dereuromark you dont do this on the entity, this is a DTO, nothing else
# Oct 8th 2018, 21:11 dereuromark also, you need to understand the basic ORM concepts. You can do get($id) on the table and then get the entity
# Oct 8th 2018, 21:11 dereuromark you got the entity, why do you want it again?
# Oct 8th 2018, 21:10 rightscoreanalysis there must be something similar in Cake?
# Oct 8th 2018, 21:10 rightscoreanalysis I know that in Magento for example you can get by id on an object
# Oct 8th 2018, 21:09 rightscoreanalysis in the above case 103
# Oct 8th 2018, 21:09 dereuromark ->id ?
# Oct 8th 2018, 21:01 rightscoreanalysis can do do something like $propertyPeriod->getId(103)
# Oct 8th 2018, 21:00 rightscoreanalysis [ (int) 0 => object(App\Model\Entity\PropertyPeriod) { 'id' => (int) 103, 'property_id' => (int) 51, 'start_date' => object(Cake\I18n\FrozenTime) {
# 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