main/app/API/Crud.php
public function replace($object, $property, $data, array $options = [])
    {
        $methodName = 'set'.ucfirst($property);

        if (!method_exists($object, $methodName)) {
            throw new \LogicException(
                sprintf('You have requested a non implemented action \'set\' on %s (looked for %s)', get_class($object), $methodName)
            );
        }

        //add the options to pass on here
        $this->checkPermission('PATCH', $object, [], true);
        //we'll need to pass the $action and $data here aswell later
        if ($this->dispatch('patch', 'pre', [$object, $options, $property, $data, self::PROPERTY_SET])) {
            $object->$methodName($data);

            $this->om->save($object);
            $this->dispatch('patch', 'post', [$object, $options, $property, $data, self::PROPERTY_SET]);
        }
    }
public function replace($object, $property, $data, array $options = [])
    {
        $methodName = 'set'.ucfirst($property);

        if (!method_exists($object, $methodName)) {
            throw new \LogicException(
                sprintf('You have requested a non implemented action \'set\' on %s (looked for %s)', get_class($object), $methodName)
            );
        }

        //add the options to pass on here
        $this->checkPermission('PATCH', $object, [], true);
        //we'll need to pass the $action and $data here aswell later
        if ($this->dispatch('patch', 'pre', [$object, $options, $property, $data, self::PROPERTY_SET])) {
            $object->$methodName($data);

            $this->om->save($object);
            $this->dispatch('patch', 'post', [$object, $options, $property, $data, self::PROPERTY_SET]);
        }
    }
public function replace ( $ object , $ property , $ data , array $ options = [ ] ) { $ methodName = 'set' . ucfirst ( $ property ) ; if ( ! method_exists ( $ object , $ methodName ) ) { throw new \ LogicException ( sprintf ( 'You have requested a non implemented action \'set\' on %s (looked for %s)' , get_class ( $ object ) , $ methodName ) ) ; } //add the options to pass on here $ this -> checkPermission ( 'PATCH' , $ object , [ ] , true ) ; //we'll need to pass the $action and $data here aswell later if ( $ this -> dispatch ( 'patch' , 'pre' , [ $ object , $ options , $ property , $ data , self :: PROPERTY_SET ] ) ) { $ object -> $ methodName ( $ data ) ; $ this -> om -> save ( $ object ) ; $ this -> dispatch ( 'patch' , 'post' , [ $ object , $ options , $ property , $ data , self :: PROPERTY_SET ] ) ; } }
Patches a property in `object`.

@param object $object   - the entity to update
@param string $property - the property to update
@param mixed  $data     - the data that must be set
@param array  $options  - an array of options
Patches a property in object .