public function testGetHydrator() { $hydrator = new \ReflectionProperty('Database\\AbstractTable', '_hydrator'); $hydrator->setAccessible(true); $hydrator->setValue($this->_table, 'the hydrator'); $this->assertEquals('the hydrator', $this->_table->getHydrator()); }
/** * Sort results * * Default implementation: * - NULL: type specific default * - "id": item ID * - other: query table's hydrator for matching column name * * @param string $order Property to sort by * @param string $direction One of asc|desc */ public function order($order, $direction) { if (is_null($order)) { $tableClass = get_class($this->_table); $order = $this->_defaultOrder[substr($tableClass, strrpos($tableClass, '\\') + 1)]; } if ($order != 'id') { $order = $this->_table->getHydrator()->extractName($order); } $this->_select->order(array($this->_table->table . ".{$order}" => $direction)); }