<?php


abstract class BaseTblblogcategory extends BaseObject  implements Persistent {


	
	protected static $peer;

	
	protected $cat_id;

	
	protected $cat_blog;

	
	protected $cat_parent;

	
	protected $cat_path;

	
	protected $cat_name;

	
	protected $cat_type;

	
	protected $cat_public;

	
	protected $cat_base;

	
	protected $cat_config;

	
	protected $cat_config_isLoaded = false;

	
	protected $cat_order;

	
	protected $aTblcategory;

	
	protected $collTblblogentrys;

	
	private $lastTblblogentryCriteria = null;

	
	protected $alreadyInSave = false;

	
	protected $alreadyInValidation = false;

	
	public function __construct()
	{
		parent::__construct();
		$this->applyDefaultValues();
	}

	
	public function applyDefaultValues()
	{
		$this->cat_public = 2;
		$this->cat_base = 0;
		$this->cat_order = 0;
	}

	
	public function getCatId()
	{
		return $this->cat_id;
	}

	
	public function getCatBlog()
	{
		return $this->cat_blog;
	}

	
	public function getCatParent()
	{
		return $this->cat_parent;
	}

	
	public function getCatPath()
	{
		return $this->cat_path;
	}

	
	public function getCatName()
	{
		return $this->cat_name;
	}

	
	public function getCatType()
	{
		return $this->cat_type;
	}

	
	public function getCatPublic()
	{
		return $this->cat_public;
	}

	
	public function getCatBase()
	{
		return $this->cat_base;
	}

	
	public function getCatConfig(PropelPDO $con = null)
	{
		if (!$this->cat_config_isLoaded && $this->cat_config === null && !$this->isNew()) {
			$this->loadCatConfig($con);
		}

		return $this->cat_config;
	}

	
	protected function loadCatConfig(PropelPDO $con = null)
	{
		$c = $this->buildPkeyCriteria();
		$c->addSelectColumn(TblblogcategoryPeer::CAT_CONFIG);
		try {
			$stmt = TblblogcategoryPeer::doSelectStmt($c, $con);
			$row = $stmt->fetch(PDO::FETCH_NUM);
			$stmt->closeCursor();
			$this->cat_config = ($row[0] !== null) ? (string) $row[0] : null;
			$this->cat_config_isLoaded = true;
		} catch (Exception $e) {
			throw new PropelException("Error loading value for [cat_config] column on demand.", $e);
		}
	}
	
	public function getCatOrder()
	{
		return $this->cat_order;
	}

	
	public function setCatId($v)
	{
		if ($v !== null) {
			$v = (int) $v;
		}

		if ($this->cat_id !== $v) {
			$this->cat_id = $v;
			$this->modifiedColumns[] = TblblogcategoryPeer::CAT_ID;
		}

		return $this;
	} 
	
	public function setCatBlog($v)
	{
		if ($v !== null) {
			$v = (int) $v;
		}

		if ($this->cat_blog !== $v) {
			$this->cat_blog = $v;
			$this->modifiedColumns[] = TblblogcategoryPeer::CAT_BLOG;
		}

		return $this;
	} 
	
	public function setCatParent($v)
	{
		if ($v !== null) {
			$v = (int) $v;
		}

		if ($this->cat_parent !== $v) {
			$this->cat_parent = $v;
			$this->modifiedColumns[] = TblblogcategoryPeer::CAT_PARENT;
		}

		return $this;
	} 
	
	public function setCatPath($v)
	{
		if ($v !== null) {
			$v = (string) $v;
		}

		if ($this->cat_path !== $v) {
			$this->cat_path = $v;
			$this->modifiedColumns[] = TblblogcategoryPeer::CAT_PATH;
		}

		return $this;
	} 
	
	public function setCatName($v)
	{
		if ($v !== null) {
			$v = (string) $v;
		}

		if ($this->cat_name !== $v) {
			$this->cat_name = $v;
			$this->modifiedColumns[] = TblblogcategoryPeer::CAT_NAME;
		}

		return $this;
	} 
	
	public function setCatType($v)
	{
		if ($v !== null) {
			$v = (int) $v;
		}

		if ($this->cat_type !== $v) {
			$this->cat_type = $v;
			$this->modifiedColumns[] = TblblogcategoryPeer::CAT_TYPE;
		}

		return $this;
	} 
	
