Problem with patchEntity

hey any idea why patchEntity cant work with my data properly?

            $requestDatanew = [
                'title' => $requestData['title'] ?? null,
                'body' => $requestData['body'] ?? null,
            ];
            
            $article = $this->Articles->patchEntity($article, $requestDatanew, [
                'validate' => 'edit',
                 'accessibleFields' => array_fill_keys(array_keys($requestDatanew), true)
            ]);
            

also not with an assassociated table…

            if (isset($requestData['farms'])) {
    $requestDatanew['farms'] = [];
    
    foreach ($requestData['farms'] as $key => $farm) {
        $requestDatanew['farms'][$key] = [
            'id' => $farm['id'] ?? null,  
            'active' => $farm['active'] ?? null, 
            'title' => $farm['title'] ?? null,

        ];
    }
}


$article = $this->Articles->patchEntity($article, $requestDatanew, [
    'validate' => 'editc',
    'associated' => [
        'Farms' => [
            'accessibleFields' => array_fill_keys(array_keys($requestDatanew['farms'][0] ?? []), true)
        ]
    ]
]);

idea? best,

can you provide more details and show some more code?

i guess its all you need…

What does “can’t work” mean?

it means no changes on that object after i do the patchentity

Are there validation errors? A dump of what $article contains after the patch would be useful.

hey, i have no idea why but know its working fine…

Might have been a model cache issue.