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