	public function setCatPublic($v)
	{
		if ($v !== null) {
			$v = (int) $v;
		}

		if ($this->cat_public !== $v || $v === 2) {
			$this->cat_public = $v;
			$this->modifiedColumns[] = TblblogcategoryPeer::CAT_PUBLIC;
		}

		return $this;
	} 
	
	public function setCatBase($v)
	{
		if ($v !== null) {
			$v = (int) $v;
		}

		if ($this->cat_base !== $v || $v === 0) {
			$this->cat_base = $v;
			$this->modifiedColumns[] = TblblogcategoryPeer::CAT_BASE;
		}

		if ($this->aTblcategory !== null && $this->aTblcategory->getCgId() !== $v) {
			$this->aTblcategory = null;
		}

		return $this;
	} 
	
	public function setCatConfig($v)
	{
										$this->cat_config_isLoaded = true;

		if ($v !== null) {
			$v = (string) $v;
		}

		if ($this->cat_config !== $v) {
			$this->cat_config = $v;
			$this->modifiedColumns[] = TblblogcategoryPeer::CAT_CONFIG;
		}

		return $this;
	} 
	
	public function setCatOrder($v)
	{
		if ($v !== null) {
			$v = (int) $v;
		}

		if ($this->cat_order !== $v || $v === 0) {
			$this->cat_order = $v;
			$this->modifiedColumns[] = TblblogcategoryPeer::CAT_ORDER;
		}

		return $this;
	} 
	
	public function hasOnlyDefaultValues()
	{
						if (array_diff($this->modifiedColumns, array(TblblogcategoryPeer::CAT_PUBLIC,TblblogcategoryPeer::CAT_BASE,TblblogcategoryPeer::CAT_ORDER))) {
				return false;
			}

			if ($this->cat_public !== 2) {
				return false;
			}

			if ($this->cat_base !== 0) {
				return false;
			}

			if ($this->cat_order !== 0) {
				return false;
			}

				return true;
	} 
	
	public function hydrate($row, $startcol = 0, $rehydrate = false)
	{
		try {

			$this->cat_id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null;
			$this->cat_blog = ($row[$startcol + 1] !== null) ? (int) $row[$startcol + 1] : null;
			$this->cat_parent = ($row[$startcol + 2] !== null) ? (int) $row[$startcol + 2] : null;
			$this->cat_path = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
			$this->cat_name = ($row[$startcol + 4] !== null) ? (string) $row[$startcol + 4] : null;
			$this->cat_type = ($row[$startcol + 5] !== null) ? (int) $row[$startcol + 5] : null;
			$this->cat_public = ($row[$startcol + 6] !== null) ? (int) $row[$startcol + 6] : null;
			$this->cat_base = ($row[$startcol + 7] !== null) ? (int) $row[$startcol + 7] : null;
			$this->cat_order = ($row[$startcol + 8] !== null) ? (int) $row[$startcol + 8] : null;
			$this->resetModified();

			$this->setNew(false);

			if ($rehydrate) {
				$this->ensureConsistency();
			}

						return $startcol + 9; 
		} catch (Exception $e) {
			throw new PropelException("Error populating Tblblogcategory object", $e);
		}
	}

	
	public function ensureConsistency()
	{

		if ($this->aTblcategory !== null && $this->cat_base !== $this->aTblcategory->getCgId()) {
			$this->aTblcategory = null;
		}
	} 
	
