示例#1
0
文件: Repository.php 项目: clevis/orm
 /**
  * Call to undefined method.
  * @param string method name
  * @param array arguments
  * @return mixed
  * @throws MemberAccessException
  */
 public function __call($name, $args)
 {
     if ($this->mapperAutoCaller === NULL) {
         $this->mapperAutoCaller = new MapperAutoCaller($this, $this->getModel()->getContext()->getService('annotationsParser'));
     }
     if ($this->mapperAutoCaller->has($name)) {
         return call_user_func_array(array($this->getMapper(), $name), $args);
     }
     return parent::__call($name, $args);
 }
 /**
  * Vola automaticky findBy* a getBy*
  * <code>
  * 	$collection->findByAuthor(3);
  * 	// stejne jako
  * 	$collection->findBy(array('author' => 3));
  *
  * 	$collection->findByAuthorAndCategory(3, 'foo');
  * 	// stejne jako
  * 	$collection->findBy(array('author' => 3, 'category' => 'foo'));
  * </code>
  * @see self::findBy();
  * @see self::getBy();
  * @param string
  * @param array
  * @throws MemberAccessException
  * @return ArrayCollection|IEntity|NULL
  */
 public final function __call($name, $args)
 {
     if (!method_exists($this, $name) and FindByHelper::parse($name, $args)) {
         return $this->{$name}($args);
     }
     return parent::__call($name, $args);
 }
示例#3
0
文件: Mapper.php 项目: clevis/orm
 /**
  * Vola automaticky findBy* a getBy*
  * <code>
  * 	$mapper->findByAuthor(3);
  * 	// stejne jako
  * 	$mapper->findBy(array('author' => 3));
  *
  * 	$mapper->findByAuthorAndCategory(3, 'foo');
  * 	// stejne jako
  * 	$mapper->findBy(array('author' => 3, 'category' => 'foo'));
  * </code>
  * @see self::findBy();
  * @see self::getBy();
  * @param string
  * @param array
  * @throws MemberAccessException
  * @return IEntityCollection|IEntity|NULL
  */
 public function __call($name, $args)
 {
     if (!method_exists($this, $name)) {
         if (strncasecmp($name, 'findBy', 6) === 0 or strncasecmp($name, 'getBy', 5) === 0) {
             return call_user_func_array(array($this->findAll(), $name), $args);
         }
     }
     return parent::__call($name, $args);
 }