Author: hsanchez Date: 2009-05-15 17:49:44 -0300 (Fri, 15 May 2009) New Revision: 6185 Added: prosistem/alba/trunk/alba/apps/principal/modules/estadosalumnos/ prosistem/alba/trunk/alba/apps/principal/modules/estadosalumnos/actions/ prosistem/alba/trunk/alba/apps/principal/modules/estadosalumnos/actions/actions.class.php prosistem/alba/trunk/alba/apps/principal/modules/estadosalumnos/config/ prosistem/alba/trunk/alba/apps/principal/modules/estadosalumnos/config/generator.yml prosistem/alba/trunk/alba/apps/principal/modules/estadosalumnos/lib/ prosistem/alba/trunk/alba/apps/principal/modules/estadosalumnos/lib/estadosalumnosGeneratorConfiguration.class.php prosistem/alba/trunk/alba/apps/principal/modules/estadosalumnos/lib/estadosalumnosGeneratorHelper.class.php prosistem/alba/trunk/alba/apps/principal/modules/estadosalumnos/templates/ prosistem/alba/trunk/alba/lib/filter/EstadosalumnosFormFilter.class.php prosistem/alba/trunk/alba/lib/filter/base/BaseEstadosalumnosFormFilter.class.php prosistem/alba/trunk/alba/lib/form/EstadosalumnosForm.class.php prosistem/alba/trunk/alba/lib/form/base/BaseEstadosalumnosForm.class.php prosistem/alba/trunk/alba/lib/model/Estadosalumnos.php prosistem/alba/trunk/alba/lib/model/EstadosalumnosPeer.php prosistem/alba/trunk/alba/lib/model/map/EstadosalumnosMapBuilder.php prosistem/alba/trunk/alba/lib/model/om/BaseEstadosalumnos.php prosistem/alba/trunk/alba/lib/model/om/BaseEstadosalumnosPeer.php Modified: prosistem/alba/trunk/alba/apps/principal/config/routing.yml prosistem/alba/trunk/alba/config/schema.yml Log: Generando modulo de estados alumnos Modified: prosistem/alba/trunk/alba/apps/principal/config/routing.yml =================================================================== --- prosistem/alba/trunk/alba/apps/principal/config/routing.yml 2009-05-15 20:13:04 UTC (rev 6184) +++ prosistem/alba/trunk/alba/apps/principal/config/routing.yml 2009-05-15 20:49:44 UTC (rev 6185) @@ -1,3 +1,12 @@ +estadosalumnos: + class: sfPropelRouteCollection + options: + model: Estadosalumnos + module: estadosalumnos + prefix_path: estadosalumnos + column: id + with_wildcard_routes: true + # default rules homepage: url: / Added: prosistem/alba/trunk/alba/apps/principal/modules/estadosalumnos/actions/actions.class.php =================================================================== --- prosistem/alba/trunk/alba/apps/principal/modules/estadosalumnos/actions/actions.class.php (rev 0) +++ prosistem/alba/trunk/alba/apps/principal/modules/estadosalumnos/actions/actions.class.php 2009-05-15 20:49:44 UTC (rev 6185) @@ -0,0 +1,16 @@ +<?php + +require_once dirname(__FILE__).'/../lib/estadosalumnosGeneratorConfiguration.class.php'; +require_once dirname(__FILE__).'/../lib/estadosalumnosGeneratorHelper.class.php'; + +/** + * estadosalumnos actions. + * + * @package alba + * @subpackage estadosalumnos + * @author Your name here + * @version SVN: $Id: actions.class.php 12474 2008-10-31 10:41:27Z fabien $ + */ +class estadosalumnosActions extends autoEstadosalumnosActions +{ +} Added: prosistem/alba/trunk/alba/apps/principal/modules/estadosalumnos/config/generator.yml =================================================================== --- prosistem/alba/trunk/alba/apps/principal/modules/estadosalumnos/config/generator.yml (rev 0) +++ prosistem/alba/trunk/alba/apps/principal/modules/estadosalumnos/config/generator.yml 2009-05-15 20:49:44 UTC (rev 6185) @@ -0,0 +1,20 @@ +generator: + class: sfPropelGenerator + param: + model_class: Estadosalumnos + theme: admin + non_verbose_templates: true + with_show: false + singular: ~ + plural: ~ + route_prefix: estadosalumnos + with_propel_route: 1 + + config: + actions: ~ + fields: ~ + list: ~ + filter: ~ + form: ~ + edit: ~ + new: ~ Added: prosistem/alba/trunk/alba/apps/principal/modules/estadosalumnos/lib/estadosalumnosGeneratorConfiguration.class.php =================================================================== --- prosistem/alba/trunk/alba/apps/principal/modules/estadosalumnos/lib/estadosalumnosGeneratorConfiguration.class.php (rev 0) +++ prosistem/alba/trunk/alba/apps/principal/modules/estadosalumnos/lib/estadosalumnosGeneratorConfiguration.class.php 2009-05-15 20:49:44 UTC (rev 6185) @@ -0,0 +1,13 @@ +<?php + +/** + * estadosalumnos module configuration. + * + * @package alba + * @subpackage estadosalumnos + * @author Your name here + * @version SVN: $Id: configuration.php 12474 2008-10-31 10:41:27Z fabien $ + */ +class estadosalumnosGeneratorConfiguration extends BaseEstadosalumnosGeneratorConfiguration +{ +} Added: prosistem/alba/trunk/alba/apps/principal/modules/estadosalumnos/lib/estadosalumnosGeneratorHelper.class.php =================================================================== --- prosistem/alba/trunk/alba/apps/principal/modules/estadosalumnos/lib/estadosalumnosGeneratorHelper.class.php (rev 0) +++ prosistem/alba/trunk/alba/apps/principal/modules/estadosalumnos/lib/estadosalumnosGeneratorHelper.class.php 2009-05-15 20:49:44 UTC (rev 6185) @@ -0,0 +1,13 @@ +<?php + +/** + * estadosalumnos module helper. + * + * @package alba + * @subpackage estadosalumnos + * @author Your name here + * @version SVN: $Id: helper.php 12474 2008-10-31 10:41:27Z fabien $ + */ +class estadosalumnosGeneratorHelper extends BaseEstadosalumnosGeneratorHelper +{ +} Modified: prosistem/alba/trunk/alba/config/schema.yml =================================================================== --- prosistem/alba/trunk/alba/config/schema.yml 2009-05-15 20:13:04 UTC (rev 6184) +++ prosistem/alba/trunk/alba/config/schema.yml 2009-05-15 20:49:44 UTC (rev 6185) @@ -1940,3 +1940,16 @@ required: true foreignTable: usuario foreignReference: id + + estadosalumnos: + _attributes: + idMethod: native + id: + type: integer + required: true + autoIncrement: true + primaryKey: true + nombre: + type: varchar + size: 128 + required: true Added: prosistem/alba/trunk/alba/lib/filter/EstadosalumnosFormFilter.class.php =================================================================== --- prosistem/alba/trunk/alba/lib/filter/EstadosalumnosFormFilter.class.php (rev 0) +++ prosistem/alba/trunk/alba/lib/filter/EstadosalumnosFormFilter.class.php 2009-05-15 20:49:44 UTC (rev 6185) @@ -0,0 +1,16 @@ +<?php + +/** + * Estadosalumnos filter form. + * + * @package alba + * @subpackage filter + * @author Your name here + * @version SVN: $Id: sfPropelFormFilterTemplate.php 11675 2008-09-19 15:21:38Z fabien $ + */ +class EstadosalumnosFormFilter extends BaseEstadosalumnosFormFilter +{ + public function configure() + { + } +} Added: prosistem/alba/trunk/alba/lib/filter/base/BaseEstadosalumnosFormFilter.class.php =================================================================== --- prosistem/alba/trunk/alba/lib/filter/base/BaseEstadosalumnosFormFilter.class.php (rev 0) +++ prosistem/alba/trunk/alba/lib/filter/base/BaseEstadosalumnosFormFilter.class.php 2009-05-15 20:49:44 UTC (rev 6185) @@ -0,0 +1,44 @@ +<?php + +require_once(sfConfig::get('sf_lib_dir').'/filter/base/BaseFormFilterPropel.class.php'); + +/** + * Estadosalumnos filter form base class. + * + * @package alba + * @subpackage filter + * @author Your name here + * @version SVN: $Id: sfPropelFormFilterGeneratedTemplate.php 15484 2009-02-13 13:13:51Z fabien $ + */ +class BaseEstadosalumnosFormFilter extends BaseFormFilterPropel +{ + public function setup() + { + $this->setWidgets(array( + 'nombre' => new sfWidgetFormFilterInput(), + )); + + $this->setValidators(array( + 'nombre' => new sfValidatorPass(array('required' => false)), + )); + + $this->widgetSchema->setNameFormat('estadosalumnos_filters[%s]'); + + $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema); + + parent::setup(); + } + + public function getModelName() + { + return 'Estadosalumnos'; + } + + public function getFields() + { + return array( + 'id' => 'Number', + 'nombre' => 'Text', + ); + } +} Added: prosistem/alba/trunk/alba/lib/form/EstadosalumnosForm.class.php =================================================================== --- prosistem/alba/trunk/alba/lib/form/EstadosalumnosForm.class.php (rev 0) +++ prosistem/alba/trunk/alba/lib/form/EstadosalumnosForm.class.php 2009-05-15 20:49:44 UTC (rev 6185) @@ -0,0 +1,16 @@ +<?php + +/** + * Estadosalumnos form. + * + * @package alba + * @subpackage form + * @author Your name here + * @version SVN: $Id: sfPropelFormTemplate.php 10377 2008-07-21 07:10:32Z dwhittle $ + */ +class EstadosalumnosForm extends BaseEstadosalumnosForm +{ + public function configure() + { + } +} Added: prosistem/alba/trunk/alba/lib/form/base/BaseEstadosalumnosForm.class.php =================================================================== --- prosistem/alba/trunk/alba/lib/form/base/BaseEstadosalumnosForm.class.php (rev 0) +++ prosistem/alba/trunk/alba/lib/form/base/BaseEstadosalumnosForm.class.php 2009-05-15 20:49:44 UTC (rev 6185) @@ -0,0 +1,38 @@ +<?php + +/** + * Estadosalumnos form base class. + * + * @package alba + * @subpackage form + * @author Your name here + * @version SVN: $Id: sfPropelFormGeneratedTemplate.php 15484 2009-02-13 13:13:51Z fabien $ + */ +class BaseEstadosalumnosForm extends BaseFormPropel +{ + public function setup() + { + $this->setWidgets(array( + 'id' => new sfWidgetFormInputHidden(), + 'nombre' => new sfWidgetFormInput(), + )); + + $this->setValidators(array( + 'id' => new sfValidatorPropelChoice(array('model' => 'Estadosalumnos', 'column' => 'id', 'required' => false)), + 'nombre' => new sfValidatorString(array('max_length' => 128)), + )); + + $this->widgetSchema->setNameFormat('estadosalumnos[%s]'); + + $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema); + + parent::setup(); + } + + public function getModelName() + { + return 'Estadosalumnos'; + } + + +} Added: prosistem/alba/trunk/alba/lib/model/Estadosalumnos.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/Estadosalumnos.php (rev 0) +++ prosistem/alba/trunk/alba/lib/model/Estadosalumnos.php 2009-05-15 20:49:44 UTC (rev 6185) @@ -0,0 +1,5 @@ +<?php + +class Estadosalumnos extends BaseEstadosalumnos +{ +} Added: prosistem/alba/trunk/alba/lib/model/EstadosalumnosPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/EstadosalumnosPeer.php (rev 0) +++ prosistem/alba/trunk/alba/lib/model/EstadosalumnosPeer.php 2009-05-15 20:49:44 UTC (rev 6185) @@ -0,0 +1,5 @@ +<?php + +class EstadosalumnosPeer extends BaseEstadosalumnosPeer +{ +} Added: prosistem/alba/trunk/alba/lib/model/map/EstadosalumnosMapBuilder.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/map/EstadosalumnosMapBuilder.php (rev 0) +++ prosistem/alba/trunk/alba/lib/model/map/EstadosalumnosMapBuilder.php 2009-05-15 20:49:44 UTC (rev 6185) @@ -0,0 +1,41 @@ +<?php + + + +class EstadosalumnosMapBuilder implements MapBuilder { + + + const CLASS_NAME = 'lib.model.map.EstadosalumnosMapBuilder'; + + + private $dbMap; + + + public function isBuilt() + { + return ($this->dbMap !== null); + } + + + public function getDatabaseMap() + { + return $this->dbMap; + } + + + public function doBuild() + { + $this->dbMap = Propel::getDatabaseMap(EstadosalumnosPeer::DATABASE_NAME); + + $tMap = $this->dbMap->addTable(EstadosalumnosPeer::TABLE_NAME); + $tMap->setPhpName('Estadosalumnos'); + $tMap->setClassname('Estadosalumnos'); + + $tMap->setUseIdGenerator(true); + + $tMap->addPrimaryKey('ID', 'Id', 'INTEGER', true, null); + + $tMap->addColumn('NOMBRE', 'Nombre', 'VARCHAR', true, 128); + + } +} \ No newline at end of file Added: prosistem/alba/trunk/alba/lib/model/om/BaseEstadosalumnos.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseEstadosalumnos.php (rev 0) +++ prosistem/alba/trunk/alba/lib/model/om/BaseEstadosalumnos.php 2009-05-15 20:49:44 UTC (rev 6185) @@ -0,0 +1,385 @@ +<?php + + +abstract class BaseEstadosalumnos extends BaseObject implements Persistent { + + + const PEER = 'EstadosalumnosPeer'; + + + protected static $peer; + + + protected $id; + + + protected $nombre; + + + protected $alreadyInSave = false; + + + protected $alreadyInValidation = false; + + + public function __construct() + { + parent::__construct(); + $this->applyDefaultValues(); + } + + + public function applyDefaultValues() + { + } + + + public function getId() + { + return $this->id; + } + + + public function getNombre() + { + return $this->nombre; + } + + + public function setId($v) + { + if ($v !== null) { + $v = (int) $v; + } + + if ($this->id !== $v) { + $this->id = $v; + $this->modifiedColumns[] = EstadosalumnosPeer::ID; + } + + return $this; + } + + public function setNombre($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->nombre !== $v) { + $this->nombre = $v; + $this->modifiedColumns[] = EstadosalumnosPeer::NOMBRE; + } + + return $this; + } + + public function hasOnlyDefaultValues() + { + if (array_diff($this->modifiedColumns, array())) { + return false; + } + + return true; + } + + public function hydrate($row, $startcol = 0, $rehydrate = false) + { + try { + + $this->id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null; + $this->nombre = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null; + $this->resetModified(); + + $this->setNew(false); + + if ($rehydrate) { + $this->ensureConsistency(); + } + + return $startcol + 2; + } catch (Exception $e) { + throw new PropelException("Error populating Estadosalumnos object", $e); + } + } + + + public function ensureConsistency() + { + + } + + 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(EstadosalumnosPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + + $stmt = EstadosalumnosPeer::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); + if ($deep) { + } } + + + public function delete(PropelPDO $con = null) + { + if ($this->isDeleted()) { + throw new PropelException("This object has already been deleted."); + } + + if ($con === null) { + $con = Propel::getConnection(EstadosalumnosPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + EstadosalumnosPeer::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(EstadosalumnosPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $con->beginTransaction(); + try { + $affectedRows = $this->doSave($con); + $con->commit(); + EstadosalumnosPeer::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->isNew() ) { + $this->modifiedColumns[] = EstadosalumnosPeer::ID; + } + + if ($this->isModified()) { + if ($this->isNew()) { + $pk = EstadosalumnosPeer::doInsert($this, $con); + $affectedRows += 1; + $this->setId($pk); + $this->setNew(false); + } else { + $affectedRows += EstadosalumnosPeer::doUpdate($this, $con); + } + + $this->resetModified(); } + + $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 = EstadosalumnosPeer::doValidate($this, $columns)) !== true) { + $failureMap = array_merge($failureMap, $retval); + } + + + + $this->alreadyInValidation = false; + } + + return (!empty($failureMap) ? $failureMap : true); + } + + + public function getByName($name, $type = BasePeer::TYPE_PHPNAME) + { + $pos = EstadosalumnosPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + $field = $this->getByPosition($pos); + return $field; + } + + + public function getByPosition($pos) + { + switch($pos) { + case 0: + return $this->getId(); + break; + case 1: + return $this->getNombre(); + break; + default: + return null; + break; + } } + + + public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true) + { + $keys = EstadosalumnosPeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getId(), + $keys[1] => $this->getNombre(), + ); + return $result; + } + + + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = EstadosalumnosPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + return $this->setByPosition($pos, $value); + } + + + public function setByPosition($pos, $value) + { + switch($pos) { + case 0: + $this->setId($value); + break; + case 1: + $this->setNombre($value); + break; + } } + + + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) + { + $keys = EstadosalumnosPeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setNombre($arr[$keys[1]]); + } + + + public function buildCriteria() + { + $criteria = new Criteria(EstadosalumnosPeer::DATABASE_NAME); + + if ($this->isColumnModified(EstadosalumnosPeer::ID)) $criteria->add(EstadosalumnosPeer::ID, $this->id); + if ($this->isColumnModified(EstadosalumnosPeer::NOMBRE)) $criteria->add(EstadosalumnosPeer::NOMBRE, $this->nombre); + + return $criteria; + } + + + public function buildPkeyCriteria() + { + $criteria = new Criteria(EstadosalumnosPeer::DATABASE_NAME); + + $criteria->add(EstadosalumnosPeer::ID, $this->id); + + return $criteria; + } + + + public function getPrimaryKey() + { + return $this->getId(); + } + + + public function setPrimaryKey($key) + { + $this->setId($key); + } + + + public function copyInto($copyObj, $deepCopy = false) + { + + $copyObj->setNombre($this->nombre); + + + $copyObj->setNew(true); + + $copyObj->setId(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 EstadosalumnosPeer(); + } + return self::$peer; + } + + + public function clearAllReferences($deep = false) + { + if ($deep) { + } + } + +} \ No newline at end of file Added: prosistem/alba/trunk/alba/lib/model/om/BaseEstadosalumnosPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseEstadosalumnosPeer.php (rev 0) +++ prosistem/alba/trunk/alba/lib/model/om/BaseEstadosalumnosPeer.php 2009-05-15 20:49:44 UTC (rev 6185) @@ -0,0 +1,431 @@ +<?php + + +abstract class BaseEstadosalumnosPeer { + + + const DATABASE_NAME = 'propel'; + + + const TABLE_NAME = 'estadosalumnos'; + + + const CLASS_DEFAULT = 'lib.model.Estadosalumnos'; + + + const NUM_COLUMNS = 2; + + + const NUM_LAZY_LOAD_COLUMNS = 0; + + + const ID = 'estadosalumnos.ID'; + + + const NOMBRE = 'estadosalumnos.NOMBRE'; + + + public static $instances = array(); + + + private static $mapBuilder = null; + + + private static $fieldNames = array ( + BasePeer::TYPE_PHPNAME => array ('Id', 'Nombre', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'nombre', ), + BasePeer::TYPE_COLNAME => array (self::ID, self::NOMBRE, ), + BasePeer::TYPE_FIELDNAME => array ('id', 'nombre', ), + BasePeer::TYPE_NUM => array (0, 1, ) + ); + + + private static $fieldKeys = array ( + BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Nombre' => 1, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'nombre' => 1, ), + BasePeer::TYPE_COLNAME => array (self::ID => 0, self::NOMBRE => 1, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'nombre' => 1, ), + BasePeer::TYPE_NUM => array (0, 1, ) + ); + + + public static function getMapBuilder() + { + if (self::$mapBuilder === null) { + self::$mapBuilder = new EstadosalumnosMapBuilder(); + } + 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(EstadosalumnosPeer::TABLE_NAME.'.', $alias.'.', $column); + } + + + public static function addSelectColumns(Criteria $criteria) + { + + $criteria->addSelectColumn(EstadosalumnosPeer::ID); + + $criteria->addSelectColumn(EstadosalumnosPeer::NOMBRE); + + } + + + public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null) + { + $criteria = clone $criteria; + + $criteria->setPrimaryTableName(EstadosalumnosPeer::TABLE_NAME); + + if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->setDistinct(); + } + + if (!$criteria->hasSelectClause()) { + EstadosalumnosPeer::addSelectColumns($criteria); + } + + $criteria->clearOrderByColumns(); $criteria->setDbName(self::DATABASE_NAME); + if ($con === null) { + $con = Propel::getConnection(EstadosalumnosPeer::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 = EstadosalumnosPeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + + public static function doSelect(Criteria $criteria, PropelPDO $con = null) + { + return EstadosalumnosPeer::populateObjects(EstadosalumnosPeer::doSelectStmt($criteria, $con)); + } + + public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(EstadosalumnosPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + if (!$criteria->hasSelectClause()) { + $criteria = clone $criteria; + EstadosalumnosPeer::addSelectColumns($criteria); + } + + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doSelect($criteria, $con); + } + + public static function addInstanceToPool(Estadosalumnos $obj, $key = null) + { + if (Propel::isInstancePoolingEnabled()) { + if ($key === null) { + $key = (string) $obj->getId(); + } self::$instances[$key] = $obj; + } + } + + + public static function removeInstanceFromPool($value) + { + if (Propel::isInstancePoolingEnabled() && $value !== null) { + if (is_object($value) && $value instanceof Estadosalumnos) { + $key = (string) $value->getId(); + } elseif (is_scalar($value)) { + $key = (string) $value; + } else { + $e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or Estadosalumnos 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 = EstadosalumnosPeer::getOMClass(); + $cls = substr('.'.$cls, strrpos('.'.$cls, '.') + 1); + while ($row = $stmt->fetch(PDO::FETCH_NUM)) { + $key = EstadosalumnosPeer::getPrimaryKeyHashFromRow($row, 0); + if (null !== ($obj = EstadosalumnosPeer::getInstanceFromPool($key))) { + $results[] = $obj; + } else { + + $obj = new $cls(); + $obj->hydrate($row); + $results[] = $obj; + EstadosalumnosPeer::addInstanceToPool($obj, $key); + } } + $stmt->closeCursor(); + return $results; + } + + static public function getUniqueColumnNames() + { + return array(); + } + + public static function getTableMap() + { + return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); + } + + + public static function getOMClass() + { + return EstadosalumnosPeer::CLASS_DEFAULT; + } + + + public static function doInsert($values, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(EstadosalumnosPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; } else { + $criteria = $values->buildCriteria(); } + + if ($criteria->containsKey(EstadosalumnosPeer::ID) && $criteria->keyContainsValue(EstadosalumnosPeer::ID) ) { + throw new PropelException('Cannot insert a value for auto-increment primary key ('.EstadosalumnosPeer::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(EstadosalumnosPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; + $comparison = $criteria->getComparison(EstadosalumnosPeer::ID); + $selectCriteria->add(EstadosalumnosPeer::ID, $criteria->remove(EstadosalumnosPeer::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(EstadosalumnosPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + $affectedRows = 0; try { + $con->beginTransaction(); + $affectedRows += BasePeer::doDeleteAll(EstadosalumnosPeer::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(EstadosalumnosPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); + } + + if ($values instanceof Criteria) { + EstadosalumnosPeer::clearInstancePool(); + + $criteria = clone $values; + } elseif ($values instanceof Estadosalumnos) { + EstadosalumnosPeer::removeInstanceFromPool($values); + $criteria = $values->buildPkeyCriteria(); + } else { + + + + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(EstadosalumnosPeer::ID, (array) $values, Criteria::IN); + + foreach ((array) $values as $singleval) { + EstadosalumnosPeer::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(Estadosalumnos $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(EstadosalumnosPeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(EstadosalumnosPeer::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(EstadosalumnosPeer::DATABASE_NAME, EstadosalumnosPeer::TABLE_NAME, $columns); + if ($res !== true) { + $request = sfContext::getInstance()->getRequest(); + foreach ($res as $failed) { + $col = EstadosalumnosPeer::translateFieldname($failed->getColumn(), BasePeer::TYPE_COLNAME, BasePeer::TYPE_PHPNAME); + } + } + + return $res; + } + + + public static function retrieveByPK($pk, PropelPDO $con = null) + { + + if (null !== ($obj = EstadosalumnosPeer::getInstanceFromPool((string) $pk))) { + return $obj; + } + + if ($con === null) { + $con = Propel::getConnection(EstadosalumnosPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $criteria = new Criteria(EstadosalumnosPeer::DATABASE_NAME); + $criteria->add(EstadosalumnosPeer::ID, $pk); + + $v = EstadosalumnosPeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + + public static function retrieveByPKs($pks, PropelPDO $con = null) + { + if ($con === null) { + $con = Propel::getConnection(EstadosalumnosPeer::DATABASE_NAME, Propel::CONNECTION_READ); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(EstadosalumnosPeer::DATABASE_NAME); + $criteria->add(EstadosalumnosPeer::ID, $pks, Criteria::IN); + $objs = EstadosalumnosPeer::doSelect($criteria, $con); + } + return $objs; + } + +} + +Propel::getDatabaseMap(BaseEstadosalumnosPeer::DATABASE_NAME)->addTableBuilder(BaseEstadosalumnosPeer::TABLE_NAME, BaseEstadosalumnosPeer::getMapBuilder()); +