mapValue() public method

Normally used by Doctrine for the mapping of aggregate values.
public mapValue ( string $name, mixed $value = null ) : void
$name string the name of the mapped value
$value mixed mixed value to be mapped
return void
Example #1
0
 /**
  * @param Doctrine_Record $record
  * @param mixed           $name
  * @param                 $value
  *
  * @return mixed
  * @throws Doctrine_Record_UnknownPropertyException
  */
 public function filterSet(Doctrine_Record $record, $name, $value)
 {
     $method = '_set' . ucfirst($name);
     if (method_exists($this, $method)) {
         $record->mapValue($name, $this->{$method}($record, $value));
         return $record->get($name);
     }
     throw new Doctrine_Record_UnknownPropertyException(sprintf('Unknown record property "%s" on "%s"', $name, get_class($record)));
 }
Example #2
0
 /**
  * Filters read access to the unknown property __META__.
  *
  * @param Doctrine_Record $record Record.
  * @param String          $name   Name of the unkown property.
  *
  * @return mixed
  * @throws Doctrine_Record_UnknownPropertyException If $name is not __META__.
  */
 public function filterGet(Doctrine_Record $record, $name)
 {
     if ($name == '__META__') {
         $value = new ArrayObject(array(), ArrayObject::ARRAY_AS_PROPS);
         $record->mapValue('__META__', $value);
         if ($record->state() == Doctrine_Record::STATE_CLEAN) {
             $record->state(Doctrine_Record::STATE_DIRTY);
         }
         return $value;
     } else {
         throw new Doctrine_Record_UnknownPropertyException(sprintf('Unknown record property / related component "%s" on "%s"', $name, get_class($record)));
     }
 }