protected function addGetLastVersions(&$script) { $versionTable = $this->behavior->getVersionTable(); $versionARClassname = $this->builder->getNewStubObjectBuilder($versionTable)->getClassname(); $versionForeignColumn = $versionTable->getColumn($this->behavior->getParameter('version_column')); $fks = $versionTable->getForeignKeysReferencingTable($this->table->getName()); $relCol = $this->builder->getRefFKPhpNameAffix($fks[0], $plural = true); $versionGetter = 'get' . $relCol; $versionPeerBuilder = $this->builder->getNewStubPeerBuilder($versionTable); $this->builder->declareClassFromBuilder($versionPeerBuilder); $versionPeer = $versionPeerBuilder->getClassname(); $script .= <<<EOF /** * retrieve the last \$number versions. * * @param integer \$number the number of record to return. * @param {$this->getVersionQueryClassName()}|Criteria \$criteria Additional criteria to filter. * @param PropelPDO \$con An optional connection to use. * * @return PropelCollection|{$versionARClassname}[] List of {$versionARClassname} objects */ public function getLastVersions(\$number = 10, \$criteria = null, PropelPDO \$con = null) { \$criteria = {$this->getVersionQueryClassName()}::create(null, \$criteria); \$criteria->addDescendingOrderByColumn({$versionPeer}::VERSION); \$criteria->limit(\$number); return \$this->{$versionGetter}(\$criteria, \$con); } EOF; }