示例#1
0
 /**
  * Retrieve a single object by pkey.
  *
  * @param      int $pk the primary key.
  * @param      PropelPDO $con the connection to use
  * @return     sfAsset
  */
 public static function retrieveByPK($pk, PropelPDO $con = null)
 {
     if (null !== ($obj = sfAssetPeer::getInstanceFromPool((string) $pk))) {
         return $obj;
     }
     if ($con === null) {
         $con = Propel::getConnection(sfAssetPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     }
     $criteria = new Criteria(sfAssetPeer::DATABASE_NAME);
     $criteria->add(sfAssetPeer::ID, $pk);
     $v = sfAssetPeer::doSelect($criteria, $con);
     return !empty($v) > 0 ? $v[0] : null;
 }