<?php


abstract class BaseRegionales extends BaseObject  implements Persistent {


	
	protected static $peer;


	
	protected $codreg;


	
	protected $desreg;


	
	protected $ciuced;


	
	protected $departa;


	
	protected $direccion;


	
	protected $coddep;


	
	protected $codmun;


	
	protected $nitcaja;


	
	protected $codcaj;


	
	protected $razsoc;

	
	protected $collComisionadosPlantas;

	
	protected $lastComisionadosPlantaCriteria = null;

	
	protected $collComisionadosContratos;

	
	protected $lastComisionadosContratoCriteria = null;

	
	protected $alreadyInSave = false;

	
	protected $alreadyInValidation = false;

	
	public function getCodreg()
	{

		return $this->codreg;
	}

	
	public function getDesreg()
	{

		return $this->desreg;
	}

	
	public function getCiuced()
	{

		return $this->ciuced;
	}

	
	public function getDeparta()
	{

		return $this->departa;
	}

	
	public function getDireccion()
	{

		return $this->direccion;
	}

	
	public function getCoddep()
	{

		return $this->coddep;
	}

	
	public function getCodmun()
	{

		return $this->codmun;
	}

	
	public function getNitcaja()
	{

		return $this->nitcaja;
	}

	
	public function getCodcaj()
	{

		return $this->codcaj;
	}

	
	public function getRazsoc()
	{

		return $this->razsoc;
	}

	
	public function setCodreg($v)
	{

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

		if ($this->codreg !== $v) {
			$this->codreg = $v;
			$this->modifiedColumns[] = RegionalesPeer::CODREG;
		}

	} 
	
	public function setDesreg($v)
	{

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

		if ($this->desreg !== $v) {
			$this->desreg = $v;
			$this->modifiedColumns[] = RegionalesPeer::DESREG;
		}

	} 
	
	public function setCiuced($v)
	{

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

		if ($this->ciuced !== $v) {
			$this->ciuced = $v;
			$this->modifiedColumns[] = RegionalesPeer::CIUCED;
		}

	} 
	
	public function setDeparta($v)
	{

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

		if ($this->departa !== $v) {
			$this->departa = $v;
			$this->modifiedColumns[] = RegionalesPeer::DEPARTA;
		}

	} 
	
	public function setDireccion($v)
	{

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

		if ($this->direccion !== $v) {
			$this->direccion = $v;
			$this->modifiedColumns[] = RegionalesPeer::DIRECCION;
		}

	} 
	
	public function setCoddep($v)
	{

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

		if ($this->coddep !== $v) {
			$this->coddep = $v;
			$this->modifiedColumns[] = RegionalesPeer::CODDEP;
		}

	} 
	
	public function setCodmun($v)
	{

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

		if ($this->codmun !== $v) {
			$this->codmun = $v;
			$this->modifiedColumns[] = RegionalesPeer::CODMUN;
		}

	} 
	
	public function setNitcaja($v)
	{

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

		if ($this->nitcaja !== $v) {
			$this->nitcaja = $v;
			$this->modifiedColumns[] = RegionalesPeer::NITCAJA;
		}

	} 
	
	public function setCodcaj($v)
	{

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

		if ($this->codcaj !== $v) {
			$this->codcaj = $v;
			$this->modifiedColumns[] = RegionalesPeer::CODCAJ;
		}

	} 
	
	public function setRazsoc($v)
	{

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

		if ($this->razsoc !== $v) {
			$this->razsoc = $v;
			$this->modifiedColumns[] = RegionalesPeer::RAZSOC;
		}

	} 
	
