public function &__get($key) { $this->accessColumn($key); if (array_key_exists($key, $this->data)) { return $this->data[$key]; } try { list($table, $column) = $this->table->getConnection()->getDatabaseReflection()->getBelongsToReference($this->table->getName(), $key); $referenced = $this->getReference($table, $column); if ($referenced !== FALSE) { $this->accessColumn($key, FALSE); return $referenced; } } catch(NMissingReferenceException $e) {} $this->removeAccessColumn($key); throw new MemberAccessException("Cannot read an undeclared column \"$key\"."); }