# |
Dec 17th 2017, 19:48 |
saeideng |
but not related |
# |
Dec 17th 2017, 19:48 |
saeideng |
just there is a testCase for this |
# |
Dec 17th 2017, 19:47 |
saeideng |
I will open issue for this |
# |
Dec 17th 2017, 19:47 |
joop |
in my case i want to also update somefields, but it makes new entities insted of updateng the correspond fields |
# |
Dec 17th 2017, 19:46 |
saeideng |
with/without `toArray()` returns isNew() //true |
# |
Dec 17th 2017, 19:46 |
joop |
you will be amaezed but i face something similar too |
# |
Dec 17th 2017, 19:45 |
joop |
try to not make array from the $list |
# |
Dec 17th 2017, 19:44 |
joop |
aha |
# |
Dec 17th 2017, 19:44 |
saeideng |
update multi entities at one time |
# |
Dec 17th 2017, 19:44 |
joop |
and than you want to save where? |
# |
Dec 17th 2017, 19:44 |
joop |
you make a find to get the popular articles |
# |
Dec 17th 2017, 19:44 |
joop |
so lets clear the scenerio what is your goal? |
# |
Dec 17th 2017, 19:44 |
saeideng |
I think there is a bug |
# |
Dec 17th 2017, 19:43 |
saeideng |
and isNew() // true |
# |
Dec 17th 2017, 19:43 |
saeideng |
infact , returns new entity |
# |
Dec 17th 2017, 19:43 |
joop |
invalid result?which the list? |
# |
Dec 17th 2017, 19:42 |
saeideng |
not related to request |
# |
Dec 17th 2017, 19:42 |
saeideng |
returns invalid result |
# |
Dec 17th 2017, 19:41 |
saeideng |
I also check ``` $articles = TableRegistry::get('Articles'); $list = $articles->find('popular')->toArray(); $patched = $articles->patchEntities($list, $this->request->getData());dd($patched ); ``` |
# |
Dec 17th 2017, 19:41 |
joop |
can you see the debug/request window? |
# |
Dec 17th 2017, 19:41 |
joop |
whats the symtoms? |
# |
Dec 17th 2017, 19:41 |
saeideng |
not works |
# |
Dec 17th 2017, 19:40 |
joop |
than i think its easier to save many |
# |
Dec 17th 2017, 19:40 |
saeideng |
$list = $articles->find()->toArray(); |
# |
Dec 17th 2017, 19:40 |
saeideng |
no |
# |
Dec 17th 2017, 19:40 |
joop |
do you have mixed Models? |
# |
Dec 17th 2017, 19:39 |
saeideng |
I think I should use handy code here |
# |
Dec 17th 2017, 19:39 |
saeideng |
patchEntities not works correctly |
# |
Dec 17th 2017, 19:38 |
joop |
or you can use a foreach and save simple entity |
# |
Dec 17th 2017, 19:37 |
joop |
and not a simply entity |
# |
Dec 17th 2017, 19:37 |
joop |
you need to save the Entities |
# |
Dec 17th 2017, 19:37 |
saeideng |
how I can update multi entity ? |
# |
Dec 17th 2017, 19:35 |
joop |
ohm its seems i am the only one here in sunday evening |
# |
Dec 17th 2017, 19:34 |
joop |
i have Tests model with points field,and TestReviews model with fields: pointfrom and pointto |
# |
Dec 17th 2017, 19:30 |
joop |
i am stuck with custome validation role rule |
# |
Dec 17th 2017, 19:30 |
joop |
hello |
# |
Dec 17th 2017, 19:26 |
saeideng |
patchEntities |
# |
Dec 17th 2017, 19:26 |
saeideng |
I think there are bugs in this method |
# |
Dec 17th 2017, 19:19 |
saeideng |
this not works for me |
# |
Dec 17th 2017, 19:19 |
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, 18:44 |
saeideng |
:loudspeaker: |