	public function hydrate(ResultSet $rs, $startcol = 1)
	{
		try {

			$this->codreg = $rs->getString($startcol + 0);

			$this->desreg = $rs->getString($startcol + 1);

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

			$this->departa = $rs->getString($startcol + 3);

			$this->direccion = $rs->getString($startcol + 4);

			$this->coddep = $rs->getString($startcol + 5);

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

			$this->nitcaja = $rs->getString($startcol + 7);

			$this->codcaj = $rs->getString($startcol + 8);

			$this->razsoc = $rs->getString($startcol + 9);

			$this->resetModified();

			$this->setNew(false);

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

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

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

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

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

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

		try {
			$con->begin();
			$affectedRows = $this->doSave($con);
			$con->commit();
			return $affectedRows;
		} catch (PropelException $e) {
			$con->rollback();
			throw $e;
		}
	}

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


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

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

			if ($this->collComisionadosContratos !== null) {
				foreach($this->collComisionadosContratos 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 (($retval = RegionalesPeer::doValidate($this, $columns)) !== true) {
				$failureMap = array_merge($failureMap, $retval);
			}


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

				if ($this->collComisionadosContratos !== null) {
					foreach($this->collComisionadosContratos 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 = RegionalesPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
		return $this->getByPosition($pos);
	}

	
	public function getByPosition($pos)
	{
		switch($pos) {
			case 0:
				return $this->getCodreg();
				break;
			case 1:
				return $this->getDesreg();
				break;
			case 2:
				return $this->getCiuced();
				break;
			case 3:
				return $this->getDeparta();
				break;
			case 4:
				return $this->getDireccion();
				break;
			case 5:
				return $this->getCoddep();
				break;
			case 6:
				return $this->getCodmun();
				break;
			case 7:
				return $this->getNitcaja();
				break;
			case 8:
				return $this->getCodcaj();
				break;
			case 9:
				return $this->getRazsoc();
				break;
			default:
				return null;
				break;
		} 	}

	
	public function toArray($keyType = BasePeer::TYPE_PHPNAME)
	{
		$keys = RegionalesPeer::getFieldNames($keyType);
		$result = array(
			$keys[0] => $this->getCodreg(),
			$keys[1] => $this->getDesreg(),
			$keys[2] => $this->getCiuced(),
			$keys[3] => $this->getDeparta(),
			$keys[4] => $this->getDireccion(),
			$keys[5] => $this->getCoddep(),
			$keys[6] => $this->getCodmun(),
			$keys[7] => $this->getNitcaja(),
			$keys[8] => $this->getCodcaj(),
			$keys[9] => $this->getRazsoc(),
		);
		return $result;
	}

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

	
	public function setByPosition($pos, $value)
	{
		switch($pos) {
			case 0:
				$this->setCodreg($value);
				break;
			case 1:
				$this->setDesreg($value);
				break;
			case 2:
				$this->setCiuced($value);
				break;
			case 3:
				$this->setDeparta($value);
				break;
			case 4:
				$this->setDireccion($value);
				break;
			case 5:
				$this->setCoddep($value);
				break;
			case 6:
				$this->setCodmun($value);
				break;
			case 7:
				$this->setNitcaja($value);
				break;
			case 8:
				$this->setCodcaj($value);
				break;
			case 9:
				$this->setRazsoc($value);
				break;
		} 	}

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

		if (array_key_exists($keys[0], $arr)) $this->setCodreg($arr[$keys[0]]);
		if (array_key_exists($keys[1], $arr)) $this->setDesreg($arr[$keys[1]]);
		if (array_key_exists($keys[2], $arr)) $this->setCiuced($arr[$keys[2]]);
		if (array_key_exists($keys[3], $arr)) $this->setDeparta($arr[$keys[3]]);
		if (array_key_exists($keys[4], $arr)) $this->setDireccion($arr[$keys[4]]);
		if (array_key_exists($keys[5], $arr)) $this->setCoddep($arr[$keys[5]]);
		if (array_key_exists($keys[6], $arr)) $this->setCodmun($arr[$keys[6]]);
		if (array_key_exists($keys[7], $arr)) $this->setNitcaja($arr[$keys[7]]);
		if (array_key_exists($keys[8], $arr)) $this->setCodcaj($arr[$keys[8]]);
		if (array_key_exists($keys[9], $arr)) $this->setRazsoc($arr[$keys[9]]);
	}

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

		if ($this->isColumnModified(RegionalesPeer::CODREG)) $criteria->add(RegionalesPeer::CODREG, $this->codreg);
		if ($this->isColumnModified(RegionalesPeer::DESREG)) $criteria->add(RegionalesPeer::DESREG, $this->desreg);
		if ($this->isColumnModified(RegionalesPeer::CIUCED)) $criteria->add(RegionalesPeer::CIUCED, $this->ciuced);
		if ($this->isColumnModified(RegionalesPeer::DEPARTA)) $criteria->add(RegionalesPeer::DEPARTA, $this->departa);
		if ($this->isColumnModified(RegionalesPeer::DIRECCION)) $criteria->add(RegionalesPeer::DIRECCION, $this->direccion);
		if ($this->isColumnModified(RegionalesPeer::CODDEP)) $criteria->add(RegionalesPeer::CODDEP, $this->coddep);
		if ($this->isColumnModified(RegionalesPeer::CODMUN)) $criteria->add(RegionalesPeer::CODMUN, $this->codmun);
		if ($this->isColumnModified(RegionalesPeer::NITCAJA)) $criteria->add(RegionalesPeer::NITCAJA, $this->nitcaja);
		if ($this->isColumnModified(RegionalesPeer::CODCAJ)) $criteria->add(RegionalesPeer::CODCAJ, $this->codcaj);
		if ($this->isColumnModified(RegionalesPeer::RAZSOC)) $criteria->add(RegionalesPeer::RAZSOC, $this->razsoc);

		return $criteria;
	}

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

		$criteria->add(RegionalesPeer::CODREG, $this->codreg);

		return $criteria;
	}

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

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

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

		$copyObj->setDesreg($this->desreg);

		$copyObj->setCiuced($this->ciuced);

		$copyObj->setDeparta($this->departa);

		$copyObj->setDireccion($this->direccion);

		$copyObj->setCoddep($this->coddep);

		$copyObj->setCodmun($this->codmun);

		$copyObj->setNitcaja($this->nitcaja);

		$copyObj->setCodcaj($this->codcaj);

		$copyObj->setRazsoc($this->razsoc);


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

			foreach($this->getComisionadosPlantas() as $relObj) {
				$copyObj->addComisionadosPlanta($relObj->copy($deepCopy));
			}

			foreach($this->getComisionadosContratos() as $relObj) {
				$copyObj->addComisionadosContrato($relObj->copy($deepCopy));
			}

		} 

