<?php

/**
 * Base class that represents a row from the 'node' table.
 *
 * 
 *
 * @package    plugins.catalyz.lib.model.om
 */
abstract class BaseNode extends BaseObject  implements Persistent {


	/**
	 * The Peer class.
	 * Instance provides a convenient way of calling static methods on a class
	 * that calling code may not be able to identify.
	 * @var        NodePeer
	 */
	protected static $peer;


	/**
	 * The value for the id field.
	 * @var        int
	 */
	protected $id;


	/**
	 * The value for the is_public field.
	 * @var        boolean
	 */
	protected $is_public = true;


	/**
	 * The value for the node_class field.
	 * @var        string
	 */
	protected $node_class;


	/**
	 * The value for the url_provider field.
	 * @var        int
	 */
	protected $url_provider;


	/**
	 * The value for the open_target_provider field.
	 * @var        int
	 */
	protected $open_target_provider;


	/**
	 * The value for the perms_type field.
	 * @var        int
	 */
	protected $perms_type = 1;


	/**
	 * The value for the credentials field.
	 * @var        string
	 */
	protected $credentials;


	/**
	 * The value for the tree_left field.
	 * @var        int
	 */
	protected $tree_left;


	/**
	 * The value for the tree_right field.
	 * @var        int
	 */
	protected $tree_right;


	/**
	 * The value for the tree_parent field.
	 * @var        int
	 */
	protected $tree_parent;


	/**
	 * The value for the tree_id field.
	 * @var        int
	 */
	protected $tree_id = 1;


	/**
	 * The value for the is_visible_in_menu field.
	 * @var        boolean
	 */
	protected $is_visible_in_menu = true;


	/**
	 * The value for the current_layout field.
	 * @var        string
	 */
	protected $current_layout;


	/**
	 * The value for the current_layout_type field.
	 * @var        int
	 */
	protected $current_layout_type;


	/**
	 * The value for the created_at field.
	 * @var        int
	 */
	protected $created_at;


	/**
	 * The value for the updated_at field.
	 * @var        int
	 */
	protected $updated_at;

	/**
	 * Collection to store aggregation of collNodeI18ns.
	 * @var        array
	 */
	protected $collNodeI18ns;

	/**
	 * The criteria used to select the current contents of collNodeI18ns.
	 * @var        Criteria
	 */
	protected $lastNodeI18nCriteria = null;

	/**
	 * Collection to store aggregation of collNodeSitemaps.
	 * @var        array
	 */
	protected $collNodeSitemaps;

	/**
	 * The criteria used to select the current contents of collNodeSitemaps.
	 * @var        Criteria
	 */
	protected $lastNodeSitemapCriteria = null;

	/**
	 * Collection to store aggregation of collNodeHomes.
	 * @var        array
	 */
	protected $collNodeHomes;

	/**
	 * The criteria used to select the current contents of collNodeHomes.
	 * @var        Criteria
	 */
	protected $lastNodeHomeCriteria = null;

	/**
	 * Collection to store aggregation of collNodePages.
	 * @var        array
	 */
	protected $collNodePages;

	/**
	 * The criteria used to select the current contents of collNodePages.
	 * @var        Criteria
	 */
	protected $lastNodePageCriteria = null;

	/**
	 * Collection to store aggregation of collNodeNewss.
	 * @var        array
	 */
	protected $collNodeNewss;

	/**
	 * The criteria used to select the current contents of collNodeNewss.
	 * @var        Criteria
	 */
	protected $lastNodeNewsCriteria = null;

	/**
	 * Collection to store aggregation of collNodeNetworks.
	 * @var        array
	 */
	protected $collNodeNetworks;

	/**
	 * The criteria used to select the current contents of collNodeNetworks.
	 * @var        Criteria
	 */
	protected $lastNodeNetworkCriteria = null;

	/**
	 * Flag to prevent endless save loop, if this object is referenced
	 * by another object which falls in this transaction.
	 * @var        boolean
	 */
	protected $alreadyInSave = false;

	/**
	 * Flag to prevent endless validation loop, if this object is referenced
	 * by another object which falls in this transaction.
	 * @var        boolean
	 */
	protected $alreadyInValidation = false;

  /**
   * The value for the culture field.
   * @var string
   */
  protected $culture;

	/**
	 * Get the [id] column value.
	 * 
	 * @return     int
	 */
	public function getId()
	{

		return $this->id;
	}

	/**
	 * Get the [is_public] column value.
	 * 
	 * @return     boolean
	 */
	public function getIsPublic()
	{

		return $this->is_public;
	}

	/**
	 * Get the [node_class] column value.
	 * 
	 * @return     string
	 */
	public function getNodeClass()
	{

		return $this->node_class;
	}

	/**
	 * Get the [url_provider] column value.
	 * 
	 * @return     int
	 */
	public function getUrlProvider()
	{

		return $this->url_provider;
	}

	/**
	 * Get the [open_target_provider] column value.
	 * 
	 * @return     int
	 */
	public function getOpenTargetProvider()
	{

		return $this->open_target_provider;
	}

	/**
	 * Get the [perms_type] column value.
	 * 
	 * @return     int
	 */
	public function getPermsType()
	{

		return $this->perms_type;
	}

	/**
	 * Get the [credentials] column value.
	 * 
	 * @return     string
	 */
	public function getCredentials()
	{

		return $this->credentials;
	}

	/**
	 * Get the [tree_left] column value.
	 * 
	 * @return     int
	 */
	public function getTreeLeft()
	{

		return $this->tree_left;
	}

	/**
	 * Get the [tree_right] column value.
	 * 
	 * @return     int
	 */
	public function getTreeRight()
	{

		return $this->tree_right;
	}

	/**
	 * Get the [tree_parent] column value.
	 * 
	 * @return     int
	 */
	public function getTreeParent()
	{

		return $this->tree_parent;
	}

	/**
	 * Get the [tree_id] column value.
	 * 
	 * @return     int
	 */
	public function getTreeId()
	{

		return $this->tree_id;
	}

	/**
	 * Get the [is_visible_in_menu] column value.
	 * 
	 * @return     boolean
	 */
	public function getIsVisibleInMenu()
	{

		return $this->is_visible_in_menu;
	}

	/**
	 * Get the [current_layout] column value.
	 * 
	 * @return     string
	 */
	public function getCurrentLayout()
	{

		return $this->current_layout;
	}

	/**
	 * Get the [current_layout_type] column value.
	 * 
	 * @return     int
	 */
	public function getCurrentLayoutType()
	{

		return $this->current_layout_type;
	}

