/** Returns instances of the described class * initialized from the supplied PntQueryHandler * @return Array * @throws PntError */ function getPeanutsRunQueryHandler($qh, $sortPath=null) { $qh->runQuery(); $result = array(); while ($row=$qh->getAssocRow()) { $instance = $this->getDescribedClassInstanceForData($row, null); if (Gen::is_a($instance, 'PntError')) { $qh->release(); throw $instance; } $result[] = $instance; } $qh->release(); if ($sortPath === null) return $result; $nav = PntNavigation::getInstance($sortPath, $this->getName()); return PntNavigation::nav1Sort($result, $nav); } |