Hi,
I’ve got a really weird bug. I analyzed all model and didn’t find where is this issue.
When I use patchentity, one the entity associated got a new empty item
$this->Kpiprofiles->patchEntity($kpiprofile, $this->request->data,[
'validate' => true,
'associated' => ['Teams','Kpitypes','Charts']
]);
This action add this entity to kpitypes object:
,
(int) 2 => object(App\Model\Entity\Kpitype) {
'[new]' => true,
'[accessible]' => [
'*' => true,
'id' => false,
'_joinData' => true
],
'[dirty]' => [],
'[original]' => [],
'[virtual]' => [],
'[errors]' => [],
'[invalid]' => [],
'[repository]' => 'Kpitypes'
I don’t understand why ? All models seems to be correct…and no errors from validators. Data stored into “this->request->data” are also correct…
So my workaround is to unset the last value (as it’s always empty) with:
unset($kpiprofile->kpitypes[count($kpiprofile->kpitypes)-1]);
Do you have any idea ?