/** * The returned array will contain objects of the default type or * objects that inherit from the default. * * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ public static function populateObjects(PDOStatement $stmt) { $typePosition = Ezer_PropelStepInstancePeer::translateFieldName(Ezer_PropelStepInstancePeer::TYPE, BasePeer::TYPE_COLNAME, BasePeer::TYPE_NUM); $results = array(); // populate the object(s) while ($row = $stmt->fetch(PDO::FETCH_NUM)) { $key = Ezer_PropelStepInstancePeer::getPrimaryKeyHashFromRow($row, 0); if (null !== ($obj = Ezer_PropelStepInstancePeer::getInstanceFromPool($key))) { // We no longer rehydrate the object, since this can cause data loss. // See http://propel.phpdb.org/trac/ticket/509 // $obj->hydrate($row, 0, true); // rehydrate $results[] = $obj; } else { $type = $row[$typePosition]; $obj = self::newStep($type); $obj->hydrate($row); $results[] = $obj; Ezer_PropelStepInstancePeer::addInstanceToPool($obj, $key); } // if key exists } $stmt->closeCursor(); return $results; }
/** * Retrieve a single object by pkey. * * @param string $pk the primary key. * @param PropelPDO $con the connection to use * @return Ezer_PropelStepInstance */ public static function retrieveByPK($pk, PropelPDO $con = null) { if (null !== ($obj = Ezer_PropelStepInstancePeer::getInstanceFromPool((string) $pk))) { return $obj; } if ($con === null) { $con = Propel::getConnection(Ezer_PropelStepInstancePeer::DATABASE_NAME, Propel::CONNECTION_READ); } $criteria = new Criteria(Ezer_PropelStepInstancePeer::DATABASE_NAME); $criteria->add(Ezer_PropelStepInstancePeer::ID, $pk); $v = Ezer_PropelStepInstancePeer::doSelect($criteria, $con); return !empty($v) > 0 ? $v[0] : null; }