		$copyObj->setNew(true);

		$copyObj->setCodreg(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 RegionalesPeer();
		}
		return self::$peer;
	}

	
	public function initComisionadosPlantas()
	{
		if ($this->collComisionadosPlantas === null) {
			$this->collComisionadosPlantas = array();
		}
	}

	
	public function getComisionadosPlantas($criteria = null, $con = null)
	{
				if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

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

				$criteria->add(ComisionadosPlantaPeer::CODREG, $this->getCodreg());

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

				$criteria->add(ComisionadosPlantaPeer::CODREG, $this->getCodreg());

				ComisionadosPlantaPeer::addSelectColumns($criteria);
				if (!isset($this->lastComisionadosPlantaCriteria) || !$this->lastComisionadosPlantaCriteria->equals($criteria)) {
					$this->collComisionadosPlantas = ComisionadosPlantaPeer::doSelect($criteria, $con);
				}
			}
		}
		$this->lastComisionadosPlantaCriteria = $criteria;
		return $this->collComisionadosPlantas;
	}

	
	public function countComisionadosPlantas($criteria = null, $distinct = false, $con = null)
	{
				if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		$criteria->add(ComisionadosPlantaPeer::CODREG, $this->getCodreg());

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

	
	public function addComisionadosPlanta(ComisionadosPlanta $l)
	{
		$this->collComisionadosPlantas[] = $l;
		$l->setRegionales($this);
	}


	
	public function getComisionadosPlantasJoinTerceros($criteria = null, $con = null)
	{
				if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

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

				$criteria->add(ComisionadosPlantaPeer::CODREG, $this->getCodreg());

				$this->collComisionadosPlantas = ComisionadosPlantaPeer::doSelectJoinTerceros($criteria, $con);
			}
		} else {
									
			$criteria->add(ComisionadosPlantaPeer::CODREG, $this->getCodreg());

			if (!isset($this->lastComisionadosPlantaCriteria) || !$this->lastComisionadosPlantaCriteria->equals($criteria)) {
				$this->collComisionadosPlantas = ComisionadosPlantaPeer::doSelectJoinTerceros($criteria, $con);
			}
		}
		$this->lastComisionadosPlantaCriteria = $criteria;

		return $this->collComisionadosPlantas;
	}


	
	public function getComisionadosPlantasJoinTransportes($criteria = null, $con = null)
	{
				if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

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

				$criteria->add(ComisionadosPlantaPeer::CODREG, $this->getCodreg());

				$this->collComisionadosPlantas = ComisionadosPlantaPeer::doSelectJoinTransportes($criteria, $con);
			}
		} else {
									
			$criteria->add(ComisionadosPlantaPeer::CODREG, $this->getCodreg());

			if (!isset($this->lastComisionadosPlantaCriteria) || !$this->lastComisionadosPlantaCriteria->equals($criteria)) {
				$this->collComisionadosPlantas = ComisionadosPlantaPeer::doSelectJoinTransportes($criteria, $con);
			}
		}
		$this->lastComisionadosPlantaCriteria = $criteria;

		return $this->collComisionadosPlantas;
	}


	
	public function getComisionadosPlantasJoinComisiones($criteria = null, $con = null)
	{
				if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

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

				$criteria->add(ComisionadosPlantaPeer::CODREG, $this->getCodreg());

				$this->collComisionadosPlantas = ComisionadosPlantaPeer::doSelectJoinComisiones($criteria, $con);
			}
		} else {
									
			$criteria->add(ComisionadosPlantaPeer::CODREG, $this->getCodreg());

			if (!isset($this->lastComisionadosPlantaCriteria) || !$this->lastComisionadosPlantaCriteria->equals($criteria)) {
				$this->collComisionadosPlantas = ComisionadosPlantaPeer::doSelectJoinComisiones($criteria, $con);
			}
		}
		$this->lastComisionadosPlantaCriteria = $criteria;

		return $this->collComisionadosPlantas;
	}

	
	public function initComisionadosContratos()
	{
		if ($this->collComisionadosContratos === null) {
			$this->collComisionadosContratos = array();
		}
	}

	
	public function getComisionadosContratos($criteria = null, $con = null)
	{
				if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

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

				$criteria->add(ComisionadosContratoPeer::CODREG, $this->getCodreg());

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

				$criteria->add(ComisionadosContratoPeer::CODREG, $this->getCodreg());

				ComisionadosContratoPeer::addSelectColumns($criteria);
				if (!isset($this->lastComisionadosContratoCriteria) || !$this->lastComisionadosContratoCriteria->equals($criteria)) {
					$this->collComisionadosContratos = ComisionadosContratoPeer::doSelect($criteria, $con);
				}
			}
		}
		$this->lastComisionadosContratoCriteria = $criteria;
		return $this->collComisionadosContratos;
	}

	
	public function countComisionadosContratos($criteria = null, $distinct = false, $con = null)
	{
				if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		$criteria->add(ComisionadosContratoPeer::CODREG, $this->getCodreg());

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

	
	public function addComisionadosContrato(ComisionadosContrato $l)
	{
		$this->collComisionadosContratos[] = $l;
		$l->setRegionales($this);
	}


	
	public function getComisionadosContratosJoinTerceros($criteria = null, $con = null)
	{
				if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

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

				$criteria->add(ComisionadosContratoPeer::CODREG, $this->getCodreg());

				$this->collComisionadosContratos = ComisionadosContratoPeer::doSelectJoinTerceros($criteria, $con);
			}
		} else {
									
			$criteria->add(ComisionadosContratoPeer::CODREG, $this->getCodreg());

			if (!isset($this->lastComisionadosContratoCriteria) || !$this->lastComisionadosContratoCriteria->equals($criteria)) {
				$this->collComisionadosContratos = ComisionadosContratoPeer::doSelectJoinTerceros($criteria, $con);
			}
		}
		$this->lastComisionadosContratoCriteria = $criteria;

		return $this->collComisionadosContratos;
	}


	
	public function getComisionadosContratosJoinTransportes($criteria = null, $con = null)
	{
				if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

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

				$criteria->add(ComisionadosContratoPeer::CODREG, $this->getCodreg());

				$this->collComisionadosContratos = ComisionadosContratoPeer::doSelectJoinTransportes($criteria, $con);
			}
		} else {
									
			$criteria->add(ComisionadosContratoPeer::CODREG, $this->getCodreg());

			if (!isset($this->lastComisionadosContratoCriteria) || !$this->lastComisionadosContratoCriteria->equals($criteria)) {
				$this->collComisionadosContratos = ComisionadosContratoPeer::doSelectJoinTransportes($criteria, $con);
			}
		}
		$this->lastComisionadosContratoCriteria = $criteria;

		return $this->collComisionadosContratos;
	}


	
	public function getComisionadosContratosJoinComisiones($criteria = null, $con = null)
	{
				if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

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

				$criteria->add(ComisionadosContratoPeer::CODREG, $this->getCodreg());

				$this->collComisionadosContratos = ComisionadosContratoPeer::doSelectJoinComisiones($criteria, $con);
			}
		} else {
									
			$criteria->add(ComisionadosContratoPeer::CODREG, $this->getCodreg());

			if (!isset($this->lastComisionadosContratoCriteria) || !$this->lastComisionadosContratoCriteria->equals($criteria)) {
				$this->collComisionadosContratos = ComisionadosContratoPeer::doSelectJoinComisiones($criteria, $con);
			}
		}
		$this->lastComisionadosContratoCriteria = $criteria;

		return $this->collComisionadosContratos;
	}

} 