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