	/**
	 * Get the [optionally formatted] [created_at] column value.
	 * 
	 * @param      string $format The date/time format string (either date()-style or strftime()-style).
	 *							If format is NULL, then the integer unix timestamp will be returned.
	 * @return     mixed Formatted date/time value as string or integer unix timestamp (if format is NULL).
	 * @throws     PropelException - if unable to convert the date/time to timestamp.
	 */
	public function getCreatedAt($format = 'Y-m-d H:i:s')
	{

		if ($this->created_at === null || $this->created_at === '') {
			return null;
		} elseif (!is_int($this->created_at)) {
			// a non-timestamp value was set externally, so we convert it
			$ts = strtotime($this->created_at);
			if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE
				throw new PropelException("Unable to parse value of [created_at] as date/time value: " . var_export($this->created_at, true));
			}
		} else {
			$ts = $this->created_at;
		}
		if ($format === null) {
			return $ts;
		} elseif (strpos($format, '%') !== false) {
			return strftime($format, $ts);
		} else {
			return date($format, $ts);
		}
	}

	/**
	 * Get the [optionally formatted] [updated_at] column value.
	 * 
	 * @param      string $format The date/time format string (either date()-style or strftime()-style).
	 *							If format is NULL, then the integer unix timestamp will be returned.
	 * @return     mixed Formatted date/time value as string or integer unix timestamp (if format is NULL).
	 * @throws     PropelException - if unable to convert the date/time to timestamp.
	 */
	public function getUpdatedAt($format = 'Y-m-d H:i:s')
	{

		if ($this->updated_at === null || $this->updated_at === '') {
			return null;
		} elseif (!is_int($this->updated_at)) {
			// a non-timestamp value was set externally, so we convert it
			$ts = strtotime($this->updated_at);
			if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE
				throw new PropelException("Unable to parse value of [updated_at] as date/time value: " . var_export($this->updated_at, true));
			}
		} else {
			$ts = $this->updated_at;
		}
		if ($format === null) {
			return $ts;
		} elseif (strpos($format, '%') !== false) {
			return strftime($format, $ts);
		} else {
			return date($format, $ts);
		}
	}

	/**
	 * Set the value of [id] column.
	 * 
	 * @param      int $v new value
	 * @return     void
	 */
	public function setId($v)
	{

		// Since the native PHP type for this column is integer,
		// we will cast the input value to an int (if it is not).
		if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->id !== $v) {
			$this->id = $v;
			$this->modifiedColumns[] = NodePeer::ID;
		}

	} // setId()

	/**
	 * Set the value of [is_public] column.
	 * 
	 * @param      boolean $v new value
	 * @return     void
	 */
	public function setIsPublic($v)
	{

		if ($this->is_public !== $v || $v === true) {
			$this->is_public = $v;
			$this->modifiedColumns[] = NodePeer::IS_PUBLIC;
		}

	} // setIsPublic()

	/**
	 * Set the value of [node_class] column.
	 * 
	 * @param      string $v new value
	 * @return     void
	 */
	public function setNodeClass($v)
	{

		// Since the native PHP type for this column is string,
		// we will cast the input to a string (if it is not).
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->node_class !== $v) {
			$this->node_class = $v;
			$this->modifiedColumns[] = NodePeer::NODE_CLASS;
		}

	} // setNodeClass()

	/**
	 * Set the value of [url_provider] column.
	 * 
	 * @param      int $v new value
	 * @return     void
	 */
	public function setUrlProvider($v)
	{

		// Since the native PHP type for this column is integer,
		// we will cast the input value to an int (if it is not).
		if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->url_provider !== $v) {
			$this->url_provider = $v;
			$this->modifiedColumns[] = NodePeer::URL_PROVIDER;
		}

	} // setUrlProvider()

	/**
	 * Set the value of [open_target_provider] column.
	 * 
	 * @param      int $v new value
	 * @return     void
	 */
	public function setOpenTargetProvider($v)
	{

		// Since the native PHP type for this column is integer,
		// we will cast the input value to an int (if it is not).
		if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->open_target_provider !== $v) {
			$this->open_target_provider = $v;
			$this->modifiedColumns[] = NodePeer::OPEN_TARGET_PROVIDER;
		}

	} // setOpenTargetProvider()

	/**
	 * Set the value of [perms_type] column.
	 * 
	 * @param      int $v new value
	 * @return     void
	 */
	public function setPermsType($v)
	{

		// Since the native PHP type for this column is integer,
		// we will cast the input value to an int (if it is not).
		if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->perms_type !== $v || $v === 1) {
			$this->perms_type = $v;
			$this->modifiedColumns[] = NodePeer::PERMS_TYPE;
		}

	} // setPermsType()

	/**
	 * Set the value of [credentials] column.
	 * 
	 * @param      string $v new value
	 * @return     void
	 */
	public function setCredentials($v)
	{

		// Since the native PHP type for this column is string,
		// we will cast the input to a string (if it is not).
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->credentials !== $v) {
			$this->credentials = $v;
			$this->modifiedColumns[] = NodePeer::CREDENTIALS;
		}

	} // setCredentials()

	/**
	 * Set the value of [tree_left] column.
	 * 
	 * @param      int $v new value
	 * @return     void
	 */
	public function setTreeLeft($v)
	{

		// Since the native PHP type for this column is integer,
		// we will cast the input value to an int (if it is not).
		if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->tree_left !== $v) {
			$this->tree_left = $v;
			$this->modifiedColumns[] = NodePeer::TREE_LEFT;
		}

	} // setTreeLeft()

	/**
	 * Set the value of [tree_right] column.
	 * 
	 * @param      int $v new value
	 * @return     void
	 */
	public function setTreeRight($v)
	{

		// Since the native PHP type for this column is integer,
		// we will cast the input value to an int (if it is not).
		if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->tree_right !== $v) {
			$this->tree_right = $v;
			$this->modifiedColumns[] = NodePeer::TREE_RIGHT;
		}

	} // setTreeRight()

	/**
	 * Set the value of [tree_parent] column.
	 * 
	 * @param      int $v new value
	 * @return     void
	 */
	public function setTreeParent($v)
	{

		// Since the native PHP type for this column is integer,
		// we will cast the input value to an int (if it is not).
		if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->tree_parent !== $v) {
			$this->tree_parent = $v;
			$this->modifiedColumns[] = NodePeer::TREE_PARENT;
		}

	} // setTreeParent()

	/**
	 * Set the value of [tree_id] column.
	 * 
	 * @param      int $v new value
	 * @return     void
	 */
	public function setTreeId($v)
	{

		// Since the native PHP type for this column is integer,
		// we will cast the input value to an int (if it is not).
		if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->tree_id !== $v || $v === 1) {
			$this->tree_id = $v;
			$this->modifiedColumns[] = NodePeer::TREE_ID;
		}

	} // setTreeId()

	/**
	 * Set the value of [is_visible_in_menu] column.
	 * 
	 * @param      boolean $v new value
	 * @return     void
	 */
	public function setIsVisibleInMenu($v)
	{

		if ($this->is_visible_in_menu !== $v || $v === true) {
			$this->is_visible_in_menu = $v;
			$this->modifiedColumns[] = NodePeer::IS_VISIBLE_IN_MENU;
		}

	} // setIsVisibleInMenu()

	/**
	 * Set the value of [current_layout] column.
	 * 
	 * @param      string $v new value
	 * @return     void
	 */
	public function setCurrentLayout($v)
	{

		// Since the native PHP type for this column is string,
		// we will cast the input to a string (if it is not).
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->current_layout !== $v) {
			$this->current_layout = $v;
			$this->modifiedColumns[] = NodePeer::CURRENT_LAYOUT;
		}

	} // setCurrentLayout()

	/**
	 * Set the value of [current_layout_type] column.
	 * 
	 * @param      int $v new value
	 * @return     void
	 */
	public function setCurrentLayoutType($v)
	{

		// Since the native PHP type for this column is integer,
		// we will cast the input value to an int (if it is not).
		if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->current_layout_type !== $v) {
			$this->current_layout_type = $v;
			$this->modifiedColumns[] = NodePeer::CURRENT_LAYOUT_TYPE;
		}

	} // setCurrentLayoutType()

	/**
	 * Set the value of [created_at] column.
	 * 
	 * @param      int $v new value
	 * @return     void
	 */
	public function setCreatedAt($v)
	{

		if ($v !== null && !is_int($v)) {
			$ts = strtotime($v);
			if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE
				throw new PropelException("Unable to parse date/time value for [created_at] from input: " . var_export($v, true));
			}
		} else {
			$ts = $v;
		}
		if ($this->created_at !== $ts) {
			$this->created_at = $ts;
			$this->modifiedColumns[] = NodePeer::CREATED_AT;
		}

	} // setCreatedAt()

	/**
	 * Set the value of [updated_at] column.
	 * 
	 * @param      int $v new value
	 * @return     void
	 */
	public function setUpdatedAt($v)
	{

		if ($v !== null && !is_int($v)) {
			$ts = strtotime($v);
			if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE
				throw new PropelException("Unable to parse date/time value for [updated_at] from input: " . var_export($v, true));
			}
		} else {
			$ts = $v;
		}
		if ($this->updated_at !== $ts) {
			$this->updated_at = $ts;
			$this->modifiedColumns[] = NodePeer::UPDATED_AT;
		}

	} // setUpdatedAt()

	/**
	 * Hydrates (populates) the object variables with values from the database resultset.
	 *
	 * An offset (1-based "start column") is specified so that objects can be hydrated
	 * with a subset of the columns in the resultset rows.  This is needed, for example,
	 * for results of JOIN queries where the resultset row includes columns from two or
	 * more tables.
	 *
	 * @param      ResultSet $rs The ResultSet class with cursor advanced to desired record pos.
	 * @param      int $startcol 1-based offset column which indicates which restultset column to start with.
	 * @return     int next starting column
	 * @throws     PropelException  - Any caught Exception will be rewrapped as a PropelException.
	 */
	public function hydrate(ResultSet $rs, $startcol = 1)
	{
		try {

			$this->id = $rs->getInt($startcol + 0);

			$this->is_public = $rs->getBoolean($startcol + 1);

			$this->node_class = $rs->getString($startcol + 2);

			$this->url_provider = $rs->getInt($startcol + 3);

			$this->open_target_provider = $rs->getInt($startcol + 4);

			$this->perms_type = $rs->getInt($startcol + 5);

			$this->credentials = $rs->getString($startcol + 6);

			$this->tree_left = $rs->getInt($startcol + 7);

			$this->tree_right = $rs->getInt($startcol + 8);

			$this->tree_parent = $rs->getInt($startcol + 9);

			$this->tree_id = $rs->getInt($startcol + 10);

			$this->is_visible_in_menu = $rs->getBoolean($startcol + 11);

			$this->current_layout = $rs->getString($startcol + 12);

			$this->current_layout_type = $rs->getInt($startcol + 13);

			$this->created_at = $rs->getTimestamp($startcol + 14, null);

			$this->updated_at = $rs->getTimestamp($startcol + 15, null);

			$this->resetModified();

			$this->setNew(false);

			// FIXME - using NUM_COLUMNS may be clearer.
			return $startcol + 16; // 16 = NodePeer::NUM_COLUMNS - NodePeer::NUM_LAZY_LOAD_COLUMNS).

		} catch (Exception $e) {
			throw new PropelException("Error populating Node object", $e);
		}
	}

	/**
	 * Removes this object from datastore and sets delete attribute.
	 *
	 * @param      Connection $con
	 * @return     void
	 * @throws     PropelException
	 * @see        BaseObject::setDeleted()
	 * @see        BaseObject::isDeleted()
	 */
	public function delete($con = null)
	{

    foreach (sfMixer::getCallables('BaseNode:delete:pre') as $callable)
    {
      $ret = call_user_func($callable, $this, $con);
      if ($ret)
      {
        return;
      }
    }


		if ($this->isDeleted()) {
			throw new PropelException("This object has already been deleted.");
		}

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

		try {
			$con->begin();
			NodePeer::doDelete($this, $con);
			$this->setDeleted(true);
			$con->commit();
		} catch (PropelException $e) {
			$con->rollback();
			throw $e;
		}
	

    foreach (sfMixer::getCallables('BaseNode:delete:post') as $callable)
    {
      call_user_func($callable, $this, $con);
    }

  }
	/**
	 * Stores the object in the database.  If the object is new,
	 * it inserts it; otherwise an update is performed.  This method
	 * wraps the doSave() worker method in a transaction.
	 *
	 * @param      Connection $con
	 * @return     int The number of rows affected by this insert/update and any referring fk objects' save() operations.
	 * @throws     PropelException
	 * @see        doSave()
	 */
	public function save($con = null)
	{

    foreach (sfMixer::getCallables('BaseNode:save:pre') as $callable)
    {
      $affectedRows = call_user_func($callable, $this, $con);
      if (is_int($affectedRows))
      {
        return $affectedRows;
      }
    }


    if ($this->isNew() && !$this->isColumnModified(NodePeer::CREATED_AT))
    {
      $this->setCreatedAt(time());
    }

    if ($this->isModified() && !$this->isColumnModified(NodePeer::UPDATED_AT))
    {
      $this->setUpdatedAt(time());
    }

		if ($this->isDeleted()) {
			throw new PropelException("You cannot save an object that has been deleted.");
		}

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

		try {
			$con->begin();
			$affectedRows = $this->doSave($con);
			$con->commit();
    foreach (sfMixer::getCallables('BaseNode:save:post') as $callable)
    {
      call_user_func($callable, $this, $con, $affectedRows);
    }

			return $affectedRows;
		} catch (PropelException $e) {
			$con->rollback();
			throw $e;
		}
	}

	/**
	 * Stores the object in the database.
	 *
	 * If the object is new, it inserts it; otherwise an update is performed.
	 * All related objects are also updated in this method.
	 *
	 * @param      Connection $con
	 * @return     int The number of rows affected by this insert/update and any referring fk objects' save() operations.
	 * @throws     PropelException
	 * @see        save()
	 */
	protected function doSave($con)
	{
		$affectedRows = 0; // initialize var to track total num of affected rows
		if (!$this->alreadyInSave) {
			$this->alreadyInSave = true;


			// If this object has been modified, then save it to the database.
			if ($this->isModified()) {
				if ($this->isNew()) {
					$pk = NodePeer::doInsert($this, $con);
					$affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which
										 // should always be true here (even though technically
										 // BasePeer::doInsert() can insert multiple rows).

					$this->setId($pk);  //[IMV] update autoincrement primary key

					$this->setNew(false);
				} else {
					$affectedRows += NodePeer::doUpdate($this, $con);
				}
				$this->resetModified(); // [HL] After being saved an object is no longer 'modified'
			}

			if ($this->collNodeI18ns !== null) {
				foreach($this->collNodeI18ns as $referrerFK) {
					if (!$referrerFK->isDeleted()) {
						$affectedRows += $referrerFK->save($con);
					}
				}
			}

			if ($this->collNodeSitemaps !== null) {
				foreach($this->collNodeSitemaps as $referrerFK) {
					if (!$referrerFK->isDeleted()) {
						$affectedRows += $referrerFK->save($con);
					}
				}
			}

			if ($this->collNodeHomes !== null) {
				foreach($this->collNodeHomes as $referrerFK) {
					if (!$referrerFK->isDeleted()) {
						$affectedRows += $referrerFK->save($con);
					}
				}
			}

			if ($this->collNodePages !== null) {
				foreach($this->collNodePages as $referrerFK) {
					if (!$referrerFK->isDeleted()) {
						$affectedRows += $referrerFK->save($con);
					}
				}
			}

			if ($this->collNodeNewss !== null) {
				foreach($this->collNodeNewss as $referrerFK) {
					if (!$referrerFK->isDeleted()) {
						$affectedRows += $referrerFK->save($con);
					}
				}
			}

			if ($this->collNodeNetworks !== null) {
				foreach($this->collNodeNetworks as $referrerFK) {
					if (!$referrerFK->isDeleted()) {
						$affectedRows += $referrerFK->save($con);
					}
				}
			}

			$this->alreadyInSave = false;
		}
		return $affectedRows;
	} // doSave()

	/**
	 * Array of ValidationFailed objects.
	 * @var        array ValidationFailed[]
	 */
	protected $validationFailures = array();

	/**
	 * Gets any ValidationFailed objects that resulted from last call to validate().
	 *
	 *
	 * @return     array ValidationFailed[]
	 * @see        validate()
	 */
	public function getValidationFailures()
	{
		return $this->validationFailures;
	}

	/**
	 * Validates the objects modified field values and all objects related to this table.
	 *
	 * If $columns is either a column name or an array of column names
	 * only those columns are validated.
	 *
	 * @param      mixed $columns Column name or an array of column names.
	 * @return     boolean Whether all columns pass validation.
	 * @see        doValidate()
	 * @see        getValidationFailures()
	 */
	public function validate($columns = null)
	{
		$res = $this->doValidate($columns);
		if ($res === true) {
			$this->validationFailures = array();
			return true;
		} else {
			$this->validationFailures = $res;
			return false;
		}
	}

	/**
	 * This function performs the validation work for complex object models.
	 *
	 * In addition to checking the current object, all related objects will
	 * also be validated.  If all pass then <code>true</code> is returned; otherwise
	 * an aggreagated array of ValidationFailed objects will be returned.
	 *
	 * @param      array $columns Array of column names to validate.
	 * @return     mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objets otherwise.
	 */
	protected function doValidate($columns = null)
	{
		if (!$this->alreadyInValidation) {
			$this->alreadyInValidation = true;
			$retval = null;

			$failureMap = array();


			if (($retval = NodePeer::doValidate($this, $columns)) !== true) {
				$failureMap = array_merge($failureMap, $retval);
			}


				if ($this->collNodeI18ns !== null) {
					foreach($this->collNodeI18ns as $referrerFK) {
						if (!$referrerFK->validate($columns)) {
							$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
						}
					}
				}

				if ($this->collNodeSitemaps !== null) {
					foreach($this->collNodeSitemaps as $referrerFK) {
						if (!$referrerFK->validate($columns)) {
							$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
						}
					}
				}

				if ($this->collNodeHomes !== null) {
					foreach($this->collNodeHomes as $referrerFK) {
						if (!$referrerFK->validate($columns)) {
							$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
						}
					}
				}

				if ($this->collNodePages !== null) {
					foreach($this->collNodePages as $referrerFK) {
						if (!$referrerFK->validate($columns)) {
							$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
						}
					}
				}

				if ($this->collNodeNewss !== null) {
					foreach($this->collNodeNewss as $referrerFK) {
						if (!$referrerFK->validate($columns)) {
							$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
						}
					}
				}

				if ($this->collNodeNetworks !== null) {
					foreach($this->collNodeNetworks as $referrerFK) {
						if (!$referrerFK->validate($columns)) {
							$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
						}
					}
				}


			$this->alreadyInValidation = false;
		}

		return (!empty($failureMap) ? $failureMap : true);
	}

	/**
	 * Retrieves a field from the object by name passed in as a string.
	 *
	 * @param      string $name name
	 * @param      string $type The type of fieldname the $name is of:
	 *                     one of the class type constants TYPE_PHPNAME,
	 *                     TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
	 * @return     mixed Value of field.
	 */
	public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
	{
		$pos = NodePeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
		return $this->getByPosition($pos);
	}

	/**
	 * Retrieves a field from the object by Position as specified in the xml schema.
	 * Zero-based.
	 *
	 * @param      int $pos position in xml schema
	 * @return     mixed Value of field at $pos
	 */
	public function getByPosition($pos)
	{
		switch($pos) {
			case 0:
				return $this->getId();
				break;
			case 1:
				return $this->getIsPublic();
				break;
			case 2:
				return $this->getNodeClass();
				break;
			case 3:
				return $this->getUrlProvider();
				break;
			case 4:
				return $this->getOpenTargetProvider();
				break;
			case 5:
				return $this->getPermsType();
				break;
			case 6:
				return $this->getCredentials();
				break;
			case 7:
				return $this->getTreeLeft();
				break;
			case 8:
				return $this->getTreeRight();
				break;
			case 9:
				return $this->getTreeParent();
				break;
			case 10:
				return $this->getTreeId();
				break;
			case 11:
				return $this->getIsVisibleInMenu();
				break;
			case 12:
				return $this->getCurrentLayout();
				break;
			case 13:
				return $this->getCurrentLayoutType();
				break;
			case 14:
				return $this->getCreatedAt();
				break;
			case 15:
				return $this->getUpdatedAt();
				break;
			default:
				return null;
				break;
		} // switch()
	}

	/**
	 * Exports the object as an array.
	 *
	 * You can specify the key type of the array by passing one of the class
	 * type constants.
	 *
	 * @param      string $keyType One of the class type constants TYPE_PHPNAME,
	 *                        TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
	 * @return     an associative array containing the field names (as keys) and field values
	 */
	public function toArray($keyType = BasePeer::TYPE_PHPNAME)
	{
		$keys = NodePeer::getFieldNames($keyType);
		$result = array(
			$keys[0] => $this->getId(),
			$keys[1] => $this->getIsPublic(),
			$keys[2] => $this->getNodeClass(),
			$keys[3] => $this->getUrlProvider(),
			$keys[4] => $this->getOpenTargetProvider(),
			$keys[5] => $this->getPermsType(),
			$keys[6] => $this->getCredentials(),
			$keys[7] => $this->getTreeLeft(),
			$keys[8] => $this->getTreeRight(),
			$keys[9] => $this->getTreeParent(),
			$keys[10] => $this->getTreeId(),
			$keys[11] => $this->getIsVisibleInMenu(),
			$keys[12] => $this->getCurrentLayout(),
			$keys[13] => $this->getCurrentLayoutType(),
			$keys[14] => $this->getCreatedAt(),
			$keys[15] => $this->getUpdatedAt(),
		);
		return $result;
	}

	/**
	 * Sets a field from the object by name passed in as a string.
	 *
	 * @param      string $name peer name
	 * @param      mixed $value field value
	 * @param      string $type The type of fieldname the $name is of:
	 *                     one of the class type constants TYPE_PHPNAME,
	 *                     TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
	 * @return     void
	 */
	public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
	{
		$pos = NodePeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
		return $this->setByPosition($pos, $value);
	}

	/**
	 * Sets a field from the object by Position as specified in the xml schema.
	 * Zero-based.
	 *
	 * @param      int $pos position in xml schema
	 * @param      mixed $value field value
	 * @return     void
	 */
	public function setByPosition($pos, $value)
	{
		switch($pos) {
			case 0:
				$this->setId($value);
				break;
			case 1:
				$this->setIsPublic($value);
				break;
			case 2:
				$this->setNodeClass($value);
				break;
			case 3:
				$this->setUrlProvider($value);
				break;
			case 4:
				$this->setOpenTargetProvider($value);
				break;
			case 5:
				$this->setPermsType($value);
				break;
			case 6:
				$this->setCredentials($value);
				break;
			case 7:
				$this->setTreeLeft($value);
				break;
			case 8:
				$this->setTreeRight($value);
				break;
			case 9:
				$this->setTreeParent($value);
				break;
			case 10:
				$this->setTreeId($value);
				break;
			case 11:
				$this->setIsVisibleInMenu($value);
				break;
			case 12:
				$this->setCurrentLayout($value);
				break;
			case 13:
				$this->setCurrentLayoutType($value);
				break;
			case 14:
				$this->setCreatedAt($value);
				break;
			case 15:
				$this->setUpdatedAt($value);
				break;
		} // switch()
	}

	/**
	 * Populates the object using an array.
	 *
	 * This is particularly useful when populating an object from one of the
	 * request arrays (e.g. $_POST).  This method goes through the column
	 * names, checking to see whether a matching key exists in populated
	 * array. If so the setByName() method is called for that column.
	 *
	 * You can specify the key type of the array by additionally passing one
	 * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME,
	 * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId')
	 *
	 * @param      array  $arr     An array to populate the object from.
	 * @param      string $keyType The type of keys the array uses.
	 * @return     void
	 */
	public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
	{
		$keys = NodePeer::getFieldNames($keyType);

		if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
		if (array_key_exists($keys[1], $arr)) $this->setIsPublic($arr[$keys[1]]);
		if (array_key_exists($keys[2], $arr)) $this->setNodeClass($arr[$keys[2]]);
		if (array_key_exists($keys[3], $arr)) $this->setUrlProvider($arr[$keys[3]]);
		if (array_key_exists($keys[4], $arr)) $this->setOpenTargetProvider($arr[$keys[4]]);
		if (array_key_exists($keys[5], $arr)) $this->setPermsType($arr[$keys[5]]);
		if (array_key_exists($keys[6], $arr)) $this->setCredentials($arr[$keys[6]]);
		if (array_key_exists($keys[7], $arr)) $this->setTreeLeft($arr[$keys[7]]);
		if (array_key_exists($keys[8], $arr)) $this->setTreeRight($arr[$keys[8]]);
		if (array_key_exists($keys[9], $arr)) $this->setTreeParent($arr[$keys[9]]);
		if (array_key_exists($keys[10], $arr)) $this->setTreeId($arr[$keys[10]]);
		if (array_key_exists($keys[11], $arr)) $this->setIsVisibleInMenu($arr[$keys[11]]);
		if (array_key_exists($keys[12], $arr)) $this->setCurrentLayout($arr[$keys[12]]);
		if (array_key_exists($keys[13], $arr)) $this->setCurrentLayoutType($arr[$keys[13]]);
		if (array_key_exists($keys[14], $arr)) $this->setCreatedAt($arr[$keys[14]]);
		if (array_key_exists($keys[15], $arr)) $this->setUpdatedAt($arr[$keys[15]]);
	}

	/**
	 * Build a Criteria object containing the values of all modified columns in this object.
	 *
	 * @return     Criteria The Criteria object containing all modified values.
	 */
	public function buildCriteria()
	{
		$criteria = new Criteria(NodePeer::DATABASE_NAME);

		if ($this->isColumnModified(NodePeer::ID)) $criteria->add(NodePeer::ID, $this->id);
		if ($this->isColumnModified(NodePeer::IS_PUBLIC)) $criteria->add(NodePeer::IS_PUBLIC, $this->is_public);
		if ($this->isColumnModified(NodePeer::NODE_CLASS)) $criteria->add(NodePeer::NODE_CLASS, $this->node_class);
		if ($this->isColumnModified(NodePeer::URL_PROVIDER)) $criteria->add(NodePeer::URL_PROVIDER, $this->url_provider);
		if ($this->isColumnModified(NodePeer::OPEN_TARGET_PROVIDER)) $criteria->add(NodePeer::OPEN_TARGET_PROVIDER, $this->open_target_provider);
		if ($this->isColumnModified(NodePeer::PERMS_TYPE)) $criteria->add(NodePeer::PERMS_TYPE, $this->perms_type);
		if ($this->isColumnModified(NodePeer::CREDENTIALS)) $criteria->add(NodePeer::CREDENTIALS, $this->credentials);
		if ($this->isColumnModified(NodePeer::TREE_LEFT)) $criteria->add(NodePeer::TREE_LEFT, $this->tree_left);
		if ($this->isColumnModified(NodePeer::TREE_RIGHT)) $criteria->add(NodePeer::TREE_RIGHT, $this->tree_right);
		if ($this->isColumnModified(NodePeer::TREE_PARENT)) $criteria->add(NodePeer::TREE_PARENT, $this->tree_parent);
		if ($this->isColumnModified(NodePeer::TREE_ID)) $criteria->add(NodePeer::TREE_ID, $this->tree_id);
		if ($this->isColumnModified(NodePeer::IS_VISIBLE_IN_MENU)) $criteria->add(NodePeer::IS_VISIBLE_IN_MENU, $this->is_visible_in_menu);
		if ($this->isColumnModified(NodePeer::CURRENT_LAYOUT)) $criteria->add(NodePeer::CURRENT_LAYOUT, $this->current_layout);
		if ($this->isColumnModified(NodePeer::CURRENT_LAYOUT_TYPE)) $criteria->add(NodePeer::CURRENT_LAYOUT_TYPE, $this->current_layout_type);
		if ($this->isColumnModified(NodePeer::CREATED_AT)) $criteria->add(NodePeer::CREATED_AT, $this->created_at);
		if ($this->isColumnModified(NodePeer::UPDATED_AT)) $criteria->add(NodePeer::UPDATED_AT, $this->updated_at);

		return $criteria;
	}

	/**
	 * Builds a Criteria object containing the primary key for this object.
	 *
	 * Unlike buildCriteria() this method includes the primary key values regardless
	 * of whether or not they have been modified.
	 *
	 * @return     Criteria The Criteria object containing value(s) for primary key(s).
	 */
	public function buildPkeyCriteria()
	{
		$criteria = new Criteria(NodePeer::DATABASE_NAME);

		$criteria->add(NodePeer::ID, $this->id);

		return $criteria;
	}

	/**
	 * Returns the primary key for this object (row).
	 * @return     int
	 */
	public function getPrimaryKey()
	{
		return $this->getId();
	}

	/**
	 * Generic method to set the primary key (id column).
	 *
	 * @param      int $key Primary key.
	 * @return     void
	 */
	public function setPrimaryKey($key)
	{
		$this->setId($key);
	}

	/**
	 * Sets contents of passed object to values from current object.
	 *
	 * If desired, this method can also make copies of all associated (fkey referrers)
	 * objects.
	 *
	 * @param      object $copyObj An object of Node (or compatible) type.
	 * @param      boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
	 * @throws     PropelException
	 */
	public function copyInto($copyObj, $deepCopy = false)
	{

		$copyObj->setIsPublic($this->is_public);

		$copyObj->setNodeClass($this->node_class);

		$copyObj->setUrlProvider($this->url_provider);

		$copyObj->setOpenTargetProvider($this->open_target_provider);

		$copyObj->setPermsType($this->perms_type);

		$copyObj->setCredentials($this->credentials);

		$copyObj->setTreeLeft($this->tree_left);

		$copyObj->setTreeRight($this->tree_right);

		$copyObj->setTreeParent($this->tree_parent);

		$copyObj->setTreeId($this->tree_id);

		$copyObj->setIsVisibleInMenu($this->is_visible_in_menu);

		$copyObj->setCurrentLayout($this->current_layout);

		$copyObj->setCurrentLayoutType($this->current_layout_type);

		$copyObj->setCreatedAt($this->created_at);

		$copyObj->setUpdatedAt($this->updated_at);


		if ($deepCopy) {
			// important: temporarily setNew(false) because this affects the behavior of
			// the getter/setter methods for fkey referrer objects.
			$copyObj->setNew(false);

			foreach($this->getNodeI18ns() as $relObj) {
				$copyObj->addNodeI18n($relObj->copy($deepCopy));
			}

			foreach($this->getNodeSitemaps() as $relObj) {
				$copyObj->addNodeSitemap($relObj->copy($deepCopy));
			}

			foreach($this->getNodeHomes() as $relObj) {
				$copyObj->addNodeHome($relObj->copy($deepCopy));
			}

			foreach($this->getNodePages() as $relObj) {
				$copyObj->addNodePage($relObj->copy($deepCopy));
			}

			foreach($this->getNodeNewss() as $relObj) {
				$copyObj->addNodeNews($relObj->copy($deepCopy));
			}

			foreach($this->getNodeNetworks() as $relObj) {
				$copyObj->addNodeNetwork($relObj->copy($deepCopy));
			}

		} // if ($deepCopy)


		$copyObj->setNew(true);

		$copyObj->setId(NULL); // this is a pkey column, so set to default value

	}

	/**
	 * Makes a copy of this object that will be inserted as a new row in table when saved.
	 * It creates a new object filling in the simple attributes, but skipping any primary
	 * keys that are defined for the table.
	 *
	 * If desired, this method can also make copies of all associated (fkey referrers)
	 * objects.
	 *
	 * @param      boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
	 * @return     Node Clone of current object.
	 * @throws     PropelException
	 */
	public function copy($deepCopy = false)
	{
		// we use get_class(), because this might be a subclass
		$clazz = get_class($this);
		$copyObj = new $clazz();
		$this->copyInto($copyObj, $deepCopy);
		return $copyObj;
	}

	/**
	 * Returns a peer instance associated with this om.
	 *
	 * Since Peer classes are not to have any instance attributes, this method returns the
	 * same instance for all member of this class. The method could therefore
	 * be static, but this would prevent one from overriding the behavior.
	 *
	 * @return     NodePeer
	 */
	public function getPeer()
	{
		if (self::$peer === null) {
			self::$peer = new NodePeer();
		}
		return self::$peer;
	}

	/**
	 * Temporary storage of collNodeI18ns to save a possible db hit in
	 * the event objects are add to the collection, but the
	 * complete collection is never requested.
	 * @return     void
	 */
	public function initNodeI18ns()
	{
		if ($this->collNodeI18ns === null) {
			$this->collNodeI18ns = array();
		}
	}

	/**
	 * If this collection has already been initialized with
	 * an identical criteria, it returns the collection.
	 * Otherwise if this Node has previously
	 * been saved, it will retrieve related NodeI18ns from storage.
	 * If this Node is new, it will return
	 * an empty collection or the current collection, the criteria
	 * is ignored on a new object.
	 *
	 * @param      Connection $con
	 * @param      Criteria $criteria
	 * @throws     PropelException
	 */
	public function getNodeI18ns($criteria = null, $con = null)
	{
		// include the Peer class
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collNodeI18ns === null) {
			if ($this->isNew()) {
			   $this->collNodeI18ns = array();
			} else {

				$criteria->add(NodeI18nPeer::ID, $this->getId());

				NodeI18nPeer::addSelectColumns($criteria);
				$this->collNodeI18ns = NodeI18nPeer::doSelect($criteria, $con);
			}
		} else {
			// criteria has no effect for a new object
			if (!$this->isNew()) {
				// the following code is to determine if a new query is
				// called for.  If the criteria is the same as the last
				// one, just return the collection.


				$criteria->add(NodeI18nPeer::ID, $this->getId());

				NodeI18nPeer::addSelectColumns($criteria);
				if (!isset($this->lastNodeI18nCriteria) || !$this->lastNodeI18nCriteria->equals($criteria)) {
					$this->collNodeI18ns = NodeI18nPeer::doSelect($criteria, $con);
				}
			}
		}
		$this->lastNodeI18nCriteria = $criteria;
		return $this->collNodeI18ns;
	}

	/**
	 * Returns the number of related NodeI18ns.
	 *
	 * @param      Criteria $criteria
	 * @param      boolean $distinct
	 * @param      Connection $con
	 * @throws     PropelException
	 */
	public function countNodeI18ns($criteria = null, $distinct = false, $con = null)
	{
		// include the Peer class
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		$criteria->add(NodeI18nPeer::ID, $this->getId());

		return NodeI18nPeer::doCount($criteria, $distinct, $con);
	}

	/**
	 * Method called to associate a NodeI18n object to this object
	 * through the NodeI18n foreign key attribute
	 *
	 * @param      NodeI18n $l NodeI18n
	 * @return     void
	 * @throws     PropelException
	 */
	public function addNodeI18n(NodeI18n $l)
	{
		$this->collNodeI18ns[] = $l;
		$l->setNode($this);
	}

	/**
	 * Temporary storage of collNodeSitemaps to save a possible db hit in
	 * the event objects are add to the collection, but the
	 * complete collection is never requested.
	 * @return     void
	 */
	public function initNodeSitemaps()
	{
		if ($this->collNodeSitemaps === null) {
			$this->collNodeSitemaps = array();
		}
	}

	/**
	 * If this collection has already been initialized with
	 * an identical criteria, it returns the collection.
	 * Otherwise if this Node has previously
	 * been saved, it will retrieve related NodeSitemaps from storage.
	 * If this Node is new, it will return
	 * an empty collection or the current collection, the criteria
	 * is ignored on a new object.
	 *
	 * @param      Connection $con
	 * @param      Criteria $criteria
	 * @throws     PropelException
	 */
	public function getNodeSitemaps($criteria = null, $con = null)
	{
		// include the Peer class
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collNodeSitemaps === null) {
			if ($this->isNew()) {
			   $this->collNodeSitemaps = array();
			} else {

				$criteria->add(NodeSitemapPeer::NODE_ID, $this->getId());

				NodeSitemapPeer::addSelectColumns($criteria);
				$this->collNodeSitemaps = NodeSitemapPeer::doSelect($criteria, $con);
			}
		} else {
			// criteria has no effect for a new object
			if (!$this->isNew()) {
				// the following code is to determine if a new query is
				// called for.  If the criteria is the same as the last
				// one, just return the collection.


				$criteria->add(NodeSitemapPeer::NODE_ID, $this->getId());

				NodeSitemapPeer::addSelectColumns($criteria);
				if (!isset($this->lastNodeSitemapCriteria) || !$this->lastNodeSitemapCriteria->equals($criteria)) {
					$this->collNodeSitemaps = NodeSitemapPeer::doSelect($criteria, $con);
				}
			}
		}
		$this->lastNodeSitemapCriteria = $criteria;
		return $this->collNodeSitemaps;
	}

	/**
	 * Returns the number of related NodeSitemaps.
	 *
	 * @param      Criteria $criteria
	 * @param      boolean $distinct
	 * @param      Connection $con
	 * @throws     PropelException
	 */
	public function countNodeSitemaps($criteria = null, $distinct = false, $con = null)
	{
		// include the Peer class
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		$criteria->add(NodeSitemapPeer::NODE_ID, $this->getId());

		return NodeSitemapPeer::doCount($criteria, $distinct, $con);
	}

	/**
	 * Method called to associate a NodeSitemap object to this object
	 * through the NodeSitemap foreign key attribute
	 *
	 * @param      NodeSitemap $l NodeSitemap
	 * @return     void
	 * @throws     PropelException
	 */
	public function addNodeSitemap(NodeSitemap $l)
	{
		$this->collNodeSitemaps[] = $l;
		$l->setNode($this);
	}

	/**
	 * Temporary storage of collNodeHomes to save a possible db hit in
	 * the event objects are add to the collection, but the
	 * complete collection is never requested.
	 * @return     void
	 */
	public function initNodeHomes()
	{
		if ($this->collNodeHomes === null) {
			$this->collNodeHomes = array();
		}
	}

	/**
	 * If this collection has already been initialized with
	 * an identical criteria, it returns the collection.
	 * Otherwise if this Node has previously
	 * been saved, it will retrieve related NodeHomes from storage.
	 * If this Node is new, it will return
	 * an empty collection or the current collection, the criteria
	 * is ignored on a new object.
	 *
	 * @param      Connection $con
	 * @param      Criteria $criteria
	 * @throws     PropelException
	 */
	public function getNodeHomes($criteria = null, $con = null)
	{
		// include the Peer class
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collNodeHomes === null) {
			if ($this->isNew()) {
			   $this->collNodeHomes = array();
			} else {

				$criteria->add(NodeHomePeer::NODE_ID, $this->getId());

				NodeHomePeer::addSelectColumns($criteria);
				$this->collNodeHomes = NodeHomePeer::doSelect($criteria, $con);
			}
		} else {
			// criteria has no effect for a new object
			if (!$this->isNew()) {
				// the following code is to determine if a new query is
				// called for.  If the criteria is the same as the last
				// one, just return the collection.


				$criteria->add(NodeHomePeer::NODE_ID, $this->getId());

				NodeHomePeer::addSelectColumns($criteria);
				if (!isset($this->lastNodeHomeCriteria) || !$this->lastNodeHomeCriteria->equals($criteria)) {
					$this->collNodeHomes = NodeHomePeer::doSelect($criteria, $con);
				}
			}
		}
		$this->lastNodeHomeCriteria = $criteria;
		return $this->collNodeHomes;
	}

	/**
	 * Returns the number of related NodeHomes.
	 *
	 * @param      Criteria $criteria
	 * @param      boolean $distinct
	 * @param      Connection $con
	 * @throws     PropelException
	 */
	public function countNodeHomes($criteria = null, $distinct = false, $con = null)
	{
		// include the Peer class
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		$criteria->add(NodeHomePeer::NODE_ID, $this->getId());

		return NodeHomePeer::doCount($criteria, $distinct, $con);
	}

	/**
	 * Method called to associate a NodeHome object to this object
	 * through the NodeHome foreign key attribute
	 *
	 * @param      NodeHome $l NodeHome
	 * @return     void
	 * @throws     PropelException
	 */
	public function addNodeHome(NodeHome $l)
	{
		$this->collNodeHomes[] = $l;
		$l->setNode($this);
	}

	/**
	 * Temporary storage of collNodePages to save a possible db hit in
	 * the event objects are add to the collection, but the
	 * complete collection is never requested.
	 * @return     void
	 */
	public function initNodePages()
	{
		if ($this->collNodePages === null) {
			$this->collNodePages = array();
		}
	}

	/**
	 * If this collection has already been initialized with
	 * an identical criteria, it returns the collection.
	 * Otherwise if this Node has previously
	 * been saved, it will retrieve related NodePages from storage.
	 * If this Node is new, it will return
	 * an empty collection or the current collection, the criteria
	 * is ignored on a new object.
	 *
	 * @param      Connection $con
	 * @param      Criteria $criteria
	 * @throws     PropelException
	 */
	public function getNodePages($criteria = null, $con = null)
	{
		// include the Peer class
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collNodePages === null) {
			if ($this->isNew()) {
			   $this->collNodePages = array();
			} else {

				$criteria->add(NodePagePeer::NODE_ID, $this->getId());

				NodePagePeer::addSelectColumns($criteria);
				$this->collNodePages = NodePagePeer::doSelect($criteria, $con);
			}
		} else {
			// criteria has no effect for a new object
			if (!$this->isNew()) {
				// the following code is to determine if a new query is
				// called for.  If the criteria is the same as the last
				// one, just return the collection.


				$criteria->add(NodePagePeer::NODE_ID, $this->getId());

				NodePagePeer::addSelectColumns($criteria);
				if (!isset($this->lastNodePageCriteria) || !$this->lastNodePageCriteria->equals($criteria)) {
					$this->collNodePages = NodePagePeer::doSelect($criteria, $con);
				}
			}
		}
		$this->lastNodePageCriteria = $criteria;
		return $this->collNodePages;
	}

	/**
	 * Returns the number of related NodePages.
	 *
	 * @param      Criteria $criteria
	 * @param      boolean $distinct
	 * @param      Connection $con
	 * @throws     PropelException
	 */
	public function countNodePages($criteria = null, $distinct = false, $con = null)
	{
		// include the Peer class
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		$criteria->add(NodePagePeer::NODE_ID, $this->getId());

		return NodePagePeer::doCount($criteria, $distinct, $con);
	}

	/**
	 * Method called to associate a NodePage object to this object
	 * through the NodePage foreign key attribute
	 *
	 * @param      NodePage $l NodePage
	 * @return     void
	 * @throws     PropelException
	 */
	public function addNodePage(NodePage $l)
	{
		$this->collNodePages[] = $l;
		$l->setNode($this);
	}

	/**
	 * Temporary storage of collNodeNewss to save a possible db hit in
	 * the event objects are add to the collection, but the
	 * complete collection is never requested.
	 * @return     void
	 */
	public function initNodeNewss()
	{
		if ($this->collNodeNewss === null) {
			$this->collNodeNewss = array();
		}
	}

	/**
	 * If this collection has already been initialized with
	 * an identical criteria, it returns the collection.
	 * Otherwise if this Node has previously
	 * been saved, it will retrieve related NodeNewss from storage.
	 * If this Node is new, it will return
	 * an empty collection or the current collection, the criteria
	 * is ignored on a new object.
	 *
	 * @param      Connection $con
	 * @param      Criteria $criteria
	 * @throws     PropelException
	 */
	public function getNodeNewss($criteria = null, $con = null)
	{
		// include the Peer class
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collNodeNewss === null) {
			if ($this->isNew()) {
			   $this->collNodeNewss = array();
			} else {

				$criteria->add(NodeNewsPeer::NODE_ID, $this->getId());

				NodeNewsPeer::addSelectColumns($criteria);
				$this->collNodeNewss = NodeNewsPeer::doSelect($criteria, $con);
			}
		} else {
			// criteria has no effect for a new object
			if (!$this->isNew()) {
				// the following code is to determine if a new query is
				// called for.  If the criteria is the same as the last
				// one, just return the collection.


				$criteria->add(NodeNewsPeer::NODE_ID, $this->getId());

				NodeNewsPeer::addSelectColumns($criteria);
				if (!isset($this->lastNodeNewsCriteria) || !$this->lastNodeNewsCriteria->equals($criteria)) {
					$this->collNodeNewss = NodeNewsPeer::doSelect($criteria, $con);
				}
			}
		}
		$this->lastNodeNewsCriteria = $criteria;
		return $this->collNodeNewss;
	}

	/**
	 * Returns the number of related NodeNewss.
	 *
	 * @param      Criteria $criteria
	 * @param      boolean $distinct
	 * @param      Connection $con
	 * @throws     PropelException
	 */
	public function countNodeNewss($criteria = null, $distinct = false, $con = null)
	{
		// include the Peer class
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		$criteria->add(NodeNewsPeer::NODE_ID, $this->getId());

		return NodeNewsPeer::doCount($criteria, $distinct, $con);
	}

	/**
	 * Method called to associate a NodeNews object to this object
	 * through the NodeNews foreign key attribute
	 *
	 * @param      NodeNews $l NodeNews
	 * @return     void
	 * @throws     PropelException
	 */
	public function addNodeNews(NodeNews $l)
	{
		$this->collNodeNewss[] = $l;
		$l->setNode($this);
	}

	/**
	 * Temporary storage of collNodeNetworks to save a possible db hit in
	 * the event objects are add to the collection, but the
	 * complete collection is never requested.
	 * @return     void
	 */
	public function initNodeNetworks()
	{
		if ($this->collNodeNetworks === null) {
			$this->collNodeNetworks = array();
		}
	}

	/**
	 * If this collection has already been initialized with
	 * an identical criteria, it returns the collection.
	 * Otherwise if this Node has previously
	 * been saved, it will retrieve related NodeNetworks from storage.
	 * If this Node is new, it will return
	 * an empty collection or the current collection, the criteria
	 * is ignored on a new object.
	 *
	 * @param      Connection $con
	 * @param      Criteria $criteria
	 * @throws     PropelException
	 */
	public function getNodeNetworks($criteria = null, $con = null)
	{
		// include the Peer class
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collNodeNetworks === null) {
			if ($this->isNew()) {
			   $this->collNodeNetworks = array();
			} else {

				$criteria->add(NodeNetworkPeer::NODE_ID, $this->getId());

				NodeNetworkPeer::addSelectColumns($criteria);
				$this->collNodeNetworks = NodeNetworkPeer::doSelect($criteria, $con);
			}
		} else {
			// criteria has no effect for a new object
			if (!$this->isNew()) {
				// the following code is to determine if a new query is
				// called for.  If the criteria is the same as the last
				// one, just return the collection.


				$criteria->add(NodeNetworkPeer::NODE_ID, $this->getId());

				NodeNetworkPeer::addSelectColumns($criteria);
				if (!isset($this->lastNodeNetworkCriteria) || !$this->lastNodeNetworkCriteria->equals($criteria)) {
					$this->collNodeNetworks = NodeNetworkPeer::doSelect($criteria, $con);
				}
			}
		}
		$this->lastNodeNetworkCriteria = $criteria;
		return $this->collNodeNetworks;
	}

	/**
	 * Returns the number of related NodeNetworks.
	 *
	 * @param      Criteria $criteria
	 * @param      boolean $distinct
	 * @param      Connection $con
	 * @throws     PropelException
	 */
	public function countNodeNetworks($criteria = null, $distinct = false, $con = null)
	{
		// include the Peer class
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		$criteria->add(NodeNetworkPeer::NODE_ID, $this->getId());

		return NodeNetworkPeer::doCount($criteria, $distinct, $con);
	}

	/**
	 * Method called to associate a NodeNetwork object to this object
	 * through the NodeNetwork foreign key attribute
	 *
	 * @param      NodeNetwork $l NodeNetwork
	 * @return     void
	 * @throws     PropelException
	 */
	public function addNodeNetwork(NodeNetwork $l)
	{
		$this->collNodeNetworks[] = $l;
		$l->setNode($this);
	}

  public function getCulture()
  {
    return $this->culture;
  }

  public function setCulture($culture)
  {
    $this->culture = $culture;
  }

  public function getUrlType($culture = null)
  {
    return $this->getCurrentNodeI18n($culture)->getUrlType();
  }

  public function setUrlType($value, $culture = null)
  {
    $this->getCurrentNodeI18n($culture)->setUrlType($value);
  }

  public function getUrlIdentifier($culture = null)
  {
    return $this->getCurrentNodeI18n($culture)->getUrlIdentifier();
  }

  public function setUrlIdentifier($value, $culture = null)
  {
    $this->getCurrentNodeI18n($culture)->setUrlIdentifier($value);
  }

  public function getTitle($culture = null)
  {
    return $this->getCurrentNodeI18n($culture)->getTitle();
  }

  public function setTitle($value, $culture = null)
  {
    $this->getCurrentNodeI18n($culture)->setTitle($value);
  }

  public function getSubTitle($culture = null)
  {
    return $this->getCurrentNodeI18n($culture)->getSubTitle();
  }

  public function setSubTitle($value, $culture = null)
  {
    $this->getCurrentNodeI18n($culture)->setSubTitle($value);
  }

  public function getBrowserTitleType($culture = null)
  {
    return $this->getCurrentNodeI18n($culture)->getBrowserTitleType();
  }

  public function setBrowserTitleType($value, $culture = null)
  {
    $this->getCurrentNodeI18n($culture)->setBrowserTitleType($value);
  }

  public function getBrowserTitleContent($culture = null)
  {
    return $this->getCurrentNodeI18n($culture)->getBrowserTitleContent();
  }

  public function setBrowserTitleContent($value, $culture = null)
  {
    $this->getCurrentNodeI18n($culture)->setBrowserTitleContent($value);
  }

  public function getSeoKeywordsType($culture = null)
  {
    return $this->getCurrentNodeI18n($culture)->getSeoKeywordsType();
  }

  public function setSeoKeywordsType($value, $culture = null)
  {
    $this->getCurrentNodeI18n($culture)->setSeoKeywordsType($value);
  }

  public function getSeoKeywordsContent($culture = null)
  {
    return $this->getCurrentNodeI18n($culture)->getSeoKeywordsContent();
  }

  public function setSeoKeywordsContent($value, $culture = null)
  {
    $this->getCurrentNodeI18n($culture)->setSeoKeywordsContent($value);
  }

  public function getSeoDescriptionType($culture = null)
  {
    return $this->getCurrentNodeI18n($culture)->getSeoDescriptionType();
  }

  public function setSeoDescriptionType($value, $culture = null)
  {
    $this->getCurrentNodeI18n($culture)->setSeoDescriptionType($value);
  }

  public function getSeoDescriptionContent($culture = null)
  {
    return $this->getCurrentNodeI18n($culture)->getSeoDescriptionContent();
  }

  public function setSeoDescriptionContent($value, $culture = null)
  {
    $this->getCurrentNodeI18n($culture)->setSeoDescriptionContent($value);
  }

  public function getMenuTitleType($culture = null)
  {
    return $this->getCurrentNodeI18n($culture)->getMenuTitleType();
  }

  public function setMenuTitleType($value, $culture = null)
  {
    $this->getCurrentNodeI18n($culture)->setMenuTitleType($value);
  }

  public function getMenuTitleContent($culture = null)
  {
    return $this->getCurrentNodeI18n($culture)->getMenuTitleContent();
  }

  public function setMenuTitleContent($value, $culture = null)
  {
    $this->getCurrentNodeI18n($culture)->setMenuTitleContent($value);
  }

  protected $current_i18n = array();

  public function getCurrentNodeI18n($culture = null)
  {
    if (is_null($culture))
    {
      $culture = is_null($this->culture) ? sfPropel::getDefaultCulture() : $this->culture;
    }

    if (!isset($this->current_i18n[$culture]))
    {
      $obj = NodeI18nPeer::retrieveByPK($this->getId(), $culture);
      if ($obj)
      {
        $this->setNodeI18nForCulture($obj, $culture);
      }
      else
      {
        $this->setNodeI18nForCulture(new NodeI18n(), $culture);
        $this->current_i18n[$culture]->setCulture($culture);
      }
    }

    return $this->current_i18n[$culture];
  }

  public function setNodeI18nForCulture($object, $culture)
  {
    $this->current_i18n[$culture] = $object;
    $this->addNodeI18n($object);
  }


  public function __call($method, $arguments)
  {
    if (!$callable = sfMixer::getCallable('BaseNode:'.$method))
    {
      throw new sfException(sprintf('Call to undefined method BaseNode::%s', $method));
    }

    array_unshift($arguments, $this);

    return call_user_func_array($callable, $arguments);
  }


} // BaseNode
