You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 16, 2022. It is now read-only.
$result = $this->Machines->patchEntity($result, $data, ['associated' => ['MachineDocs']]);
if ($this->Machines->save($result)) {
$this->Flash->success(__('The {0} has been saved.', strtolower($this->name)));
if ($this->request->is('put')) $this->render; //de edit-view wordt opnieuw gerenderd
/*
* @todo
* de index-view renderen als deze pagina beschikbaar is.
*/
}
Problem
Al seems to work fine. The result with al the data is send to my database correctly, except for "source_dir", which stays empty.
debug
After patching the $data in the controller I get as $result:
When I look deeper into your code, I notice that there might be an issue with the method "beforeSave" in "ProfferBehavior.php".
Although $entity does have 'scource' as a field it never creates an seed for 'scource_dir' and won't save the file to the server, I think caused by the fact that $entity->get('scource') isn't an array.
How can I solve this?
Thanks in advance.
The text was updated successfully, but these errors were encountered:
I think you are setting a value in your post data because you've got a hidden input. This empty value might be overwriting the entity property when you patchEntity with the request data.
I've removed these lines. Even when de posted data doesn't contain the 'scource_dir' field, there is still no value in de saved record.
The problem, I think (when looking a bit deeper) is that in line 87 $entity->get($field)['error'] === UPLOAD_ERR_OK returns 'false' and even '$entity->get('error') === UPLOAD_ERR_OK' in elseif, so it's why '$this->process()' is skipped.
After passing line 87, directly true is returned (line 102)
So you're having a problem uploading a file to the server. Perhaps this could be a file system permissions issue? move_uploaded_file() would be a good test to ensure that PHP can write to your file system.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I'm using the Proffer plugin to upload several documents or pictures, linked to a machine.
In DocsTable I added:
Since Machines has a hasMany association, I added in MachinesTable:
In the form is I use this code:
In the controller there is
Problem
Al seems to work fine. The result with al the data is send to my database correctly, except for "source_dir", which stays empty.
debug
After patching the $data in the controller I get as $result:
When I look deeper into your code, I notice that there might be an issue with the method "beforeSave" in "ProfferBehavior.php".
Although $entity does have 'scource' as a field it never creates an seed for 'scource_dir' and won't save the file to the server, I think caused by the fact that $entity->get('scource') isn't an array.
How can I solve this?
Thanks in advance.
The text was updated successfully, but these errors were encountered: