function __call($method, $args) { if ($this->connection) { return call_user_func_array(array($this->connection, $method), $args); } undefined_method($method, get_called_class()); }
public function __call($method, $args) { // Look up relationships in the cache if (preg_match('/^get(.+)/', $method, $matches)) { $key = strtolower($matches[1]); if (isset($this->relations[$key])) { return $this->getRelationship($key); } } undefined_method($method, get_called_class()); }