public function &__get($key) { if (array_key_exists($key, $this->data)) { return $this->data[$key]; } try { list($key, $column) = $this->selection->getConnection()->getDatabaseReflection()->getBelongsToReference($this->selection->getName(), $key); $referenced = $this->getReference($key, $column); if ($referenced !== FALSE) { return $referenced; } } catch (ReflectionException $e) { } throw new UndeclaredColumnException("Cannot read an undeclared column '{$key}'."); }
/** * Creates filtered and grouped table representation. * @param Selection $refSelection * @param string database table name * @param string joining column */ public function __construct(Selection $refSelection, $table, $column) { $this->refSelection = $refSelection; $this->column = $column; parent::__construct($table, $refSelection->getConnection()); }