コード例 #1
0
ファイル: BaseNoticiesPeer.php プロジェクト: nagiro/intra
 /**
  * Retrieve a single object by pkey.
  *
  * @param      int $pk the primary key.
  * @param      PropelPDO $con the connection to use
  * @return     Noticies
  */
 public static function retrieveByPK($pk, PropelPDO $con = null)
 {
     if (null !== ($obj = NoticiesPeer::getInstanceFromPool((string) $pk))) {
         return $obj;
     }
     if ($con === null) {
         $con = Propel::getConnection(NoticiesPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     }
     $criteria = new Criteria(NoticiesPeer::DATABASE_NAME);
     $criteria->add(NoticiesPeer::IDNOTICIA, $pk);
     $v = NoticiesPeer::doSelect($criteria, $con);
     return !empty($v) > 0 ? $v[0] : null;
 }