Ejemplo n.º 1
0
 /**
  * This, in addition to EMongoModels edition, will also call scopes on the model
  * @see EMongoModel::__call()
  * @param string $name
  * @param array $parameters
  * @return EMongoDocument|mixed
  */
 public function __call($name, $parameters)
 {
     if (array_key_exists($name, $this->relations())) {
         if (empty($parameters)) {
             return $this->getRelated($name, false);
         }
         return $this->getRelated($name, false, $parameters[0]);
     }
     $scopes = $this->scopes();
     if (isset($scopes[$name])) {
         $this->getDbCriteria()->mergeWith($scopes[$name]);
         return $this;
     }
     return parent::__call($name, $parameters);
 }