/** * Handles behavior delegation + dynamic finders. * * If your Table uses any behaviors you can call them as if * they were on the table object. * * @param string $method name of the method to be invoked * @param array $args List of arguments passed to the function * @return mixed * @throws \BadMethodCallException */ public function __call($method, $args) { if ($this->_behaviors && $this->_behaviors->hasMethod($method)) { return $this->_behaviors->call($method, $args); } if (preg_match('/^find(?:\\w+)?By/', $method) > 0) { return $this->_dynamicFinder($method, $args); } throw new \BadMethodCallException(sprintf('Unknown method "%s"', $method)); }