Inheritance: extends ZF\Rest\AbstractResourceListener, implements DoctrineModule\Persistence\ObjectManagerAwareInterface, implements Zend\EventManager\EventManagerAwareInterface, implements Zend\Stdlib\Hydrator\HydratorAwareInterface
Example #1
0
 /**
  * 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);
 }
Example #2
0
 /**
  * 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);
 }