/** * Override parent so we can call getValues() to automatically rename uploaded file */ public function create($data) { $inputFilter = $this->getInputFilter(); $values = $inputFilter->getValues(); $data->filename = $values['filename']; return parent::create($data); }
/** * Patch (partial in-place update) a resource * * @param int $noteId * @param stdClass $data * @return ApiProblem|mixed */ public function patch($noteId, $data) { if (empty($data->userId) || !is_numeric($data->userId)) { return new ApiProblem(422, 'userId value missing'); } $this->setEntityIdentifierName('userId.noteId'); return parent::patch($data->userId . '.' . $noteId, $data); }