Example #1
0
     * @param      PropelPDO $con the connection to use
     * @throws     PropelException Any exceptions caught during processing will be
     *		 rethrown wrapped into a PropelException.
     */
    public static function retrieveByPKs($pks, PropelPDO $con = null)
    {
        if ($con === null) {
            $con = Propel::getConnection(PermissionPeer::DATABASE_NAME, Propel::CONNECTION_READ);
        }
        $objs = null;
        if (empty($pks)) {
            $objs = array();
        } else {
            $criteria = new Criteria(PermissionPeer::DATABASE_NAME);
            $criteria->add(PermissionPeer::ID, $pks, Criteria::IN);
            $objs = PermissionPeer::doSelect($criteria, $con);
        }
        return $objs;
    }
}
// BasePermissionPeer
// 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 PermissionPeer class, because it is not defined yet.
// If you need to use overridden methods, you can add this code to the bottom of the PermissionPeer class:
//
// Propel::getDatabaseMap(PermissionPeer::DATABASE_NAME)->addTableBuilder(PermissionPeer::TABLE_NAME, PermissionPeer::getMapBuilder());
//
// Doing so will effectively overwrite the registration below.
Propel::getDatabaseMap(BasePermissionPeer::DATABASE_NAME)->addTableBuilder(BasePermissionPeer::TABLE_NAME, BasePermissionPeer::getMapBuilder());
    * @param      Connection $con
    * @return     Permission
    */
    public static function retrieveByPK($user_id, $room_id, $con = null)
    {
        if ($con === null) {
            $con = Propel::getConnection(self::DATABASE_NAME);
        }
        $criteria = new Criteria();
        $criteria->add(PermissionPeer::USER_ID, $user_id);
        $criteria->add(PermissionPeer::ROOM_ID, $room_id);
        $v = PermissionPeer::doSelect($criteria, $con);
        return !empty($v) ? $v[0] : null;
    }
}
// BasePermissionPeer
// static code to register the map builder for this Peer with the main Propel class
if (Propel::isInit()) {
    // the MapBuilder classes register themselves with Propel during initialization
    // so we need to load them here.
    try {
        BasePermissionPeer::getMapBuilder();
    } catch (Exception $e) {
        Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR);
    }
} else {
    // even if Propel is not yet initialized, the map builder class can be registered
    // now and then it will be loaded when Propel initializes.
    require_once 'src/model/whiteboard/map/PermissionMapBuilder.php';
    Propel::registerMapBuilder('src/model/whiteboard.map.PermissionMapBuilder');
}