<?php

/**
 * Base static class for performing query and update operations on the 'katao_member' table.
 *
 * 
 *
 * @package    lib.model.om
 */
abstract class BaseKataoMemberPeer {

	/** the default database name for this class */
	const DATABASE_NAME = 'propel';

	/** the table name for this class */
	const TABLE_NAME = 'katao_member';

	/** A class that can be returned by this peer. */
	const CLASS_DEFAULT = 'lib.model.KataoMember';

	/** The total number of columns. */
	const NUM_COLUMNS = 21;

	/** The number of lazy-loaded columns. */
	const NUM_LAZY_LOAD_COLUMNS = 0;


	/** the column name for the ID field */
	const ID = 'katao_member.ID';

	/** the column name for the KATAO_INDEX field */
	const KATAO_INDEX = 'katao_member.KATAO_INDEX';

	/** the column name for the KATAO_NODE_ID field */
	const KATAO_NODE_ID = 'katao_member.KATAO_NODE_ID';

	/** the column name for the NEXT_KATAO_NODE_ID field */
	const NEXT_KATAO_NODE_ID = 'katao_member.NEXT_KATAO_NODE_ID';

	/** the column name for the KATAO_MEMBER_ID field */
	const KATAO_MEMBER_ID = 'katao_member.KATAO_MEMBER_ID';

	/** the column name for the FIRST_NAME field */
	const FIRST_NAME = 'katao_member.FIRST_NAME';

	/** the column name for the LAST_NAME field */
	const LAST_NAME = 'katao_member.LAST_NAME';

	/** the column name for the ACCOUNTING_CODE field */
	const ACCOUNTING_CODE = 'katao_member.ACCOUNTING_CODE';

	/** the column name for the ACCOUNTING_CODE_SOL field */
	const ACCOUNTING_CODE_SOL = 'katao_member.ACCOUNTING_CODE_SOL';

	/** the column name for the INITIAL_AMOUNT_EURO field */
	const INITIAL_AMOUNT_EURO = 'katao_member.INITIAL_AMOUNT_EURO';

	/** the column name for the INITIAL_AMOUNT_SOL field */
	const INITIAL_AMOUNT_SOL = 'katao_member.INITIAL_AMOUNT_SOL';

	/** the column name for the IS_REFERER field */
	const IS_REFERER = 'katao_member.IS_REFERER';

	/** the column name for the IS_DELEGATE field */
	const IS_DELEGATE = 'katao_member.IS_DELEGATE';

	/** the column name for the IS_ANONYMOUS field */
	const IS_ANONYMOUS = 'katao_member.IS_ANONYMOUS';

	/** the column name for the IS_MEMBER field */
	const IS_MEMBER = 'katao_member.IS_MEMBER';

	/** the column name for the CARD_NUMBER_SOL field */
	const CARD_NUMBER_SOL = 'katao_member.CARD_NUMBER_SOL';

	/** the column name for the USER_SITUATION field */
	const USER_SITUATION = 'katao_member.USER_SITUATION';

	/** the column name for the USER_BIRTHDAY field */
	const USER_BIRTHDAY = 'katao_member.USER_BIRTHDAY';

	/** the column name for the PARRAIN_NAME field */
	const PARRAIN_NAME = 'katao_member.PARRAIN_NAME';

	/** the column name for the CREATED_AT field */
	const CREATED_AT = 'katao_member.CREATED_AT';

	/** the column name for the UPDATED_AT field */
	const UPDATED_AT = 'katao_member.UPDATED_AT';

	/** The PHP to DB Name Mapping */
	private static $phpNameMap = null;


