protected function setIfDefined($object, $field)
    {
        $propertyAccessor = $this->getPropertyAccessor();
        if (!$this->_has($field)) {
            return $propertyAccessor->isReadable($object, $field) ?
                $propertyAccessor->getValue($object, $field) :
                null
            ;
        }

        $propertyAccessor->setValue(
            $object,
            $field,
            $value = $this->_get($field)
        );

        return $value;
    }
protected function setIfDefined($object, $field)
    {
        $propertyAccessor = $this->getPropertyAccessor();
        if (!$this->_has($field)) {
            return $propertyAccessor->isReadable($object, $field) ?
                $propertyAccessor->getValue($object, $field) :
                null
            ;
        }

        $propertyAccessor->setValue(
            $object,
            $field,
            $value = $this->_get($field)
        );

        return $value;
    }
protected function setIfDefined ( $ object , $ field ) { $ propertyAccessor = $ this -> getPropertyAccessor ( ) ; if ( ! $ this -> _has ( $ field ) ) { return $ propertyAccessor -> isReadable ( $ object , $ field ) ? $ propertyAccessor -> getValue ( $ object , $ field ) : null ; } $ propertyAccessor -> setValue ( $ object , $ field , $ value = $ this -> _get ( $ field ) ) ; return $ value ; }
Define given field on given object, if accessible

@param mixed  $object
@param string $field

@return mixed|null
Define given field on given object if accessible