示例#1
0
 /**
 * Retrieve object using using composite pkey values.
 * @param      int $person_id
   @param      int $role_id
   
 * @param      PropelPDO $con
 * @return     PersonRole
 */
 public static function retrieveByPK($person_id, $role_id, PropelPDO $con = null)
 {
     $key = serialize(array((string) $person_id, (string) $role_id));
     if (null !== ($obj = PersonRolePeer::getInstanceFromPool($key))) {
         return $obj;
     }
     if ($con === null) {
         $con = Propel::getConnection(PersonRolePeer::DATABASE_NAME, Propel::CONNECTION_READ);
     }
     $criteria = new Criteria(PersonRolePeer::DATABASE_NAME);
     $criteria->add(PersonRolePeer::PERSON_ID, $person_id);
     $criteria->add(PersonRolePeer::ROLE_ID, $role_id);
     $v = PersonRolePeer::doSelect($criteria, $con);
     return !empty($v) ? $v[0] : null;
 }