* @param PropelPDO $con * @return sfGuardUserGroup */ public static function retrieveByPK($user_id, $group_id, PropelPDO $con = null) { $key = serialize(array((string) $user_id, (string) $group_id)); if (null !== ($obj = sfGuardUserGroupPeer::getInstanceFromPool($key))) { return $obj; } if ($con === null) { $con = Propel::getConnection(sfGuardUserGroupPeer::DATABASE_NAME, Propel::CONNECTION_READ); } $criteria = new Criteria(sfGuardUserGroupPeer::DATABASE_NAME); $criteria->add(sfGuardUserGroupPeer::USER_ID, $user_id); $criteria->add(sfGuardUserGroupPeer::GROUP_ID, $group_id); $v = sfGuardUserGroupPeer::doSelect($criteria, $con); return !empty($v) ? $v[0] : null; } } // BasesfGuardUserGroupPeer // 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 sfGuardUserGroupPeer class, because it is not defined yet. // If you need to use overridden methods, you can add this code to the bottom of the sfGuardUserGroupPeer class: // // Propel::getDatabaseMap(sfGuardUserGroupPeer::DATABASE_NAME)->addTableBuilder(sfGuardUserGroupPeer::TABLE_NAME, sfGuardUserGroupPeer::getMapBuilder()); // // Doing so will effectively overwrite the registration below. Propel::getDatabaseMap(BasesfGuardUserGroupPeer::DATABASE_NAME)->addTableBuilder(BasesfGuardUserGroupPeer::TABLE_NAME, BasesfGuardUserGroupPeer::getMapBuilder());
$res = BasePeer::doValidate(sfGuardUserGroupPeer::DATABASE_NAME, sfGuardUserGroupPeer::TABLE_NAME, $columns); if ($res !== true) { $request = sfContext::getInstance()->getRequest(); foreach ($res as $failed) { $col = sfGuardUserGroupPeer::translateFieldname($failed->getColumn(), BasePeer::TYPE_COLNAME, BasePeer::TYPE_PHPNAME); $request->setError($col, $failed->getMessage()); } } return $res; } public static function retrieveByPK($user_id, $group_id, $con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } $criteria = new Criteria(); $criteria->add(sfGuardUserGroupPeer::USER_ID, $user_id); $criteria->add(sfGuardUserGroupPeer::GROUP_ID, $group_id); $v = sfGuardUserGroupPeer::doSelect($criteria, $con); return !empty($v) ? $v[0] : null; } } if (Propel::isInit()) { try { BasesfGuardUserGroupPeer::getMapBuilder(); } catch (Exception $e) { Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR); } } else { Propel::registerMapBuilder('plugins.sfGuardPlugin.lib.model.map.sfGuardUserGroupMapBuilder'); }