# |
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 |
# |
Nov 29th 2017, 20:49 |
joopm |
->where(['AND'=>[['Applications.state_id'=>2],['user_id'=>$this->Auth->User('id')]]]) //here does not works first();} |
# |
Nov 29th 2017, 20:49 |
joopm |
{return $q |
# |
Nov 29th 2017, 20:49 |
saeideng |
`$conn->execute('INSERT into addresses ` |
# |
Nov 29th 2017, 20:49 |
joopm |
do you that how can i get the first result from the following querry |
# |
Nov 29th 2017, 20:48 |
joopm |
good evening to all community members |
# |
Nov 29th 2017, 20:48 |
saeideng |
obinoob |
# |
Nov 29th 2017, 20:48 |
obinoob |
are your sure? |
# |
Nov 29th 2017, 20:47 |
saeideng |
why you use cake ? |
# |
Nov 29th 2017, 20:47 |
obinoob |
yes I'm not escaping content etc not for the time being anyways |
# |
Nov 29th 2017, 20:45 |
inoas |
because sqlinject ,-)? |
# |
Nov 29th 2017, 20:44 |
inoas |
neothermic heh |
# |
Nov 29th 2017, 20:44 |
dereuromark |
hopefully this is an admin only function :slightly_smiling_face: |
# |
Nov 29th 2017, 20:40 |
obinoob |
perhaps I can better illustrate my case with code, eventually my aim is to replace the current code with the use of entity class objects: https://gist.github.com/obinoob/1baf3af92c689b746a0ed824d57746fe |
# |
Nov 29th 2017, 20:38 |
obinoob |
I wonder if it is possible to insert data into multiple tables at once using entity dot notation (after set associations between entities) or do I still need one entity object for each entry? |
# |
Nov 29th 2017, 20:07 |
neothermic |
@ionas, yeah both, both are doing it wrong :P |
# |
Nov 29th 2017, 19:25 |
inoas |
cause that's what I fetched with i18n extract |
# |
Nov 29th 2017, 19:25 |
inoas |
is this still working? __d('cake', 'on %s'), |