* @param PropelPDO $con the connection to use * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ public static function retrieveByPKs($pks, PropelPDO $con = null) { if ($con === null) { $con = Propel::getConnection(CityPeer::DATABASE_NAME, Propel::CONNECTION_READ); } $objs = null; if (empty($pks)) { $objs = array(); } else { $criteria = new Criteria(CityPeer::DATABASE_NAME); $criteria->add(CityPeer::ID, $pks, Criteria::IN); $objs = CityPeer::doSelect($criteria, $con); } return $objs; } } // BaseCityPeer // This is the static code needed to register the MapBuilder for this table with the main Propel class. // // NOTE: This static code cannot call methods on the CityPeer class, because it is not defined yet. // If you need to use overridden methods, you can add this code to the bottom of the CityPeer class: // // Propel::getDatabaseMap(CityPeer::DATABASE_NAME)->addTableBuilder(CityPeer::TABLE_NAME, CityPeer::getMapBuilder()); // // Doing so will effectively overwrite the registration below. Propel::getDatabaseMap(BaseCityPeer::DATABASE_NAME)->addTableBuilder(BaseCityPeer::TABLE_NAME, BaseCityPeer::getMapBuilder());
$criteria = new Criteria(CityPeer::DATABASE_NAME); $criteria->add(CityPeer::ID, $pk); $v = CityPeer::doSelect($criteria, $con); return !empty($v) > 0 ? $v[0] : null; } public static function retrieveByPKs($pks, $con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } $objs = null; if (empty($pks)) { $objs = array(); } else { $criteria = new Criteria(); $criteria->add(CityPeer::ID, $pks, Criteria::IN); $objs = CityPeer::doSelect($criteria, $con); } return $objs; } } if (Propel::isInit()) { try { BaseCityPeer::getMapBuilder(); } catch (Exception $e) { Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR); } } else { require_once 'lib/model/map/CityMapBuilder.php'; Propel::registerMapBuilder('lib.model.map.CityMapBuilder'); }