	public function reload($deep = false, PropelPDO $con = null)
	{
		if ($this->isDeleted()) {
			throw new PropelException("Cannot reload a deleted object.");
		}

		if ($this->isNew()) {
			throw new PropelException("Cannot reload an unsaved object.");
		}

		if ($con === null) {
			$con = Propel::getConnection(TblblogcategoryPeer::DATABASE_NAME, Propel::CONNECTION_READ);
		}

				
		$stmt = TblblogcategoryPeer::doSelectStmt($this->buildPkeyCriteria(), $con);
		$row = $stmt->fetch(PDO::FETCH_NUM);
		$stmt->closeCursor();
		if (!$row) {
			throw new PropelException('Cannot find matching row in the database to reload object values.');
		}
		$this->hydrate($row, 0, true); 
				$this->cat_config = null;
		$this->cat_config_isLoaded = false;

		if ($deep) {  
			$this->aTblcategory = null;
			$this->collTblblogentrys = null;
			$this->lastTblblogentryCriteria = null;

		} 	}

	
	public function delete(PropelPDO $con = null)
	{
		if ($this->isDeleted()) {
			throw new PropelException("This object has already been deleted.");
		}

		if ($con === null) {
			$con = Propel::getConnection(TblblogcategoryPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
		}
		
		$con->beginTransaction();
		try {
			TblblogcategoryPeer::doDelete($this, $con);
			$this->setDeleted(true);
			$con->commit();
		} catch (PropelException $e) {
			$con->rollBack();
			throw $e;
		}
	}

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

		if ($con === null) {
			$con = Propel::getConnection(TblblogcategoryPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
		}
		
		$con->beginTransaction();
		try {
			$affectedRows = $this->doSave($con);
			$con->commit();
			TblblogcategoryPeer::addInstanceToPool($this);
			return $affectedRows;
		} catch (PropelException $e) {
			$con->rollBack();
			throw $e;
		}
	}

	
	protected function doSave(PropelPDO $con)
	{
		$affectedRows = 0; 		if (!$this->alreadyInSave) {
			$this->alreadyInSave = true;

												
			if ($this->aTblcategory !== null) {
				if ($this->aTblcategory->isModified() || $this->aTblcategory->isNew()) {
					$affectedRows += $this->aTblcategory->save($con);
				}
				$this->setTblcategory($this->aTblcategory);
			}

			if ($this->isNew() ) {
				$this->modifiedColumns[] = TblblogcategoryPeer::CAT_ID;
			}

						if ($this->isModified()) {
				if ($this->isNew()) {
					$pk = TblblogcategoryPeer::doInsert($this, $con);
					$affectedRows += 1; 										 										 
					$this->setCatId($pk);  
					$this->setNew(false);
				} else {
					$affectedRows += TblblogcategoryPeer::doUpdate($this, $con);
				}

				$this->resetModified(); 			}

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

			$this->alreadyInSave = false;

		}
		return $affectedRows;
	} 
	
	protected $validationFailures = array();

	
	public function getValidationFailures()
	{
		return $this->validationFailures;
	}

	
	public function validate($columns = null)
	{
		$res = $this->doValidate($columns);
		if ($res === true) {
			$this->validationFailures = array();
			return true;
		} else {
			$this->validationFailures = $res;
			return false;
		}
	}

	
	protected function doValidate($columns = null)
	{
		if (!$this->alreadyInValidation) {
			$this->alreadyInValidation = true;
			$retval = null;

			$failureMap = array();


												
			if ($this->aTblcategory !== null) {
				if (!$this->aTblcategory->validate($columns)) {
					$failureMap = array_merge($failureMap, $this->aTblcategory->getValidationFailures());
				}
			}


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


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


			$this->alreadyInValidation = false;
		}

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

	
	public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
	{
		$pos = TblblogcategoryPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
		$field = $this->getByPosition($pos);
		return $field;
	}

	
	public function getByPosition($pos)
	{
		switch($pos) {
			case 0:
				return $this->getCatId();
				break;
			case 1:
				return $this->getCatBlog();
				break;
			case 2:
				return $this->getCatParent();
				break;
			case 3:
				return $this->getCatPath();
				break;
			case 4:
				return $this->getCatName();
				break;
			case 5:
				return $this->getCatType();
				break;
			case 6:
				return $this->getCatPublic();
				break;
			case 7:
				return $this->getCatBase();
				break;
			case 8:
				return $this->getCatConfig();
				break;
			case 9:
				return $this->getCatOrder();
				break;
			default:
				return null;
				break;
		} 	}

	
	public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true)
	{
		$keys = TblblogcategoryPeer::getFieldNames($keyType);
		$result = array(
			$keys[0] => $this->getCatId(),
			$keys[1] => $this->getCatBlog(),
			$keys[2] => $this->getCatParent(),
			$keys[3] => $this->getCatPath(),
			$keys[4] => $this->getCatName(),
			$keys[5] => $this->getCatType(),
			$keys[6] => $this->getCatPublic(),
			$keys[7] => $this->getCatBase(),
			$keys[8] => ($includeLazyLoadColumns) ? $this->getCatConfig() : null,
			$keys[9] => $this->getCatOrder(),
		);
		return $result;
	}

	
	public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
	{
		$pos = TblblogcategoryPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
		return $this->setByPosition($pos, $value);
	}

	
	public function setByPosition($pos, $value)
	{
		switch($pos) {
			case 0:
				$this->setCatId($value);
				break;
			case 1:
				$this->setCatBlog($value);
				break;
			case 2:
				$this->setCatParent($value);
				break;
			case 3:
				$this->setCatPath($value);
				break;
			case 4:
				$this->setCatName($value);
				break;
			case 5:
				$this->setCatType($value);
				break;
			case 6:
				$this->setCatPublic($value);
				break;
			case 7:
				$this->setCatBase($value);
				break;
			case 8:
				$this->setCatConfig($value);
				break;
			case 9:
				$this->setCatOrder($value);
				break;
		} 	}

	
	public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
	{
		$keys = TblblogcategoryPeer::getFieldNames($keyType);

		if (array_key_exists($keys[0], $arr)) $this->setCatId($arr[$keys[0]]);
		if (array_key_exists($keys[1], $arr)) $this->setCatBlog($arr[$keys[1]]);
		if (array_key_exists($keys[2], $arr)) $this->setCatParent($arr[$keys[2]]);
		if (array_key_exists($keys[3], $arr)) $this->setCatPath($arr[$keys[3]]);
		if (array_key_exists($keys[4], $arr)) $this->setCatName($arr[$keys[4]]);
		if (array_key_exists($keys[5], $arr)) $this->setCatType($arr[$keys[5]]);
		if (array_key_exists($keys[6], $arr)) $this->setCatPublic($arr[$keys[6]]);
		if (array_key_exists($keys[7], $arr)) $this->setCatBase($arr[$keys[7]]);
		if (array_key_exists($keys[8], $arr)) $this->setCatConfig($arr[$keys[8]]);
		if (array_key_exists($keys[9], $arr)) $this->setCatOrder($arr[$keys[9]]);
	}

	
	public function buildCriteria()
	{
		$criteria = new Criteria(TblblogcategoryPeer::DATABASE_NAME);

		if ($this->isColumnModified(TblblogcategoryPeer::CAT_ID)) $criteria->add(TblblogcategoryPeer::CAT_ID, $this->cat_id);
		if ($this->isColumnModified(TblblogcategoryPeer::CAT_BLOG)) $criteria->add(TblblogcategoryPeer::CAT_BLOG, $this->cat_blog);
		if ($this->isColumnModified(TblblogcategoryPeer::CAT_PARENT)) $criteria->add(TblblogcategoryPeer::CAT_PARENT, $this->cat_parent);
		if ($this->isColumnModified(TblblogcategoryPeer::CAT_PATH)) $criteria->add(TblblogcategoryPeer::CAT_PATH, $this->cat_path);
		if ($this->isColumnModified(TblblogcategoryPeer::CAT_NAME)) $criteria->add(TblblogcategoryPeer::CAT_NAME, $this->cat_name);
		if ($this->isColumnModified(TblblogcategoryPeer::CAT_TYPE)) $criteria->add(TblblogcategoryPeer::CAT_TYPE, $this->cat_type);
		if ($this->isColumnModified(TblblogcategoryPeer::CAT_PUBLIC)) $criteria->add(TblblogcategoryPeer::CAT_PUBLIC, $this->cat_public);
		if ($this->isColumnModified(TblblogcategoryPeer::CAT_BASE)) $criteria->add(TblblogcategoryPeer::CAT_BASE, $this->cat_base);
		if ($this->isColumnModified(TblblogcategoryPeer::CAT_CONFIG)) $criteria->add(TblblogcategoryPeer::CAT_CONFIG, $this->cat_config);
		if ($this->isColumnModified(TblblogcategoryPeer::CAT_ORDER)) $criteria->add(TblblogcategoryPeer::CAT_ORDER, $this->cat_order);

		return $criteria;
	}

	
	public function buildPkeyCriteria()
	{
		$criteria = new Criteria(TblblogcategoryPeer::DATABASE_NAME);

		$criteria->add(TblblogcategoryPeer::CAT_ID, $this->cat_id);

		return $criteria;
	}

	
	public function getPrimaryKey()
	{
		return $this->getCatId();
	}

	
	public function setPrimaryKey($key)
	{
		$this->setCatId($key);
	}

	
	public function copyInto($copyObj, $deepCopy = false)
	{

		$copyObj->setCatBlog($this->cat_blog);

		$copyObj->setCatParent($this->cat_parent);

		$copyObj->setCatPath($this->cat_path);

		$copyObj->setCatName($this->cat_name);

		$copyObj->setCatType($this->cat_type);

		$copyObj->setCatPublic($this->cat_public);

		$copyObj->setCatBase($this->cat_base);

		$copyObj->setCatConfig($this->cat_config);

		$copyObj->setCatOrder($this->cat_order);


		if ($deepCopy) {
									$copyObj->setNew(false);

			foreach ($this->getTblblogentrys() as $relObj) {
				if ($relObj !== $this) {  					$copyObj->addTblblogentry($relObj->copy($deepCopy));
				}
			}

		} 

		$copyObj->setNew(true);

		$copyObj->setCatId(NULL); 
	}

	
	public function copy($deepCopy = false)
	{
				$clazz = get_class($this);
		$copyObj = new $clazz();
		$this->copyInto($copyObj, $deepCopy);
		return $copyObj;
	}

	
	public function getPeer()
	{
		if (self::$peer === null) {
			self::$peer = new TblblogcategoryPeer();
		}
		return self::$peer;
	}

	
	public function setTblcategory(Tblcategory $v = null)
	{
		if ($v === null) {
			$this->setCatBase(0);
		} else {
			$this->setCatBase($v->getCgId());
		}

		$this->aTblcategory = $v;

						if ($v !== null) {
			$v->addTblblogcategory($this);
		}

		return $this;
	}


	
	public function getTblcategory(PropelPDO $con = null)
	{
		if ($this->aTblcategory === null && ($this->cat_base !== null)) {
			$this->aTblcategory = TblcategoryPeer::retrieveByPK($this->cat_base, $con);
			
		}
		return $this->aTblcategory;
	}

	
	public function clearTblblogentrys()
	{
		$this->collTblblogentrys = null; 	}

	
	public function initTblblogentrys()
	{
		$this->collTblblogentrys = array();
	}

	
	public function getTblblogentrys($criteria = null, PropelPDO $con = null)
	{
		if ($criteria === null) {
			$criteria = new Criteria(TblblogcategoryPeer::DATABASE_NAME);
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

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

				$criteria->add(TblblogentryPeer::ENTRY_CATEGORY, $this->cat_id);

				TblblogentryPeer::addSelectColumns($criteria);
				$this->collTblblogentrys = TblblogentryPeer::doSelect($criteria, $con);
			}
		} else {
						if (!$this->isNew()) {
												

				$criteria->add(TblblogentryPeer::ENTRY_CATEGORY, $this->cat_id);

				TblblogentryPeer::addSelectColumns($criteria);
				if (!isset($this->lastTblblogentryCriteria) || !$this->lastTblblogentryCriteria->equals($criteria)) {
					$this->collTblblogentrys = TblblogentryPeer::doSelect($criteria, $con);
				}
			}
		}
		$this->lastTblblogentryCriteria = $criteria;
		return $this->collTblblogentrys;
	}

	
	public function countTblblogentrys(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
	{
		if ($criteria === null) {
			$criteria = new Criteria(TblblogcategoryPeer::DATABASE_NAME);
		} else {
			$criteria = clone $criteria;
		}

		if ($distinct) {
			$criteria->setDistinct();
		}

		$count = null;

		if ($this->collTblblogentrys === null) {
			if ($this->isNew()) {
				$count = 0;
			} else {

				$criteria->add(TblblogentryPeer::ENTRY_CATEGORY, $this->cat_id);

				$count = TblblogentryPeer::doCount($criteria, $con);
			}
		} else {
						if (!$this->isNew()) {
												

				$criteria->add(TblblogentryPeer::ENTRY_CATEGORY, $this->cat_id);

				if (!isset($this->lastTblblogentryCriteria) || !$this->lastTblblogentryCriteria->equals($criteria)) {
					$count = TblblogentryPeer::doCount($criteria, $con);
				} else {
					$count = count($this->collTblblogentrys);
				}
			} else {
				$count = count($this->collTblblogentrys);
			}
		}
		$this->lastTblblogentryCriteria = $criteria;
		return $count;
	}

	
	public function addTblblogentry(Tblblogentry $l)
	{
		if ($this->collTblblogentrys === null) {
			$this->initTblblogentrys();
		}
		if (!in_array($l, $this->collTblblogentrys, true)) { 			array_push($this->collTblblogentrys, $l);
			$l->setTblblogcategory($this);
		}
	}


	
	public function getTblblogentrysJoinTblpresentation($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
	{
		if ($criteria === null) {
			$criteria = new Criteria(TblblogcategoryPeer::DATABASE_NAME);
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

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

				$criteria->add(TblblogentryPeer::ENTRY_CATEGORY, $this->cat_id);

				$this->collTblblogentrys = TblblogentryPeer::doSelectJoinTblpresentation($criteria, $con, $join_behavior);
			}
		} else {
									
			$criteria->add(TblblogentryPeer::ENTRY_CATEGORY, $this->cat_id);

			if (!isset($this->lastTblblogentryCriteria) || !$this->lastTblblogentryCriteria->equals($criteria)) {
				$this->collTblblogentrys = TblblogentryPeer::doSelectJoinTblpresentation($criteria, $con, $join_behavior);
			}
		}
		$this->lastTblblogentryCriteria = $criteria;

		return $this->collTblblogentrys;
	}


	
	public function getTblblogentrysJoinTbldocument($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
	{
		if ($criteria === null) {
			$criteria = new Criteria(TblblogcategoryPeer::DATABASE_NAME);
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

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

				$criteria->add(TblblogentryPeer::ENTRY_CATEGORY, $this->cat_id);

				$this->collTblblogentrys = TblblogentryPeer::doSelectJoinTbldocument($criteria, $con, $join_behavior);
			}
		} else {
									
			$criteria->add(TblblogentryPeer::ENTRY_CATEGORY, $this->cat_id);

			if (!isset($this->lastTblblogentryCriteria) || !$this->lastTblblogentryCriteria->equals($criteria)) {
				$this->collTblblogentrys = TblblogentryPeer::doSelectJoinTbldocument($criteria, $con, $join_behavior);
			}
		}
		$this->lastTblblogentryCriteria = $criteria;

		return $this->collTblblogentrys;
	}


	
	public function getTblblogentrysJoinTblblog($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
	{
		if ($criteria === null) {
			$criteria = new Criteria(TblblogcategoryPeer::DATABASE_NAME);
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

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

				$criteria->add(TblblogentryPeer::ENTRY_CATEGORY, $this->cat_id);

				$this->collTblblogentrys = TblblogentryPeer::doSelectJoinTblblog($criteria, $con, $join_behavior);
			}
		} else {
									
			$criteria->add(TblblogentryPeer::ENTRY_CATEGORY, $this->cat_id);

			if (!isset($this->lastTblblogentryCriteria) || !$this->lastTblblogentryCriteria->equals($criteria)) {
				$this->collTblblogentrys = TblblogentryPeer::doSelectJoinTblblog($criteria, $con, $join_behavior);
			}
		}
		$this->lastTblblogentryCriteria = $criteria;

		return $this->collTblblogentrys;
	}


	
	public function getTblblogentrysJoinTbluser($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
	{
		if ($criteria === null) {
			$criteria = new Criteria(TblblogcategoryPeer::DATABASE_NAME);
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

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

				$criteria->add(TblblogentryPeer::ENTRY_CATEGORY, $this->cat_id);

				$this->collTblblogentrys = TblblogentryPeer::doSelectJoinTbluser($criteria, $con, $join_behavior);
			}
		} else {
									
			$criteria->add(TblblogentryPeer::ENTRY_CATEGORY, $this->cat_id);

			if (!isset($this->lastTblblogentryCriteria) || !$this->lastTblblogentryCriteria->equals($criteria)) {
				$this->collTblblogentrys = TblblogentryPeer::doSelectJoinTbluser($criteria, $con, $join_behavior);
			}
		}
		$this->lastTblblogentryCriteria = $criteria;

		return $this->collTblblogentrys;
	}

	
	public function clearAllReferences($deep = false)
	{
		if ($deep) {
			if ($this->collTblblogentrys) {
				foreach ((array) $this->collTblblogentrys as $o) {
					$o->clearAllReferences($deep);
				}
			}
		} 
		$this->collTblblogentrys = null;
			$this->aTblcategory = null;
	}

} 