Example #1
0
 /**
  * Called when a magic method that is normally only accessible from a specially
  * constructed join query is called, e.g. $course->getSchoolBId()
  */
 public function __call($name, $args)
 {
     // query results are also Spiderable objects
     if ($this->isQueryResult) {
         return parent::__call($name, $args);
     } else {
         try {
             return parent::__call($name, $args);
         } catch (PropelException $e) {
             $includeMetadata = $name == 'Name' || $name == 'Professor' || $name == 'NbCampuses' || $name == 'IsCurrentTerm';
             return call_user_func_array(array($this->getJoinedQueryResult($includeMetadata), $name), $args);
         }
     }
 }
Example #2
0
 /**
  * Catches calls to virtual methods
  */
 public function __call($name, $params)
 {
     // symfony_behaviors behavior
     if ($callable = sfMixer::getCallable('BaseCountry:' . $name)) {
         array_unshift($params, $this);
         return call_user_func_array($callable, $params);
     }
     return parent::__call($name, $params);
 }
 /**
  * Catches calls to virtual methods
  */
 public function __call($name, $params)
 {
     if (preg_match('/get(\\w+)/', $name, $matches)) {
         $virtualColumn = $matches[1];
         if ($this->hasVirtualColumn($virtualColumn)) {
             return $this->getVirtualColumn($virtualColumn);
         }
         // no lcfirst in php<5.3...
         $virtualColumn[0] = strtolower($virtualColumn[0]);
         if ($this->hasVirtualColumn($virtualColumn)) {
             return $this->getVirtualColumn($virtualColumn);
         }
     }
     return parent::__call($name, $params);
 }