public function setPropertyValue(&$entity, $field, $value)
    {
        $this->assertEntity($entity);

        if (is_array($entity) || $entity instanceof \ArrayAccess) {
            $entity[$field] = $value;

            return;
        }

        $ref = $this->getReflection($entity);
        if (!$ref->hasProperty($field)) {
            $entity->{$field} = $value;

            return;
        }

        $this->getProperty($ref, $field)->setValue($entity, $value);
    }
public function setPropertyValue(&$entity, $field, $value)
    {
        $this->assertEntity($entity);

        if (is_array($entity) || $entity instanceof \ArrayAccess) {
            $entity[$field] = $value;

            return;
        }

        $ref = $this->getReflection($entity);
        if (!$ref->hasProperty($field)) {
            $entity->{$field} = $value;

            return;
        }

        $this->getProperty($ref, $field)->setValue($entity, $value);
    }
public function setPropertyValue ( & $ entity , $ field , $ value ) { $ this -> assertEntity ( $ entity ) ; if ( is_array ( $ entity ) || $ entity instanceof \ ArrayAccess ) { $ entity [ $ field ] = $ value ; return ; } $ ref = $ this -> getReflection ( $ entity ) ; if ( ! $ ref -> hasProperty ( $ field ) ) { $ entity -> { $ field } = $ value ; return ; } $ this -> getProperty ( $ ref , $ field ) -> setValue ( $ entity , $ value ) ; }
Sets property value

@param array|object $entity
@param string       $field
@param mixed        $value

@throws AccessorException
Sets property value