示例#1
0
 /**
  * Returns an array that can be used to describe the internal state of this
  * object.
  *
  * @return array
  */
 public function __debugInfo()
 {
     $conn = $this->connection();
     return ['registryAlias' => $this->registryAlias(), 'table' => $this->table(), 'alias' => $this->alias(), 'entityClass' => $this->entityClass(), 'associations' => $this->_associations->keys(), 'behaviors' => $this->_behaviors->loaded(), 'defaultConnection' => $this->defaultConnectionName(), 'connectionName' => $conn ? $conn->configName() : null];
 }
示例#2
0
 /**
  * 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));
 }