Log message #4099503

# At Username Text
# Nov 29th 2017, 21:06 inoas well that first() is probably a collection method or so
# Nov 29th 2017, 21:06 inoas why the execute?
# Nov 29th 2017, 21:06 saeideng limit(1)->execute()->first() :slightly_smiling_face:
# Nov 29th 2017, 21:06 inoas or even run them in background mode to get 10 items and then cache them in the db to be consumed
# Nov 29th 2017, 21:06 inoas basically to make web services that return data faster
# Nov 29th 2017, 21:05 inoas I want to cache responses of Http\Client ... serialize a good thing?
# Nov 29th 2017, 21:05 saeideng inoas
# Nov 29th 2017, 21:05 saeideng https://api.cakephp.org/3.5/source-class-Cake.Datasource.QueryTrait.html#402-421
# Nov 29th 2017, 21:05 inoas saeideng you can use formatResults to get the first item only instead of list of 1 items
# Nov 29th 2017, 21:05 saeideng $query->select(['id', 'username'])->first();
# Nov 29th 2017, 21:04 inoas saeideng yeah true
# Nov 29th 2017, 21:04 joopm and in my case no other
# Nov 29th 2017, 21:04 joopm or is there sometinh like matching but returns only the first?
# Nov 29th 2017, 21:03 joopm and its part of a matching
# Nov 29th 2017, 21:03 joopm i want only the first one
# Nov 29th 2017, 21:02 saeideng this returns array of result
# Nov 29th 2017, 21:02 joopm but using ->first() there
# Nov 29th 2017, 21:02 joopm this is the condition for the query
# Nov 29th 2017, 21:02 joopm ->where(['AND'=>[['Applications.state_id'=>2],['user_id'=>$this->Auth->User('id')]]]) //here does not works first();}
# Nov 29th 2017, 21:02 joopm i know that first return result not query
# Nov 29th 2017, 21:01 joopm Query builder for association "Applications" did not return a query
# Nov 29th 2017, 21:01 saeideng first return result not query
# Nov 29th 2017, 21:01 joopm first would be good but its says no query return
# Nov 29th 2017, 21:00 saeideng first returns "item"
# Nov 29th 2017, 20:59 saeideng limit returns [0 => item]
# Nov 29th 2017, 20:59 saeideng limit and first different
# Nov 29th 2017, 20:58 saeideng inoas
# Nov 29th 2017, 20:55 inoas first() will execute which seems is not what you want (you want to return the query object)
# Nov 29th 2017, 20:55 inoas joopm limit(1)
# Nov 29th 2017, 20:55 saeideng or limit(1)
# Nov 29th 2017, 20:54 saeideng first()
# Nov 29th 2017, 20:54 obinoob joopm: you only need to save one registry right?
# Nov 29th 2017, 20:53 joopm but i dont need to get the first element of array i just need one element
# Nov 29th 2017, 20:53 saeideng and save with save entities()
# Nov 29th 2017, 20:53 saeideng create entity
# Nov 29th 2017, 20:53 joopm ->limit(1) would work
# Nov 29th 2017, 20:53 obinoob also here https://book.cakephp.org/3.0/en/orm/validation.html#using-different-validators-per-association
# Nov 29th 2017, 20:51 obinoob so i think I've found my answer https://book.cakephp.org/3.0/en/orm/saving-data.html#saving-associations
# Nov 29th 2017, 20:50 obinoob as my nick implies I am a noob ;)
# Nov 29th 2017, 20:50 joopm i only need this exactly
# Nov 29th 2017, 20:50 obinoob saeideng I am a "WIP" lol learning everything by my own I guess that would be easier to seat on a class room but not possible