/** * Magic method to access properties * * @param string $name * * @throws \InvalidArgumentException * @return mixed */ public function __get($name) { if (array_key_exists($name, $this->data)) { return $this->data[$name]; } else { $key = $this->tableGateway->column($name); if ($key && array_key_exists($key, $this->data)) { return $this->data[$key]; } throw new \InvalidArgumentException('Not a valid column in this row: ' . $name); } }