Doctrine\OXM\Mapping\MappingException::fieldSetMethodDoesNotExist PHP Method

fieldSetMethodDoesNotExist() public static method

public static fieldSetMethodDoesNotExist ( $className, $fieldName, $setMethod )
    public static function fieldSetMethodDoesNotExist($className, $fieldName, $setMethod)
    {
        return new self("The set method '{$setMethod}' on class '{$className}' for field '{$fieldName}' does not exist");
    }

Usage Example

Esempio n. 1
0
 /**
  * Sets the specified field to the specified value on the given entity.
  *
  * @param object $entity
  * @param string $fieldName
  * @param mixed $value
  */
 public function setFieldValue($entity, $fieldName, $value)
 {
     if ($this->fieldMappings[$fieldName]['direct']) {
         $this->reflFields[$fieldName]->setValue($entity, $value);
     } else {
         if (!array_key_exists('setMethod', $this->fieldMappings[$fieldName])) {
             $this->fieldMappings[$fieldName]['setMethod'] = $this->inferSetter($fieldName);
         }
         $setter = $this->fieldMappings[$fieldName]['setMethod'];
         if ($this->reflClass->hasMethod($setter)) {
             return call_user_func(array($entity, $setter), $value);
         } else {
             throw MappingException::fieldSetMethodDoesNotExist($this->name, $fieldName, $setter);
         }
     }
 }