<?php


abstract class BaseTbldocumentPeer {

	
	const DATABASE_NAME = 'propel';

	
	const TABLE_NAME = 'tbldocument';

	
	const CLASS_DEFAULT = 'lib.model.Tbldocument';

	
	const NUM_COLUMNS = 20;

	
	const NUM_LAZY_LOAD_COLUMNS = 1;

	
	const DOC_ID = 'tbldocument.DOC_ID';

	
	const DOC_CATEGORY = 'tbldocument.DOC_CATEGORY';

	
	const DOC_NAME = 'tbldocument.DOC_NAME';

	
	const DOC_DESC = 'tbldocument.DOC_DESC';

	
	const DOC_SOURCE = 'tbldocument.DOC_SOURCE';

	
	const DOC_KEYWORD = 'tbldocument.DOC_KEYWORD';

	
	const DOC_TYPE = 'tbldocument.DOC_TYPE';

	
	const DOC_FILENAME = 'tbldocument.DOC_FILENAME';

	
	const DOC_USER = 'tbldocument.DOC_USER';

	
	const DOC_DATE = 'tbldocument.DOC_DATE';

	
	const DOC_HIT = 'tbldocument.DOC_HIT';

	
	const DOC_RATING = 'tbldocument.DOC_RATING';

	
	const DOC_STATUS = 'tbldocument.DOC_STATUS';

	
	const DOC_WIDTH = 'tbldocument.DOC_WIDTH';

	
	const DOC_HEIGHT = 'tbldocument.DOC_HEIGHT';

	
	const DOC_VIEW = 'tbldocument.DOC_VIEW';

	
	const DOC_MANAGER = 'tbldocument.DOC_MANAGER';

	
	const DOC_REPORT = 'tbldocument.DOC_REPORT';

	
	const DOC_FILESIZE = 'tbldocument.DOC_FILESIZE';

	
	const DOC_THUMBNAIL = 'tbldocument.DOC_THUMBNAIL';

	
	public static $instances = array();

	
	private static $mapBuilder = null;

	
	private static $fieldNames = array (
		BasePeer::TYPE_PHPNAME => array ('DocId', 'DocCategory', 'DocName', 'DocDesc', 'DocSource', 'DocKeyword', 'DocType', 'DocFilename', 'DocUser', 'DocDate', 'DocHit', 'DocRating', 'DocStatus', 'DocWidth', 'DocHeight', 'DocView', 'DocManager', 'DocReport', 'DocFilesize', 'DocThumbnail', ),
		BasePeer::TYPE_STUDLYPHPNAME => array ('docId', 'docCategory', 'docName', 'docDesc', 'docSource', 'docKeyword', 'docType', 'docFilename', 'docUser', 'docDate', 'docHit', 'docRating', 'docStatus', 'docWidth', 'docHeight', 'docView', 'docManager', 'docReport', 'docFilesize', 'docThumbnail', ),
		BasePeer::TYPE_COLNAME => array (self::DOC_ID, self::DOC_CATEGORY, self::DOC_NAME, self::DOC_DESC, self::DOC_SOURCE, self::DOC_KEYWORD, self::DOC_TYPE, self::DOC_FILENAME, self::DOC_USER, self::DOC_DATE, self::DOC_HIT, self::DOC_RATING, self::DOC_STATUS, self::DOC_WIDTH, self::DOC_HEIGHT, self::DOC_VIEW, self::DOC_MANAGER, self::DOC_REPORT, self::DOC_FILESIZE, self::DOC_THUMBNAIL, ),
		BasePeer::TYPE_FIELDNAME => array ('doc_id', 'doc_category', 'doc_name', 'doc_desc', 'doc_source', 'doc_keyword', 'doc_type', 'doc_filename', 'doc_user', 'doc_date', 'doc_hit', 'doc_rating', 'doc_status', 'doc_width', 'doc_height', 'doc_view', 'doc_manager', 'doc_report', 'doc_filesize', 'doc_thumbnail', ),
		BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, )
	);

	
	private static $fieldKeys = array (
		BasePeer::TYPE_PHPNAME => array ('DocId' => 0, 'DocCategory' => 1, 'DocName' => 2, 'DocDesc' => 3, 'DocSource' => 4, 'DocKeyword' => 5, 'DocType' => 6, 'DocFilename' => 7, 'DocUser' => 8, 'DocDate' => 9, 'DocHit' => 10, 'DocRating' => 11, 'DocStatus' => 12, 'DocWidth' => 13, 'DocHeight' => 14, 'DocView' => 15, 'DocManager' => 16, 'DocReport' => 17, 'DocFilesize' => 18, 'DocThumbnail' => 19, ),
		BasePeer::TYPE_STUDLYPHPNAME => array ('docId' => 0, 'docCategory' => 1, 'docName' => 2, 'docDesc' => 3, 'docSource' => 4, 'docKeyword' => 5, 'docType' => 6, 'docFilename' => 7, 'docUser' => 8, 'docDate' => 9, 'docHit' => 10, 'docRating' => 11, 'docStatus' => 12, 'docWidth' => 13, 'docHeight' => 14, 'docView' => 15, 'docManager' => 16, 'docReport' => 17, 'docFilesize' => 18, 'docThumbnail' => 19, ),
		BasePeer::TYPE_COLNAME => array (self::DOC_ID => 0, self::DOC_CATEGORY => 1, self::DOC_NAME => 2, self::DOC_DESC => 3, self::DOC_SOURCE => 4, self::DOC_KEYWORD => 5, self::DOC_TYPE => 6, self::DOC_FILENAME => 7, self::DOC_USER => 8, self::DOC_DATE => 9, self::DOC_HIT => 10, self::DOC_RATING => 11, self::DOC_STATUS => 12, self::DOC_WIDTH => 13, self::DOC_HEIGHT => 14, self::DOC_VIEW => 15, self::DOC_MANAGER => 16, self::DOC_REPORT => 17, self::DOC_FILESIZE => 18, self::DOC_THUMBNAIL => 19, ),
		BasePeer::TYPE_FIELDNAME => array ('doc_id' => 0, 'doc_category' => 1, 'doc_name' => 2, 'doc_desc' => 3, 'doc_source' => 4, 'doc_keyword' => 5, 'doc_type' => 6, 'doc_filename' => 7, 'doc_user' => 8, 'doc_date' => 9, 'doc_hit' => 10, 'doc_rating' => 11, 'doc_status' => 12, 'doc_width' => 13, 'doc_height' => 14, 'doc_view' => 15, 'doc_manager' => 16, 'doc_report' => 17, 'doc_filesize' => 18, 'doc_thumbnail' => 19, ),
		BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, )
	);

	
	public static function getMapBuilder()
	{
		if (self::$mapBuilder === null) {
			self::$mapBuilder = new TbldocumentMapBuilder();
		}
		return self::$mapBuilder;
	}
	
	static public function translateFieldName($name, $fromType, $toType)
	{
		$toNames = self::getFieldNames($toType);
		$key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null;
		if ($key === null) {
			throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true));
		}
		return $toNames[$key];
	}

	

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

	
	public static function alias($alias, $column)
	{
		return str_replace(TbldocumentPeer::TABLE_NAME.'.', $alias.'.', $column);
	}

	
	public static function addSelectColumns(Criteria $criteria)
	{

		$criteria->addSelectColumn(TbldocumentPeer::DOC_ID);

		$criteria->addSelectColumn(TbldocumentPeer::DOC_CATEGORY);

		$criteria->addSelectColumn(TbldocumentPeer::DOC_NAME);

		$criteria->addSelectColumn(TbldocumentPeer::DOC_SOURCE);

		$criteria->addSelectColumn(TbldocumentPeer::DOC_KEYWORD);

		$criteria->addSelectColumn(TbldocumentPeer::DOC_TYPE);

		$criteria->addSelectColumn(TbldocumentPeer::DOC_FILENAME);

		$criteria->addSelectColumn(TbldocumentPeer::DOC_USER);

		$criteria->addSelectColumn(TbldocumentPeer::DOC_DATE);

		$criteria->addSelectColumn(TbldocumentPeer::DOC_HIT);

		$criteria->addSelectColumn(TbldocumentPeer::DOC_RATING);

		$criteria->addSelectColumn(TbldocumentPeer::DOC_STATUS);

		$criteria->addSelectColumn(TbldocumentPeer::DOC_WIDTH);

		$criteria->addSelectColumn(TbldocumentPeer::DOC_HEIGHT);

		$criteria->addSelectColumn(TbldocumentPeer::DOC_VIEW);

		$criteria->addSelectColumn(TbldocumentPeer::DOC_MANAGER);

		$criteria->addSelectColumn(TbldocumentPeer::DOC_REPORT);

		$criteria->addSelectColumn(TbldocumentPeer::DOC_FILESIZE);

		$criteria->addSelectColumn(TbldocumentPeer::DOC_THUMBNAIL);

	}

	
	public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null)
	{
				$criteria = clone $criteria;

								$criteria->setPrimaryTableName(TbldocumentPeer::TABLE_NAME);

		if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
			$criteria->setDistinct();
		}

		if (!$criteria->hasSelectClause()) {
			TbldocumentPeer::addSelectColumns($criteria);
		}

		$criteria->clearOrderByColumns(); 		$criteria->setDbName(self::DATABASE_NAME); 
		if ($con === null) {
			$con = Propel::getConnection(TbldocumentPeer::DATABASE_NAME, Propel::CONNECTION_READ);
		}
				$stmt = BasePeer::doCount($criteria, $con);

		if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
			$count = (int) $row[0];
		} else {
			$count = 0; 		}
		$stmt->closeCursor();
		return $count;
	}
	
	public static function doSelectOne(Criteria $criteria, PropelPDO $con = null)
	{
		$critcopy = clone $criteria;
		$critcopy->setLimit(1);
		$objects = TbldocumentPeer::doSelect($critcopy, $con);
		if ($objects) {
			return $objects[0];
		}
		return null;
	}
	
	public static function doSelect(Criteria $criteria, PropelPDO $con = null)
	{
		return TbldocumentPeer::populateObjects(TbldocumentPeer::doSelectStmt($criteria, $con));
	}
	
	public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null)
	{
		if ($con === null) {
			$con = Propel::getConnection(TbldocumentPeer::DATABASE_NAME, Propel::CONNECTION_READ);
		}

		if (!$criteria->hasSelectClause()) {
			$criteria = clone $criteria;
			TbldocumentPeer::addSelectColumns($criteria);
		}

				$criteria->setDbName(self::DATABASE_NAME);

				return BasePeer::doSelect($criteria, $con);
	}
	
	public static function addInstanceToPool(Tbldocument $obj, $key = null)
	{
		if (Propel::isInstancePoolingEnabled()) {
			if ($key === null) {
				$key = (string) $obj->getDocId();
			} 			self::$instances[$key] = $obj;
		}
	}

	
	public static function removeInstanceFromPool($value)
	{
		if (Propel::isInstancePoolingEnabled() && $value !== null) {
			if (is_object($value) && $value instanceof Tbldocument) {
				$key = (string) $value->getDocId();
			} elseif (is_scalar($value)) {
								$key = (string) $value;
			} else {
				$e = new PropelException("Invalid value passed to removeInstanceFromPool().  Expected primary key or Tbldocument object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
				throw $e;
			}

			unset(self::$instances[$key]);
		}
	} 
	
	public static function getInstanceFromPool($key)
	{
		if (Propel::isInstancePoolingEnabled()) {
			if (isset(self::$instances[$key])) {
				return self::$instances[$key];
			}
		}
		return null; 	}
	
	
	public static function clearInstancePool()
	{
		self::$instances = array();
	}
	
	
	public static function getPrimaryKeyHashFromRow($row, $startcol = 0)
	{
				if ($row[$startcol + 0] === null) {
			return null;
		}
		return (string) $row[$startcol + 0];
	}

	
	public static function populateObjects(PDOStatement $stmt)
	{
		$results = array();
	
				$cls = TbldocumentPeer::getOMClass();
		$cls = substr('.'.$cls, strrpos('.'.$cls, '.') + 1);
				while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
			$key = TbldocumentPeer::getPrimaryKeyHashFromRow($row, 0);
			if (null !== ($obj = TbldocumentPeer::getInstanceFromPool($key))) {
																$results[] = $obj;
			} else {
		
				$obj = new $cls();
				$obj->hydrate($row);
				$results[] = $obj;
				TbldocumentPeer::addInstanceToPool($obj, $key);
			} 		}
		$stmt->closeCursor();
		return $results;
	}

	
	public static function doCountJoinTbluser(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
	{
				$criteria = clone $criteria;

								$criteria->setPrimaryTableName(TbldocumentPeer::TABLE_NAME);

		if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
			$criteria->setDistinct();
		}

		if (!$criteria->hasSelectClause()) {
			TbldocumentPeer::addSelectColumns($criteria);
		}
		
		$criteria->clearOrderByColumns(); 		
				$criteria->setDbName(self::DATABASE_NAME);

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

		$criteria->addJoin(array(TbldocumentPeer::DOC_USER,), array(TbluserPeer::US_ID,), $join_behavior);
		$stmt = BasePeer::doCount($criteria, $con);

		if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
			$count = (int) $row[0];
		} else {
			$count = 0; 		}
		$stmt->closeCursor();
		return $count;
	}


	
	public static function doSelectJoinTbluser(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN)
	{
		$c = clone $c;

				if ($c->getDbName() == Propel::getDefaultDB()) {
			$c->setDbName(self::DATABASE_NAME);
		}

		TbldocumentPeer::addSelectColumns($c);
		$startcol = (TbldocumentPeer::NUM_COLUMNS - TbldocumentPeer::NUM_LAZY_LOAD_COLUMNS);
		TbluserPeer::addSelectColumns($c);

		$c->addJoin(array(TbldocumentPeer::DOC_USER,), array(TbluserPeer::US_ID,), $join_behavior);
		$stmt = BasePeer::doSelect($c, $con);
		$results = array();

		while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
			$key1 = TbldocumentPeer::getPrimaryKeyHashFromRow($row, 0);
			if (null !== ($obj1 = TbldocumentPeer::getInstanceFromPool($key1))) {
															} else {

				$omClass = TbldocumentPeer::getOMClass();

				$cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1);
				$obj1 = new $cls();
				$obj1->hydrate($row);
				TbldocumentPeer::addInstanceToPool($obj1, $key1);
			} 
			$key2 = TbluserPeer::getPrimaryKeyHashFromRow($row, $startcol);
			if ($key2 !== null) {
				$obj2 = TbluserPeer::getInstanceFromPool($key2);
				if (!$obj2) {

					$omClass = TbluserPeer::getOMClass();

					$cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1);
					$obj2 = new $cls();
					$obj2->hydrate($row, $startcol);
					TbluserPeer::addInstanceToPool($obj2, $key2);
				} 
								$obj2->addTbldocument($obj1);

			} 
			$results[] = $obj1;
		}
		$stmt->closeCursor();
		return $results;
	}


	
	public static function doCountJoinAll(Criteria $criteria, $distinct = false, PropelPDO $con = null, $join_behavior = Criteria::LEFT_JOIN)
	{
				$criteria = clone $criteria;

								$criteria->setPrimaryTableName(TbldocumentPeer::TABLE_NAME);

		if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
			$criteria->setDistinct();
		}

		if (!$criteria->hasSelectClause()) {
			TbldocumentPeer::addSelectColumns($criteria);
		}
		
		$criteria->clearOrderByColumns(); 		
				$criteria->setDbName(self::DATABASE_NAME);

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

		$criteria->addJoin(array(TbldocumentPeer::DOC_USER,), array(TbluserPeer::US_ID,), $join_behavior);
		$stmt = BasePeer::doCount($criteria, $con);

		if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
			$count = (int) $row[0];
		} else {
			$count = 0; 		}
		$stmt->closeCursor();
		return $count;
	}

	
	public static function doSelectJoinAll(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN)
	{
		$c = clone $c;

				if ($c->getDbName() == Propel::getDefaultDB()) {
			$c->setDbName(self::DATABASE_NAME);
		}

		TbldocumentPeer::addSelectColumns($c);
		$startcol2 = (TbldocumentPeer::NUM_COLUMNS - TbldocumentPeer::NUM_LAZY_LOAD_COLUMNS);

		TbluserPeer::addSelectColumns($c);
		$startcol3 = $startcol2 + (TbluserPeer::NUM_COLUMNS - TbluserPeer::NUM_LAZY_LOAD_COLUMNS);

		$c->addJoin(array(TbldocumentPeer::DOC_USER,), array(TbluserPeer::US_ID,), $join_behavior);
		$stmt = BasePeer::doSelect($c, $con);
		$results = array();

		while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
			$key1 = TbldocumentPeer::getPrimaryKeyHashFromRow($row, 0);
			if (null !== ($obj1 = TbldocumentPeer::getInstanceFromPool($key1))) {
															} else {
				$omClass = TbldocumentPeer::getOMClass();

				$cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1);
				$obj1 = new $cls();
				$obj1->hydrate($row);
				TbldocumentPeer::addInstanceToPool($obj1, $key1);
			} 
			
			$key2 = TbluserPeer::getPrimaryKeyHashFromRow($row, $startcol2);
			if ($key2 !== null) {
				$obj2 = TbluserPeer::getInstanceFromPool($key2);
				if (!$obj2) {

					$omClass = TbluserPeer::getOMClass();


					$cls = substr('.'.$omClass, strrpos('.'.$omClass, '.') + 1);
					$obj2 = new $cls();
					$obj2->hydrate($row, $startcol2);
					TbluserPeer::addInstanceToPool($obj2, $key2);
				} 
								$obj2->addTbldocument($obj1);
			} 
			$results[] = $obj1;
		}
		$stmt->closeCursor();
		return $results;
	}

	
	public static function getTableMap()
	{
		return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME);
	}

	
	public static function getOMClass()
	{
		return TbldocumentPeer::CLASS_DEFAULT;
	}

	
	public static function doInsert($values, PropelPDO $con = null)
	{
		if ($con === null) {
			$con = Propel::getConnection(TbldocumentPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
		}

		if ($values instanceof Criteria) {
			$criteria = clone $values; 		} else {
			$criteria = $values->buildCriteria(); 		}

		if ($criteria->containsKey(TbldocumentPeer::DOC_ID) && $criteria->keyContainsValue(TbldocumentPeer::DOC_ID) ) {
			throw new PropelException('Cannot insert a value for auto-increment primary key ('.TbldocumentPeer::DOC_ID.')');
		}


				$criteria->setDbName(self::DATABASE_NAME);

		try {
									$con->beginTransaction();
			$pk = BasePeer::doInsert($criteria, $con);
			$con->commit();
		} catch(PropelException $e) {
			$con->rollBack();
			throw $e;
		}

		return $pk;
	}

	
	public static function doUpdate($values, PropelPDO $con = null)
	{
		if ($con === null) {
			$con = Propel::getConnection(TbldocumentPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
		}

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

		if ($values instanceof Criteria) {
			$criteria = clone $values; 
			$comparison = $criteria->getComparison(TbldocumentPeer::DOC_ID);
			$selectCriteria->add(TbldocumentPeer::DOC_ID, $criteria->remove(TbldocumentPeer::DOC_ID), $comparison);

		} else { 			$criteria = $values->buildCriteria(); 			$selectCriteria = $values->buildPkeyCriteria(); 		}

				$criteria->setDbName(self::DATABASE_NAME);

		return BasePeer::doUpdate($selectCriteria, $criteria, $con);
	}

	
	public static function doDeleteAll($con = null)
	{
		if ($con === null) {
			$con = Propel::getConnection(TbldocumentPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
		}
		$affectedRows = 0; 		try {
									$con->beginTransaction();
			$affectedRows += BasePeer::doDeleteAll(TbldocumentPeer::TABLE_NAME, $con);
			$con->commit();
			return $affectedRows;
		} catch (PropelException $e) {
			$con->rollBack();
			throw $e;
		}
	}

	
	 public static function doDelete($values, PropelPDO $con = null)
	 {
		if ($con === null) {
			$con = Propel::getConnection(TbldocumentPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
		}

		if ($values instanceof Criteria) {
												TbldocumentPeer::clearInstancePool();

						$criteria = clone $values;
		} elseif ($values instanceof Tbldocument) {
						TbldocumentPeer::removeInstanceFromPool($values);
						$criteria = $values->buildPkeyCriteria();
		} else {
			


			$criteria = new Criteria(self::DATABASE_NAME);
			$criteria->add(TbldocumentPeer::DOC_ID, (array) $values, Criteria::IN);

			foreach ((array) $values as $singleval) {
								TbldocumentPeer::removeInstanceFromPool($singleval);
			}
		}

				$criteria->setDbName(self::DATABASE_NAME);

		$affectedRows = 0; 
		try {
									$con->beginTransaction();
			
			$affectedRows += BasePeer::doDelete($criteria, $con);

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

	
	public static function doValidate(Tbldocument $obj, $cols = null)
	{
		$columns = array();

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

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

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

		}

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

    return $res;
	}

	
	public static function retrieveByPK($pk, PropelPDO $con = null)
	{

		if (null !== ($obj = TbldocumentPeer::getInstanceFromPool((string) $pk))) {
			return $obj;
		}

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

		$criteria = new Criteria(TbldocumentPeer::DATABASE_NAME);
		$criteria->add(TbldocumentPeer::DOC_ID, $pk);

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

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

	
	public static function retrieveByPKs($pks, PropelPDO $con = null)
	{
		if ($con === null) {
			$con = Propel::getConnection(TbldocumentPeer::DATABASE_NAME, Propel::CONNECTION_READ);
		}

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

} 

Propel::getDatabaseMap(BaseTbldocumentPeer::DATABASE_NAME)->addTableBuilder(BaseTbldocumentPeer::TABLE_NAME, BaseTbldocumentPeer::getMapBuilder());

