/**
  * Pass view binding methods to the ViewBinder instance
  *
  * @param string $methodName The called method name
  * @param array $arguments The called method arguments
  *
  * @return mixed The return value from the ViewBinder method
  *
  * @throws \BadMethodCallException If the method does not exist in the
  * ViewBinder instance
  */
 public function __call($methodName, $arguments)
 {
     $method = DynamicMethod::load($methodName);
     if ($method->existsOn($this->viewBinder)) {
         return $method->callOn($this->viewBinder, $arguments);
     }
     return parent::__call($methodName, $arguments);
 }
 /**
  * Calls each of the repository binding methods
  *
  * @return void
  *
  * @throws \RuntimeException If the repository binding method does not
  * define an interface to bind the concrete repository instance to
  */
 protected function callRepositoryBindingMethods()
 {
     $classMethods = get_class_methods($this);
     foreach ($classMethods as $methodName) {
         $method = DynamicMethod::parse($methodName);
         if ($method->startsWith('bind') && $method->endsWith('Repository')) {
             $this->registerRepository($method->invokeOn($this));
         }
     }
 }
Пример #3
0
 /**
  * Proxy dynamic method calls to criteria methods
  *
  * @param string $methodName The called method name
  * @param array  $arguments  The called method arguments
  *
  * @return $this|null The current Repository instance for method chaining
  *
  * @throws \BadMethodCallException If the method does not exist in the
  * repository
  */
 public function __call($methodName, array $arguments)
 {
     $method = DynamicMethod::load($methodName)->append('Criterion');
     if ($method->existsOn($this)) {
         return $this->addCriterion($method, $arguments);
     }
     $method->pop()->append('Criteria');
     if ($method->existsOn($this)) {
         return $this->addCriterion($method, $arguments);
     }
     $className = get_class($this);
     $method->throwException("The criterion method [{$method}Criterion] does not exist on " . "{$className}.");
 }