Closed anuj9196 closed 7 years ago
In some parts of my web application, I need to manually save field values.
On manual saving like
$updateFile = $this->PostVideos->newEntity(); $updateFile = $this->PostVideos->patchEntity($updateFile, [ 'video_file' => 'inspiration.mp4', 'dir' => 'new/path/to/video/file' ], [ 'validate' => false ]); debug($updateFile); if ($a = $this->PostVideos->save($updateFile)) { debug($a); }
All fields are saving except video_file. The field remains null
video_file
null
After removing behaviour
behaviour
$this->addBehavior('Josegonzalez/Upload.Upload', [ 'video_file' => [ 'path' => 'webroot{DS}files{DS}{model}{DS}{field}{DS}{microtime}{DS}', 'fields' => [ 'dir' => 'dir', // defaults to `dir` ], 'keepFilesOnDelete' => false, ], ]);
All works fine.
You could remove the behavior on the fly: https://book.cakephp.org/3.0/en/orm/behaviors.html#removing-loaded-behaviors
In some parts of my web application, I need to manually save field values.
On manual saving like
All fields are saving except
video_file
. The field remainsnull
After removing
behaviour
All works fine.