# |
Dec 17th 2017, 20:25 |
saeideng |
I now want to complete this project |
# |
Dec 17th 2017, 20:25 |
saeideng |
not related :( |
# |
Dec 17th 2017, 20:24 |
joop |
$this->loadModel('Articles'); $list=$this->Articles->find('all')->where(['....'=>'popular']); |
# |
Dec 17th 2017, 20:22 |
saeideng |
and ->all() |
# |
Dec 17th 2017, 20:22 |
saeideng |
I check with/without toArray |
# |
Dec 17th 2017, 20:21 |
joop |
bacuse you put ->toArray() after it |
# |
Dec 17th 2017, 20:21 |
joop |
i would debug a the $list to see if it is correspond for entity |
# |
Dec 17th 2017, 20:15 |
saeideng |
thanks for your time |
# |
Dec 17th 2017, 20:13 |
joop |
there is nothing to say thanks we still not find solution |
# |
Dec 17th 2017, 20:12 |
saeideng |
https://github.com/cakephp/cakephp/issues/11556 |
# |
Dec 17th 2017, 20:12 |
saeideng |
thanks a lot |
# |
Dec 17th 2017, 20:12 |
joop |
excusme mister middle finger but i tried to help you |
# |
Dec 17th 2017, 20:07 |
saeideng |
see books sample :middle_finger: |
# |
Dec 17th 2017, 20:06 |
saeideng |
list of entity |
# |
Dec 17th 2017, 20:06 |
saeideng |
now |
# |
Dec 17th 2017, 20:04 |
joop |
i think that that patchEntities() first parameter is an entity |
# |
Dec 17th 2017, 20:04 |
joop |
okey open it |
# |
Dec 17th 2017, 20:04 |
saeideng |
I will open issue now |
# |
Dec 17th 2017, 20:02 |
saeideng |
// In a controller. $articles = TableRegistry::get('Articles'); $list = $articles->find('popular')->toArray(); $patched = $articles->patchEntities($list, $this->request->getData()); foreach ($patched as $entity) { $articles->save($entity); } |
# |
Dec 17th 2017, 20:02 |
saeideng |
book.cakephp.org says |
# |
Dec 17th 2017, 20:01 |
saeideng |
do you think my code syntax is true? |
# |
Dec 17th 2017, 20:01 |
saeideng |
``` $list=$this->Models->find()->toArray(); $list = $this->Models->patchEntities($list, [0=>['field'=>12]]);dd($list); ``` |
# |
Dec 17th 2017, 20:00 |
joop |
without this its hard to tell anything |
# |
Dec 17th 2017, 19:56 |
joop |
? |
# |
Dec 17th 2017, 19:56 |
joop |
okey lets again,how did you try to save? with foreach and save entity or withjust savemany entities |
# |
Dec 17th 2017, 19:55 |
saeideng |
debug();die; |
# |
Dec 17th 2017, 19:54 |
joop |
what is dd(...) i have never used this command |
# |
Dec 17th 2017, 19:54 |
saeideng |
:slightly_smiling_face: |
# |
Dec 17th 2017, 19:54 |
saeideng |
I pretty sure |
# |
Dec 17th 2017, 19:53 |
saeideng |
I can see records `$list=$this->Models->find();dd($list)` |
# |
Dec 17th 2017, 19:53 |
joop |
just for check the database entities |
# |
Dec 17th 2017, 19:53 |
joop |
i know its not related |
# |
Dec 17th 2017, 19:53 |
saeideng |
not related to DB |
# |
Dec 17th 2017, 19:52 |
joop |
do you have acces for database server? |
# |
Dec 17th 2017, 19:52 |
saeideng |
return new entity |
# |
Dec 17th 2017, 19:52 |
saeideng |
$list = $this->Models->patchEntities($list, [0=>['field'=>12]]);dd($list); |
# |
Dec 17th 2017, 19:52 |
joop |
are those created fresh? |
# |
Dec 17th 2017, 19:52 |
saeideng |
$this->Models->find() |
# |
Dec 17th 2017, 19:51 |
saeideng |
I have some record in DB |
# |
Dec 17th 2017, 19:51 |
joop |
same datas but different id-s |
# |
Dec 17th 2017, 19:51 |
joop |
i mean new instances |