reference() public method

gets a related component
public reference ( string $name ) : Doctrine_Record | Doctrine_Collection
$name string
return Doctrine_Record | Doctrine_Collection
Esempio n. 1
0
 /**
  * filterGet
  * defines an implementation for filtering the get() method of Doctrine_Record
  *
  * @param mixed $name                       name of the property or related component
  */
 public function filterGet(Doctrine_Record $record, $name)
 {
     foreach ($this->_aliases as $alias) {
         if (!$record->exists()) {
             if (isset($record[$alias][$name])) {
                 return $record[$alias][$name];
             }
         } else {
             // we do not want to execute N + 1 queries here, hence we cannot use get()
             if (($ref = $record->reference($alias)) !== null) {
                 if (isset($ref[$name])) {
                     return $ref[$name];
                 }
             }
         }
     }
 }