	/**
	 * holds an array of fieldnames
	 *
	 * first dimension keys are the type constants
	 * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
	 */
	private static $fieldNames = array (
		BasePeer::TYPE_PHPNAME => array ('Id', 'KataoIndex', 'KataoNodeId', 'NextKataoNodeId', 'KataoMemberId', 'FirstName', 'LastName', 'AccountingCode', 'AccountingCodeSol', 'InitialAmountEuro', 'InitialAmountSol', 'IsReferer', 'IsDelegate', 'IsAnonymous', 'IsMember', 'CardNumberSol', 'UserSituation', 'UserBirthday', 'ParrainName', 'CreatedAt', 'UpdatedAt', ),
		BasePeer::TYPE_COLNAME => array (KataoMemberPeer::ID, KataoMemberPeer::KATAO_INDEX, KataoMemberPeer::KATAO_NODE_ID, KataoMemberPeer::NEXT_KATAO_NODE_ID, KataoMemberPeer::KATAO_MEMBER_ID, KataoMemberPeer::FIRST_NAME, KataoMemberPeer::LAST_NAME, KataoMemberPeer::ACCOUNTING_CODE, KataoMemberPeer::ACCOUNTING_CODE_SOL, KataoMemberPeer::INITIAL_AMOUNT_EURO, KataoMemberPeer::INITIAL_AMOUNT_SOL, KataoMemberPeer::IS_REFERER, KataoMemberPeer::IS_DELEGATE, KataoMemberPeer::IS_ANONYMOUS, KataoMemberPeer::IS_MEMBER, KataoMemberPeer::CARD_NUMBER_SOL, KataoMemberPeer::USER_SITUATION, KataoMemberPeer::USER_BIRTHDAY, KataoMemberPeer::PARRAIN_NAME, KataoMemberPeer::CREATED_AT, KataoMemberPeer::UPDATED_AT, ),
		BasePeer::TYPE_FIELDNAME => array ('id', 'katao_index', 'katao_node_id', 'next_katao_node_id', 'katao_member_id', 'first_name', 'last_name', 'accounting_code', 'accounting_code_sol', 'initial_amount_euro', 'initial_amount_sol', 'is_referer', 'is_delegate', 'is_anonymous', 'is_member', 'card_number_sol', 'user_situation', 'user_birthday', 'parrain_name', 'created_at', 'updated_at', ),
		BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, )
	);

	/**
	 * holds an array of keys for quick access to the fieldnames array
	 *
	 * first dimension keys are the type constants
	 * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
	 */
	private static $fieldKeys = array (
		BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'KataoIndex' => 1, 'KataoNodeId' => 2, 'NextKataoNodeId' => 3, 'KataoMemberId' => 4, 'FirstName' => 5, 'LastName' => 6, 'AccountingCode' => 7, 'AccountingCodeSol' => 8, 'InitialAmountEuro' => 9, 'InitialAmountSol' => 10, 'IsReferer' => 11, 'IsDelegate' => 12, 'IsAnonymous' => 13, 'IsMember' => 14, 'CardNumberSol' => 15, 'UserSituation' => 16, 'UserBirthday' => 17, 'ParrainName' => 18, 'CreatedAt' => 19, 'UpdatedAt' => 20, ),
		BasePeer::TYPE_COLNAME => array (KataoMemberPeer::ID => 0, KataoMemberPeer::KATAO_INDEX => 1, KataoMemberPeer::KATAO_NODE_ID => 2, KataoMemberPeer::NEXT_KATAO_NODE_ID => 3, KataoMemberPeer::KATAO_MEMBER_ID => 4, KataoMemberPeer::FIRST_NAME => 5, KataoMemberPeer::LAST_NAME => 6, KataoMemberPeer::ACCOUNTING_CODE => 7, KataoMemberPeer::ACCOUNTING_CODE_SOL => 8, KataoMemberPeer::INITIAL_AMOUNT_EURO => 9, KataoMemberPeer::INITIAL_AMOUNT_SOL => 10, KataoMemberPeer::IS_REFERER => 11, KataoMemberPeer::IS_DELEGATE => 12, KataoMemberPeer::IS_ANONYMOUS => 13, KataoMemberPeer::IS_MEMBER => 14, KataoMemberPeer::CARD_NUMBER_SOL => 15, KataoMemberPeer::USER_SITUATION => 16, KataoMemberPeer::USER_BIRTHDAY => 17, KataoMemberPeer::PARRAIN_NAME => 18, KataoMemberPeer::CREATED_AT => 19, KataoMemberPeer::UPDATED_AT => 20, ),
		BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'katao_index' => 1, 'katao_node_id' => 2, 'next_katao_node_id' => 3, 'katao_member_id' => 4, 'first_name' => 5, 'last_name' => 6, 'accounting_code' => 7, 'accounting_code_sol' => 8, 'initial_amount_euro' => 9, 'initial_amount_sol' => 10, 'is_referer' => 11, 'is_delegate' => 12, 'is_anonymous' => 13, 'is_member' => 14, 'card_number_sol' => 15, 'user_situation' => 16, 'user_birthday' => 17, 'parrain_name' => 18, 'created_at' => 19, 'updated_at' => 20, ),
		BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, )
	);

	/**
	 * @return     MapBuilder the map builder for this peer
	 * @throws     PropelException Any exceptions caught during processing will be
	 *		 rethrown wrapped into a PropelException.
	 */
	public static function getMapBuilder()
	{
		return BasePeer::getMapBuilder('lib.model.map.KataoMemberMapBuilder');
	}
	/**
	 * Gets a map (hash) of PHP names to DB column names.
	 *
	 * @return     array The PHP to DB name map for this peer
	 * @throws     PropelException Any exceptions caught during processing will be
	 *		 rethrown wrapped into a PropelException.
	 * @deprecated Use the getFieldNames() and translateFieldName() methods instead of this.
	 */
	public static function getPhpNameMap()
	{
		if (self::$phpNameMap === null) {
			$map = KataoMemberPeer::getTableMap();
			$columns = $map->getColumns();
			$nameMap = array();
			foreach ($columns as $column) {
				$nameMap[$column->getPhpName()] = $column->getColumnName();
			}
			self::$phpNameMap = $nameMap;
		}
		return self::$phpNameMap;
	}
	/**
	 * Translates a fieldname to another type
	 *
	 * @param      string $name field name
	 * @param      string $fromType One of the class type constants TYPE_PHPNAME,
	 *                         TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
	 * @param      string $toType   One of the class type constants
	 * @return     string translated name of the field.
	 */
	static public function translateFieldName($name, $fromType, $toType)
	{
		$toNames = self::getFieldNames($toType);
		$key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null;
		if ($key === null) {
			throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true));
		}
		return $toNames[$key];
	}

	/**
	 * Returns an array of of field names.
	 *
	 * @param      string $type The type of fieldnames to return:
	 *                      One of the class type constants TYPE_PHPNAME,
	 *                      TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
	 * @return     array A list of field names
	 */

	static public function getFieldNames($type = BasePeer::TYPE_PHPNAME)
	{
		if (!array_key_exists($type, self::$fieldNames)) {
			throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM. ' . $type . ' was given.');
		}
		return self::$fieldNames[$type];
	}

	/**
	 * Convenience method which changes table.column to alias.column.
	 *
	 * Using this method you can maintain SQL abstraction while using column aliases.
	 * <code>
	 *		$c->addAlias("alias1", TablePeer::TABLE_NAME);
	 *		$c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
	 * </code>
	 * @param      string $alias The alias for the current table.
	 * @param      string $column The column name for current table. (i.e. KataoMemberPeer::COLUMN_NAME).
	 * @return     string
	 */
	public static function alias($alias, $column)
	{
		return str_replace(KataoMemberPeer::TABLE_NAME.'.', $alias.'.', $column);
	}

	/**
	 * Add all the columns needed to create a new object.
	 *
	 * Note: any columns that were marked with lazyLoad="true" in the
	 * XML schema will not be added to the select list and only loaded
	 * on demand.
	 *
	 * @param      criteria object containing the columns to add.
	 * @throws     PropelException Any exceptions caught during processing will be
	 *		 rethrown wrapped into a PropelException.
	 */
	public static function addSelectColumns(Criteria $criteria)
	{

		$criteria->addSelectColumn(KataoMemberPeer::ID);

		$criteria->addSelectColumn(KataoMemberPeer::KATAO_INDEX);

		$criteria->addSelectColumn(KataoMemberPeer::KATAO_NODE_ID);

		$criteria->addSelectColumn(KataoMemberPeer::NEXT_KATAO_NODE_ID);

		$criteria->addSelectColumn(KataoMemberPeer::KATAO_MEMBER_ID);

		$criteria->addSelectColumn(KataoMemberPeer::FIRST_NAME);

		$criteria->addSelectColumn(KataoMemberPeer::LAST_NAME);

		$criteria->addSelectColumn(KataoMemberPeer::ACCOUNTING_CODE);

		$criteria->addSelectColumn(KataoMemberPeer::ACCOUNTING_CODE_SOL);

		$criteria->addSelectColumn(KataoMemberPeer::INITIAL_AMOUNT_EURO);

		$criteria->addSelectColumn(KataoMemberPeer::INITIAL_AMOUNT_SOL);

		$criteria->addSelectColumn(KataoMemberPeer::IS_REFERER);

		$criteria->addSelectColumn(KataoMemberPeer::IS_DELEGATE);

		$criteria->addSelectColumn(KataoMemberPeer::IS_ANONYMOUS);

		$criteria->addSelectColumn(KataoMemberPeer::IS_MEMBER);

		$criteria->addSelectColumn(KataoMemberPeer::CARD_NUMBER_SOL);

		$criteria->addSelectColumn(KataoMemberPeer::USER_SITUATION);

		$criteria->addSelectColumn(KataoMemberPeer::USER_BIRTHDAY);

		$criteria->addSelectColumn(KataoMemberPeer::PARRAIN_NAME);

		$criteria->addSelectColumn(KataoMemberPeer::CREATED_AT);

		$criteria->addSelectColumn(KataoMemberPeer::UPDATED_AT);

	}

	const COUNT = 'COUNT(katao_member.ID)';
	const COUNT_DISTINCT = 'COUNT(DISTINCT katao_member.ID)';

	/**
	 * Returns the number of rows matching criteria.
	 *
	 * @param      Criteria $criteria
	 * @param      boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria).
	 * @param      Connection $con
	 * @return     int Number of matching rows.
	 */
	public static function doCount(Criteria $criteria, $distinct = false, $con = null)
	{
		// we're going to modify criteria, so copy it first
		$criteria = clone $criteria;

		// clear out anything that might confuse the ORDER BY clause
		$criteria->clearSelectColumns()->clearOrderByColumns();
		if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
			$criteria->addSelectColumn(KataoMemberPeer::COUNT_DISTINCT);
		} else {
			$criteria->addSelectColumn(KataoMemberPeer::COUNT);
		}

		// just in case we're grouping: add those columns to the select statement
		foreach($criteria->getGroupByColumns() as $column)
		{
			$criteria->addSelectColumn($column);
		}

		$rs = KataoMemberPeer::doSelectRS($criteria, $con);
		if ($rs->next()) {
			return $rs->getInt(1);
		} else {
			// no rows returned; we infer that means 0 matches.
			return 0;
		}
	}
	/**
	 * Method to select one object from the DB.
	 *
	 * @param      Criteria $criteria object used to create the SELECT statement.
	 * @param      Connection $con
	 * @return     KataoMember
	 * @throws     PropelException Any exceptions caught during processing will be
	 *		 rethrown wrapped into a PropelException.
	 */
	public static function doSelectOne(Criteria $criteria, $con = null)
	{
		$critcopy = clone $criteria;
		$critcopy->setLimit(1);
		$objects = KataoMemberPeer::doSelect($critcopy, $con);
		if ($objects) {
			return $objects[0];
		}
		return null;
	}
	/**
	 * Method to do selects.
	 *
	 * @param      Criteria $criteria The Criteria object used to build the SELECT statement.
	 * @param      Connection $con
	 * @return     array Array of selected Objects
	 * @throws     PropelException Any exceptions caught during processing will be
	 *		 rethrown wrapped into a PropelException.
	 */
	public static function doSelect(Criteria $criteria, $con = null)
	{
		return KataoMemberPeer::populateObjects(KataoMemberPeer::doSelectRS($criteria, $con));
	}
	/**
	 * Prepares the Criteria object and uses the parent doSelect()
	 * method to get a ResultSet.
	 *
	 * Use this method directly if you want to just get the resultset
	 * (instead of an array of objects).
	 *
	 * @param      Criteria $criteria The Criteria object used to build the SELECT statement.
	 * @param      Connection $con the connection to use
	 * @throws     PropelException Any exceptions caught during processing will be
	 *		 rethrown wrapped into a PropelException.
	 * @return     ResultSet The resultset object with numerically-indexed fields.
	 * @see        BasePeer::doSelect()
	 */
	public static function doSelectRS(Criteria $criteria, $con = null)
	{

    foreach (sfMixer::getCallables('BaseKataoMemberPeer:doSelectRS:doSelectRS') as $callable)
    {
      call_user_func($callable, 'BaseKataoMemberPeer', $criteria, $con);
    }


		if ($con === null) {
			$con = Propel::getConnection(self::DATABASE_NAME);
		}

		if (!$criteria->getSelectColumns()) {
			$criteria = clone $criteria;
			KataoMemberPeer::addSelectColumns($criteria);
		}

		// Set the correct dbName
		$criteria->setDbName(self::DATABASE_NAME);

		// BasePeer returns a Creole ResultSet, set to return
		// rows indexed numerically.
		return BasePeer::doSelect($criteria, $con);
	}
	/**
	 * The returned array will contain objects of the default type or
	 * objects that inherit from the default.
	 *
	 * @throws     PropelException Any exceptions caught during processing will be
	 *		 rethrown wrapped into a PropelException.
	 */
	public static function populateObjects(ResultSet $rs)
	{
		$results = array();
	
		// set the class once to avoid overhead in the loop
		$cls = KataoMemberPeer::getOMClass();
		$cls = sfPropel::import($cls);
		// populate the object(s)
		while($rs->next()) {
		
			$obj = new $cls();
			$obj->hydrate($rs);
			$results[] = $obj;
			
		}
		return $results;
	}

	/**
	 * Returns the number of rows matching criteria, joining the related KataoNodeRelatedByKataoNodeId table
	 *
	 * @param      Criteria $c
	 * @param      boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria).
	 * @param      Connection $con
	 * @return     int Number of matching rows.
	 */
	public static function doCountJoinKataoNodeRelatedByKataoNodeId(Criteria $criteria, $distinct = false, $con = null)
	{
		// we're going to modify criteria, so copy it first
		$criteria = clone $criteria;

		// clear out anything that might confuse the ORDER BY clause
		$criteria->clearSelectColumns()->clearOrderByColumns();
		if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
			$criteria->addSelectColumn(KataoMemberPeer::COUNT_DISTINCT);
		} else {
			$criteria->addSelectColumn(KataoMemberPeer::COUNT);
		}

		// just in case we're grouping: add those columns to the select statement
		foreach($criteria->getGroupByColumns() as $column)
		{
			$criteria->addSelectColumn($column);
		}

		$criteria->addJoin(KataoMemberPeer::KATAO_NODE_ID, KataoNodePeer::ID);

		$rs = KataoMemberPeer::doSelectRS($criteria, $con);
		if ($rs->next()) {
			return $rs->getInt(1);
		} else {
			// no rows returned; we infer that means 0 matches.
			return 0;
		}
	}


	/**
	 * Returns the number of rows matching criteria, joining the related KataoNodeRelatedByNextKataoNodeId table
	 *
	 * @param      Criteria $c
	 * @param      boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria).
	 * @param      Connection $con
	 * @return     int Number of matching rows.
	 */
	public static function doCountJoinKataoNodeRelatedByNextKataoNodeId(Criteria $criteria, $distinct = false, $con = null)
	{
		// we're going to modify criteria, so copy it first
		$criteria = clone $criteria;

		// clear out anything that might confuse the ORDER BY clause
		$criteria->clearSelectColumns()->clearOrderByColumns();
		if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
			$criteria->addSelectColumn(KataoMemberPeer::COUNT_DISTINCT);
		} else {
			$criteria->addSelectColumn(KataoMemberPeer::COUNT);
		}

		// just in case we're grouping: add those columns to the select statement
		foreach($criteria->getGroupByColumns() as $column)
		{
			$criteria->addSelectColumn($column);
		}

		$criteria->addJoin(KataoMemberPeer::NEXT_KATAO_NODE_ID, KataoNodePeer::ID);

		$rs = KataoMemberPeer::doSelectRS($criteria, $con);
		if ($rs->next()) {
			return $rs->getInt(1);
		} else {
			// no rows returned; we infer that means 0 matches.
			return 0;
		}
	}


	/**
	 * Selects a collection of KataoMember objects pre-filled with their KataoNode objects.
	 *
	 * @return     array Array of KataoMember objects.
	 * @throws     PropelException Any exceptions caught during processing will be
	 *		 rethrown wrapped into a PropelException.
	 */
	public static function doSelectJoinKataoNodeRelatedByKataoNodeId(Criteria $c, $con = null)
	{

    foreach (sfMixer::getCallables('BaseKataoMemberPeer:doSelectJoin:doSelectJoin') as $callable)
    {
      call_user_func($callable, 'BaseKataoMemberPeer', $c, $con);
    }


		$c = clone $c;

		// Set the correct dbName if it has not been overridden
		if ($c->getDbName() == Propel::getDefaultDB()) {
			$c->setDbName(self::DATABASE_NAME);
		}

		KataoMemberPeer::addSelectColumns($c);
		$startcol = (KataoMemberPeer::NUM_COLUMNS - KataoMemberPeer::NUM_LAZY_LOAD_COLUMNS) + 1;
		KataoNodePeer::addSelectColumns($c);

		$c->addJoin(KataoMemberPeer::KATAO_NODE_ID, KataoNodePeer::ID);
		$rs = BasePeer::doSelect($c, $con);
		$results = array();

		while($rs->next()) {

			$omClass = KataoMemberPeer::getOMClass();

			$cls = sfPropel::import($omClass);
			$obj1 = new $cls();
			$obj1->hydrate($rs);

			$omClass = KataoNodePeer::getOMClass();

			$cls = sfPropel::import($omClass);
			$obj2 = new $cls();
			$obj2->hydrate($rs, $startcol);

			$newObject = true;
			foreach($results as $temp_obj1) {
				$temp_obj2 = $temp_obj1->getKataoNodeRelatedByKataoNodeId(); //CHECKME
				if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
					$newObject = false;
					// e.g. $author->addBookRelatedByBookId()
					$temp_obj2->addKataoMemberRelatedByKataoNodeId($obj1); //CHECKME
					break;
				}
			}
			if ($newObject) {
				$obj2->initKataoMembersRelatedByKataoNodeId();
				$obj2->addKataoMemberRelatedByKataoNodeId($obj1); //CHECKME
			}
			$results[] = $obj1;
		}
		return $results;
	}


	/**
	 * Selects a collection of KataoMember objects pre-filled with their KataoNode objects.
	 *
	 * @return     array Array of KataoMember objects.
	 * @throws     PropelException Any exceptions caught during processing will be
	 *		 rethrown wrapped into a PropelException.
	 */
	public static function doSelectJoinKataoNodeRelatedByNextKataoNodeId(Criteria $c, $con = null)
	{

    foreach (sfMixer::getCallables('BaseKataoMemberPeer:doSelectJoin:doSelectJoin') as $callable)
    {
      call_user_func($callable, 'BaseKataoMemberPeer', $c, $con);
    }


		$c = clone $c;

		// Set the correct dbName if it has not been overridden
		if ($c->getDbName() == Propel::getDefaultDB()) {
			$c->setDbName(self::DATABASE_NAME);
		}

		KataoMemberPeer::addSelectColumns($c);
		$startcol = (KataoMemberPeer::NUM_COLUMNS - KataoMemberPeer::NUM_LAZY_LOAD_COLUMNS) + 1;
		KataoNodePeer::addSelectColumns($c);

		$c->addJoin(KataoMemberPeer::NEXT_KATAO_NODE_ID, KataoNodePeer::ID);
		$rs = BasePeer::doSelect($c, $con);
		$results = array();

		while($rs->next()) {

			$omClass = KataoMemberPeer::getOMClass();

			$cls = sfPropel::import($omClass);
			$obj1 = new $cls();
			$obj1->hydrate($rs);

			$omClass = KataoNodePeer::getOMClass();

			$cls = sfPropel::import($omClass);
			$obj2 = new $cls();
			$obj2->hydrate($rs, $startcol);

			$newObject = true;
			foreach($results as $temp_obj1) {
				$temp_obj2 = $temp_obj1->getKataoNodeRelatedByNextKataoNodeId(); //CHECKME
				if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
					$newObject = false;
					// e.g. $author->addBookRelatedByBookId()
					$temp_obj2->addKataoMemberRelatedByNextKataoNodeId($obj1); //CHECKME
					break;
				}
			}
			if ($newObject) {
				$obj2->initKataoMembersRelatedByNextKataoNodeId();
				$obj2->addKataoMemberRelatedByNextKataoNodeId($obj1); //CHECKME
			}
			$results[] = $obj1;
		}
		return $results;
	}


	/**
	 * Returns the number of rows matching criteria, joining all related tables
	 *
	 * @param      Criteria $c
	 * @param      boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria).
	 * @param      Connection $con
	 * @return     int Number of matching rows.
	 */
	public static function doCountJoinAll(Criteria $criteria, $distinct = false, $con = null)
	{
		$criteria = clone $criteria;

		// clear out anything that might confuse the ORDER BY clause
		$criteria->clearSelectColumns()->clearOrderByColumns();
		if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
			$criteria->addSelectColumn(KataoMemberPeer::COUNT_DISTINCT);
		} else {
			$criteria->addSelectColumn(KataoMemberPeer::COUNT);
		}

		// just in case we're grouping: add those columns to the select statement
		foreach($criteria->getGroupByColumns() as $column)
		{
			$criteria->addSelectColumn($column);
		}

		$criteria->addJoin(KataoMemberPeer::KATAO_NODE_ID, KataoNodePeer::ID);

		$criteria->addJoin(KataoMemberPeer::NEXT_KATAO_NODE_ID, KataoNodePeer::ID);

		$rs = KataoMemberPeer::doSelectRS($criteria, $con);
		if ($rs->next()) {
			return $rs->getInt(1);
		} else {
			// no rows returned; we infer that means 0 matches.
			return 0;
		}
	}


	/**
	 * Selects a collection of KataoMember objects pre-filled with all related objects.
	 *
	 * @return     array Array of KataoMember objects.
	 * @throws     PropelException Any exceptions caught during processing will be
	 *		 rethrown wrapped into a PropelException.
	 */
	public static function doSelectJoinAll(Criteria $c, $con = null)
	{

    foreach (sfMixer::getCallables('BaseKataoMemberPeer:doSelectJoinAll:doSelectJoinAll') as $callable)
    {
      call_user_func($callable, 'BaseKataoMemberPeer', $c, $con);
    }


		$c = clone $c;

		// Set the correct dbName if it has not been overridden
		if ($c->getDbName() == Propel::getDefaultDB()) {
			$c->setDbName(self::DATABASE_NAME);
		}

		KataoMemberPeer::addSelectColumns($c);
		$startcol2 = (KataoMemberPeer::NUM_COLUMNS - KataoMemberPeer::NUM_LAZY_LOAD_COLUMNS) + 1;

		KataoNodePeer::addSelectColumns($c);
		$startcol3 = $startcol2 + KataoNodePeer::NUM_COLUMNS;

		KataoNodePeer::addSelectColumns($c);
		$startcol4 = $startcol3 + KataoNodePeer::NUM_COLUMNS;

		$c->addJoin(KataoMemberPeer::KATAO_NODE_ID, KataoNodePeer::ID);

		$c->addJoin(KataoMemberPeer::NEXT_KATAO_NODE_ID, KataoNodePeer::ID);

		$rs = BasePeer::doSelect($c, $con);
		$results = array();

		while($rs->next()) {

			$omClass = KataoMemberPeer::getOMClass();


			$cls = sfPropel::import($omClass);
			$obj1 = new $cls();
			$obj1->hydrate($rs);


				// Add objects for joined KataoNode rows
	
			$omClass = KataoNodePeer::getOMClass();


			$cls = sfPropel::import($omClass);
			$obj2 = new $cls();
			$obj2->hydrate($rs, $startcol2);

			$newObject = true;
			for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
				$temp_obj1 = $results[$j];
				$temp_obj2 = $temp_obj1->getKataoNodeRelatedByKataoNodeId(); // CHECKME
				if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
					$newObject = false;
					$temp_obj2->addKataoMemberRelatedByKataoNodeId($obj1); // CHECKME
					break;
				}
			}

			if ($newObject) {
				$obj2->initKataoMembersRelatedByKataoNodeId();
				$obj2->addKataoMemberRelatedByKataoNodeId($obj1);
			}


				// Add objects for joined KataoNode rows
	
			$omClass = KataoNodePeer::getOMClass();


			$cls = sfPropel::import($omClass);
			$obj3 = new $cls();
			$obj3->hydrate($rs, $startcol3);

			$newObject = true;
			for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
				$temp_obj1 = $results[$j];
				$temp_obj3 = $temp_obj1->getKataoNodeRelatedByNextKataoNodeId(); // CHECKME
				if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) {
					$newObject = false;
					$temp_obj3->addKataoMemberRelatedByNextKataoNodeId($obj1); // CHECKME
					break;
				}
			}

			if ($newObject) {
				$obj3->initKataoMembersRelatedByNextKataoNodeId();
				$obj3->addKataoMemberRelatedByNextKataoNodeId($obj1);
			}

			$results[] = $obj1;
		}
		return $results;
	}


	/**
	 * Returns the number of rows matching criteria, joining the related KataoNodeRelatedByKataoNodeId table
	 *
	 * @param      Criteria $c
	 * @param      boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria).
	 * @param      Connection $con
	 * @return     int Number of matching rows.
	 */
	public static function doCountJoinAllExceptKataoNodeRelatedByKataoNodeId(Criteria $criteria, $distinct = false, $con = null)
	{
		// we're going to modify criteria, so copy it first
		$criteria = clone $criteria;

		// clear out anything that might confuse the ORDER BY clause
		$criteria->clearSelectColumns()->clearOrderByColumns();
		if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
			$criteria->addSelectColumn(KataoMemberPeer::COUNT_DISTINCT);
		} else {
			$criteria->addSelectColumn(KataoMemberPeer::COUNT);
		}

		// just in case we're grouping: add those columns to the select statement
		foreach($criteria->getGroupByColumns() as $column)
		{
			$criteria->addSelectColumn($column);
		}

		$rs = KataoMemberPeer::doSelectRS($criteria, $con);
		if ($rs->next()) {
			return $rs->getInt(1);
		} else {
			// no rows returned; we infer that means 0 matches.
			return 0;
		}
	}


	/**
	 * Returns the number of rows matching criteria, joining the related KataoNodeRelatedByNextKataoNodeId table
	 *
	 * @param      Criteria $c
	 * @param      boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria).
	 * @param      Connection $con
	 * @return     int Number of matching rows.
	 */
	public static function doCountJoinAllExceptKataoNodeRelatedByNextKataoNodeId(Criteria $criteria, $distinct = false, $con = null)
	{
		// we're going to modify criteria, so copy it first
		$criteria = clone $criteria;

		// clear out anything that might confuse the ORDER BY clause
		$criteria->clearSelectColumns()->clearOrderByColumns();
		if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
			$criteria->addSelectColumn(KataoMemberPeer::COUNT_DISTINCT);
		} else {
			$criteria->addSelectColumn(KataoMemberPeer::COUNT);
		}

		// just in case we're grouping: add those columns to the select statement
		foreach($criteria->getGroupByColumns() as $column)
		{
			$criteria->addSelectColumn($column);
		}

		$rs = KataoMemberPeer::doSelectRS($criteria, $con);
		if ($rs->next()) {
			return $rs->getInt(1);
		} else {
			// no rows returned; we infer that means 0 matches.
			return 0;
		}
	}


	/**
	 * Returns the number of rows matching criteria, joining the related KataoMemberRelatedByKataoMemberId table
	 *
	 * @param      Criteria $c
	 * @param      boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria).
	 * @param      Connection $con
	 * @return     int Number of matching rows.
	 */
	public static function doCountJoinAllExceptKataoMemberRelatedByKataoMemberId(Criteria $criteria, $distinct = false, $con = null)
	{
		// we're going to modify criteria, so copy it first
		$criteria = clone $criteria;

		// clear out anything that might confuse the ORDER BY clause
		$criteria->clearSelectColumns()->clearOrderByColumns();
		if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
			$criteria->addSelectColumn(KataoMemberPeer::COUNT_DISTINCT);
		} else {
			$criteria->addSelectColumn(KataoMemberPeer::COUNT);
		}

		// just in case we're grouping: add those columns to the select statement
		foreach($criteria->getGroupByColumns() as $column)
		{
			$criteria->addSelectColumn($column);
		}

		$criteria->addJoin(KataoMemberPeer::KATAO_NODE_ID, KataoNodePeer::ID);

		$criteria->addJoin(KataoMemberPeer::NEXT_KATAO_NODE_ID, KataoNodePeer::ID);

		$rs = KataoMemberPeer::doSelectRS($criteria, $con);
		if ($rs->next()) {
			return $rs->getInt(1);
		} else {
			// no rows returned; we infer that means 0 matches.
			return 0;
		}
	}


	/**
	 * Selects a collection of KataoMember objects pre-filled with all related objects except KataoNodeRelatedByKataoNodeId.
	 *
	 * @return     array Array of KataoMember objects.
	 * @throws     PropelException Any exceptions caught during processing will be
	 *		 rethrown wrapped into a PropelException.
	 */
	public static function doSelectJoinAllExceptKataoNodeRelatedByKataoNodeId(Criteria $c, $con = null)
	{

    foreach (sfMixer::getCallables('BaseKataoMemberPeer:doSelectJoinAllExcept:doSelectJoinAllExcept') as $callable)
    {
      call_user_func($callable, 'BaseKataoMemberPeer', $c, $con);
    }


		$c = clone $c;

		// Set the correct dbName if it has not been overridden
		// $c->getDbName() will return the same object if not set to another value
		// so == check is okay and faster
		if ($c->getDbName() == Propel::getDefaultDB()) {
			$c->setDbName(self::DATABASE_NAME);
		}

		KataoMemberPeer::addSelectColumns($c);
		$startcol2 = (KataoMemberPeer::NUM_COLUMNS - KataoMemberPeer::NUM_LAZY_LOAD_COLUMNS) + 1;


		$rs = BasePeer::doSelect($c, $con);
		$results = array();

		while($rs->next()) {

			$omClass = KataoMemberPeer::getOMClass();

			$cls = sfPropel::import($omClass);
			$obj1 = new $cls();
			$obj1->hydrate($rs);

			$results[] = $obj1;
		}
		return $results;
	}


	/**
	 * Selects a collection of KataoMember objects pre-filled with all related objects except KataoNodeRelatedByNextKataoNodeId.
	 *
	 * @return     array Array of KataoMember objects.
	 * @throws     PropelException Any exceptions caught during processing will be
	 *		 rethrown wrapped into a PropelException.
	 */
	public static function doSelectJoinAllExceptKataoNodeRelatedByNextKataoNodeId(Criteria $c, $con = null)
	{

    foreach (sfMixer::getCallables('BaseKataoMemberPeer:doSelectJoinAllExcept:doSelectJoinAllExcept') as $callable)
    {
      call_user_func($callable, 'BaseKataoMemberPeer', $c, $con);
    }


		$c = clone $c;

		// Set the correct dbName if it has not been overridden
		// $c->getDbName() will return the same object if not set to another value
		// so == check is okay and faster
		if ($c->getDbName() == Propel::getDefaultDB()) {
			$c->setDbName(self::DATABASE_NAME);
		}

		KataoMemberPeer::addSelectColumns($c);
		$startcol2 = (KataoMemberPeer::NUM_COLUMNS - KataoMemberPeer::NUM_LAZY_LOAD_COLUMNS) + 1;


		$rs = BasePeer::doSelect($c, $con);
		$results = array();

		while($rs->next()) {

			$omClass = KataoMemberPeer::getOMClass();

			$cls = sfPropel::import($omClass);
			$obj1 = new $cls();
			$obj1->hydrate($rs);

			$results[] = $obj1;
		}
		return $results;
	}


	/**
	 * Selects a collection of KataoMember objects pre-filled with all related objects except KataoMemberRelatedByKataoMemberId.
	 *
	 * @return     array Array of KataoMember objects.
	 * @throws     PropelException Any exceptions caught during processing will be
	 *		 rethrown wrapped into a PropelException.
	 */
	public static function doSelectJoinAllExceptKataoMemberRelatedByKataoMemberId(Criteria $c, $con = null)
	{

    foreach (sfMixer::getCallables('BaseKataoMemberPeer:doSelectJoinAllExcept:doSelectJoinAllExcept') as $callable)
    {
      call_user_func($callable, 'BaseKataoMemberPeer', $c, $con);
    }


		$c = clone $c;

		// Set the correct dbName if it has not been overridden
		// $c->getDbName() will return the same object if not set to another value
		// so == check is okay and faster
		if ($c->getDbName() == Propel::getDefaultDB()) {
			$c->setDbName(self::DATABASE_NAME);
		}

		KataoMemberPeer::addSelectColumns($c);
		$startcol2 = (KataoMemberPeer::NUM_COLUMNS - KataoMemberPeer::NUM_LAZY_LOAD_COLUMNS) + 1;

		KataoNodePeer::addSelectColumns($c);
		$startcol3 = $startcol2 + KataoNodePeer::NUM_COLUMNS;

		KataoNodePeer::addSelectColumns($c);
		$startcol4 = $startcol3 + KataoNodePeer::NUM_COLUMNS;

		$c->addJoin(KataoMemberPeer::KATAO_NODE_ID, KataoNodePeer::ID);

		$c->addJoin(KataoMemberPeer::NEXT_KATAO_NODE_ID, KataoNodePeer::ID);


		$rs = BasePeer::doSelect($c, $con);
		$results = array();

		while($rs->next()) {

			$omClass = KataoMemberPeer::getOMClass();

			$cls = sfPropel::import($omClass);
			$obj1 = new $cls();
			$obj1->hydrate($rs);

			$omClass = KataoNodePeer::getOMClass();


			$cls = sfPropel::import($omClass);
			$obj2  = new $cls();
			$obj2->hydrate($rs, $startcol2);

			$newObject = true;
			for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
				$temp_obj1 = $results[$j];
				$temp_obj2 = $temp_obj1->getKataoNodeRelatedByKataoNodeId(); //CHECKME
				if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
					$newObject = false;
					$temp_obj2->addKataoMemberRelatedByKataoNodeId($obj1);
					break;
				}
			}

			if ($newObject) {
				$obj2->initKataoMembersRelatedByKataoNodeId();
				$obj2->addKataoMemberRelatedByKataoNodeId($obj1);
			}

			$omClass = KataoNodePeer::getOMClass();


			$cls = sfPropel::import($omClass);
			$obj3  = new $cls();
			$obj3->hydrate($rs, $startcol3);

			$newObject = true;
			for ($j=0, $resCount=count($results); $j < $resCount; $j++) {
				$temp_obj1 = $results[$j];
				$temp_obj3 = $temp_obj1->getKataoNodeRelatedByNextKataoNodeId(); //CHECKME
				if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) {
					$newObject = false;
					$temp_obj3->addKataoMemberRelatedByNextKataoNodeId($obj1);
					break;
				}
			}

			if ($newObject) {
				$obj3->initKataoMembersRelatedByNextKataoNodeId();
				$obj3->addKataoMemberRelatedByNextKataoNodeId($obj1);
			}

			$results[] = $obj1;
		}
		return $results;
	}


  static public function getUniqueColumnNames()
  {
    return array();
  }
	/**
	 * Returns the TableMap related to this peer.
	 * This method is not needed for general use but a specific application could have a need.
	 * @return     TableMap
	 * @throws     PropelException Any exceptions caught during processing will be
	 *		 rethrown wrapped into a PropelException.
	 */
	public static function getTableMap()
	{
		return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME);
	}

	/**
	 * The class that the Peer will make instances of.
	 *
	 * This uses a dot-path notation which is tranalted into a path
	 * relative to a location on the PHP include_path.
	 * (e.g. path.to.MyClass -> 'path/to/MyClass.php')
	 *
	 * @return     string path.to.ClassName
	 */
	public static function getOMClass()
	{
		return KataoMemberPeer::CLASS_DEFAULT;
	}

	/**
	 * Method perform an INSERT on the database, given a KataoMember or Criteria object.
	 *
	 * @param      mixed $values Criteria or KataoMember object containing data that is used to create the INSERT statement.
	 * @param      Connection $con the connection to use
	 * @return     mixed The new primary key.
	 * @throws     PropelException Any exceptions caught during processing will be
	 *		 rethrown wrapped into a PropelException.
	 */
	public static function doInsert($values, $con = null)
	{

    foreach (sfMixer::getCallables('BaseKataoMemberPeer:doInsert:pre') as $callable)
    {
      $ret = call_user_func($callable, 'BaseKataoMemberPeer', $values, $con);
      if (false !== $ret)
      {
        return $ret;
      }
    }


		if ($con === null) {
			$con = Propel::getConnection(self::DATABASE_NAME);
		}

		if ($values instanceof Criteria) {
			$criteria = clone $values; // rename for clarity
		} else {
			$criteria = $values->buildCriteria(); // build Criteria from KataoMember object
		}

		$criteria->remove(KataoMemberPeer::ID); // remove pkey col since this table uses auto-increment


		// Set the correct dbName
		$criteria->setDbName(self::DATABASE_NAME);

		try {
			// use transaction because $criteria could contain info
			// for more than one table (I guess, conceivably)
			$con->begin();
			$pk = BasePeer::doInsert($criteria, $con);
			$con->commit();
		} catch(PropelException $e) {
			$con->rollback();
			throw $e;
		}

		
    foreach (sfMixer::getCallables('BaseKataoMemberPeer:doInsert:post') as $callable)
    {
      call_user_func($callable, 'BaseKataoMemberPeer', $values, $con, $pk);
    }

    return $pk;
	}

	/**
	 * Method perform an UPDATE on the database, given a KataoMember or Criteria object.
	 *
	 * @param      mixed $values Criteria or KataoMember object containing data that is used to create the UPDATE statement.
	 * @param      Connection $con The connection to use (specify Connection object to exert more control over transactions).
	 * @return     int The number of affected rows (if supported by underlying database driver).
	 * @throws     PropelException Any exceptions caught during processing will be
	 *		 rethrown wrapped into a PropelException.
	 */
	public static function doUpdate($values, $con = null)
	{

    foreach (sfMixer::getCallables('BaseKataoMemberPeer:doUpdate:pre') as $callable)
    {
      $ret = call_user_func($callable, 'BaseKataoMemberPeer', $values, $con);
      if (false !== $ret)
      {
        return $ret;
      }
    }


		if ($con === null) {
			$con = Propel::getConnection(self::DATABASE_NAME);
		}

		$selectCriteria = new Criteria(self::DATABASE_NAME);

		if ($values instanceof Criteria) {
			$criteria = clone $values; // rename for clarity

			$comparison = $criteria->getComparison(KataoMemberPeer::ID);
			$selectCriteria->add(KataoMemberPeer::ID, $criteria->remove(KataoMemberPeer::ID), $comparison);

		} else { // $values is KataoMember object
			$criteria = $values->buildCriteria(); // gets full criteria
			$selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
		}

		// set the correct dbName
		$criteria->setDbName(self::DATABASE_NAME);

		$ret = BasePeer::doUpdate($selectCriteria, $criteria, $con);
	

    foreach (sfMixer::getCallables('BaseKataoMemberPeer:doUpdate:post') as $callable)
    {
      call_user_func($callable, 'BaseKataoMemberPeer', $values, $con, $ret);
    }

    return $ret;
  }

	/**
	 * Method to DELETE all rows from the katao_member table.
	 *
	 * @return     int The number of affected rows (if supported by underlying database driver).
	 */
	public static function doDeleteAll($con = null)
	{
		if ($con === null) {
			$con = Propel::getConnection(self::DATABASE_NAME);
		}
		$affectedRows = 0; // initialize var to track total num of affected rows
		try {
			// use transaction because $criteria could contain info
			// for more than one table or we could emulating ON DELETE CASCADE, etc.
			$con->begin();
			$affectedRows += BasePeer::doDeleteAll(KataoMemberPeer::TABLE_NAME, $con);
			$con->commit();
			return $affectedRows;
		} catch (PropelException $e) {
			$con->rollback();
			throw $e;
		}
	}

	/**
	 * Method perform a DELETE on the database, given a KataoMember or Criteria object OR a primary key value.
	 *
	 * @param      mixed $values Criteria or KataoMember object or primary key or array of primary keys
	 *              which is used to create the DELETE statement
	 * @param      Connection $con the connection to use
	 * @return     int 	The number of affected rows (if supported by underlying database driver).  This includes CASCADE-related rows
	 *				if supported by native driver or if emulated using Propel.
	 * @throws     PropelException Any exceptions caught during processing will be
	 *		 rethrown wrapped into a PropelException.
	 */
	 public static function doDelete($values, $con = null)
	 {
		if ($con === null) {
			$con = Propel::getConnection(KataoMemberPeer::DATABASE_NAME);
		}

		if ($values instanceof Criteria) {
			$criteria = clone $values; // rename for clarity
		} elseif ($values instanceof KataoMember) {

			$criteria = $values->buildPkeyCriteria();
		} else {
			// it must be the primary key
			$criteria = new Criteria(self::DATABASE_NAME);
			$criteria->add(KataoMemberPeer::ID, (array) $values, Criteria::IN);
		}

		// Set the correct dbName
		$criteria->setDbName(self::DATABASE_NAME);

		$affectedRows = 0; // initialize var to track total num of affected rows

		try {
			// use transaction because $criteria could contain info
			// for more than one table or we could emulating ON DELETE CASCADE, etc.
			$con->begin();
			
			$affectedRows += BasePeer::doDelete($criteria, $con);
			$con->commit();
			return $affectedRows;
		} catch (PropelException $e) {
			$con->rollback();
			throw $e;
		}
	}

	/**
	 * Validates all modified columns of given KataoMember object.
	 * If parameter $columns is either a single column name or an array of column names
	 * than only those columns are validated.
	 *
	 * NOTICE: This does not apply to primary or foreign keys for now.
	 *
	 * @param      KataoMember $obj The object to validate.
	 * @param      mixed $cols Column name or array of column names.
	 *
	 * @return     mixed TRUE if all columns are valid or the error message of the first invalid column.
	 */
	public static function doValidate(KataoMember $obj, $cols = null)
	{
		$columns = array();

		if ($cols) {
			$dbMap = Propel::getDatabaseMap(KataoMemberPeer::DATABASE_NAME);
			$tableMap = $dbMap->getTable(KataoMemberPeer::TABLE_NAME);

			if (! is_array($cols)) {
				$cols = array($cols);
			}

			foreach($cols as $colName) {
				if ($tableMap->containsColumn($colName)) {
					$get = 'get' . $tableMap->getColumn($colName)->getPhpName();
					$columns[$colName] = $obj->$get();
				}
			}
		} else {

		}

		$res =  BasePeer::doValidate(KataoMemberPeer::DATABASE_NAME, KataoMemberPeer::TABLE_NAME, $columns);
    if ($res !== true) {
        $request = sfContext::getInstance()->getRequest();
        foreach ($res as $failed) {
            $col = KataoMemberPeer::translateFieldname($failed->getColumn(), BasePeer::TYPE_COLNAME, BasePeer::TYPE_PHPNAME);
            $request->setError($col, $failed->getMessage());
        }
    }

    return $res;
	}

	/**
	 * Retrieve a single object by pkey.
	 *
	 * @param      mixed $pk the primary key.
	 * @param      Connection $con the connection to use
	 * @return     KataoMember
	 */
	public static function retrieveByPK($pk, $con = null)
	{
		if ($con === null) {
			$con = Propel::getConnection(self::DATABASE_NAME);
		}

		$criteria = new Criteria(KataoMemberPeer::DATABASE_NAME);

		$criteria->add(KataoMemberPeer::ID, $pk);


		$v = KataoMemberPeer::doSelect($criteria, $con);

		return !empty($v) > 0 ? $v[0] : null;
	}

	/**
	 * Retrieve multiple objects by pkey.
	 *
	 * @param      array $pks List of primary keys
	 * @param      Connection $con the connection to use
	 * @throws     PropelException Any exceptions caught during processing will be
	 *		 rethrown wrapped into a PropelException.
	 */
	public static function retrieveByPKs($pks, $con = null)
	{
		if ($con === null) {
			$con = Propel::getConnection(self::DATABASE_NAME);
		}

		$objs = null;
		if (empty($pks)) {
			$objs = array();
		} else {
			$criteria = new Criteria();
			$criteria->add(KataoMemberPeer::ID, $pks, Criteria::IN);
			$objs = KataoMemberPeer::doSelect($criteria, $con);
		}
		return $objs;
	}

} // BaseKataoMemberPeer

// 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 {
		BaseKataoMemberPeer::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.
	Propel::registerMapBuilder('lib.model.map.KataoMemberMapBuilder');
}
