SVN Alba r4566 - in prosistem/alba/trunk/alba: apps/principal/modules/calendario/actions config data/sql lib/model lib/model/map lib/model/om
Author: josx Date: 2007-04-25 12:07:43 -0300 (Wed, 25 Apr 2007) New Revision: 4566 Added: prosistem/alba/trunk/alba/lib/model/Evento.php prosistem/alba/trunk/alba/lib/model/EventoPeer.php prosistem/alba/trunk/alba/lib/model/map/EventoMapBuilder.php prosistem/alba/trunk/alba/lib/model/om/BaseEvento.php prosistem/alba/trunk/alba/lib/model/om/BaseEventoPeer.php Modified: prosistem/alba/trunk/alba/apps/principal/modules/calendario/actions/actions.class.php prosistem/alba/trunk/alba/config/schema.xml prosistem/alba/trunk/alba/data/sql/actualizacion_1.0rc_a_1.0.sql prosistem/alba/trunk/alba/data/sql/schema.sql Log: Se agrego la tabla eventos Modified: prosistem/alba/trunk/alba/apps/principal/modules/calendario/actions/actions.class.php =================================================================== --- prosistem/alba/trunk/alba/apps/principal/modules/calendario/actions/actions.class.php 2007-04-25 13:33:48 UTC (rev 4565) +++ prosistem/alba/trunk/alba/apps/principal/modules/calendario/actions/actions.class.php 2007-04-25 15:07:43 UTC (rev 4566) @@ -657,5 +657,4 @@ } } - ?> \ No newline at end of file Modified: prosistem/alba/trunk/alba/config/schema.xml =================================================================== --- prosistem/alba/trunk/alba/config/schema.xml 2007-04-25 13:33:48 UTC (rev 4565) +++ prosistem/alba/trunk/alba/config/schema.xml 2007-04-25 15:07:43 UTC (rev 4566) @@ -716,12 +716,12 @@ </foreign-key> </table> <table name="tipoasistencia" idMethod="native"> - <column name="id" type="integer" size="11" required="true" autoIncrement="true" primaryKey="true"/> - <column name="nombre" type="varchar" size="10" required="true"/> - <column name="descripcion" type="varchar" size="255" required="false" default=""/> - <column name="valor" type="decimal" size="4,2" required="true" default="1"/> - <column name="grupo" type="varchar" size="30" required="false" default=""/> - <column name="defecto" type="boolean" required="true" default="0"/> + <column name="id" type="INTEGER" size="11" required="true" autoIncrement="true" primaryKey="true"/> + <column name="nombre" type="VARCHAR" size="10" required="true"/> + <column name="descripcion" type="VARCHAR" size="255" required="false" default=""/> + <column name="valor" type="DECIMAL" size="4,2" required="true" default="1"/> + <column name="grupo" type="VARCHAR" size="30" required="false" default=""/> + <column name="defecto" type="BOOLEAN" required="true" default="0"/> </table> <table name="rol_responsable" idMethod="native"> <column name="id" type="INTEGER" required="true" autoIncrement="true" primaryKey="true"/> @@ -729,4 +729,15 @@ <column name="descripcion" type="VARCHAR" size="255" default=""/> <column name="activo" type="BOOLEAN" required="true" default="true"/> </table> + <table name="evento" idMethod="native"> + <column name="id" type="INTEGER" required="true" autoIncrement="true" primaryKey="true"/> + <column name="fecha_inicio" type="TIMESTAMP" required="true"/> + <column name="fecha_fin" type="TIMESTAMP" required="true"/> + <column name="tipo" type="INTEGER" required="true" default="0"/> + <column name="frecuencia" type="INTEGER" required="true" default="0"/> + <column name="frecuencia_intervalo" type="INTEGER" required="true" default="0"/> + <column name="recurrencia_fin" type="VARCHAR" size="16" required="false" default=""/> + <column name="recurrencia_dias" type="INTEGER" required="true" default="0"/> + <column name="estado" type="INTEGER" required="true" default="0"/> + </table> </database> \ No newline at end of file Modified: prosistem/alba/trunk/alba/data/sql/actualizacion_1.0rc_a_1.0.sql =================================================================== --- prosistem/alba/trunk/alba/data/sql/actualizacion_1.0rc_a_1.0.sql 2007-04-25 13:33:48 UTC (rev 4565) +++ prosistem/alba/trunk/alba/data/sql/actualizacion_1.0rc_a_1.0.sql 2007-04-25 15:07:43 UTC (rev 4566) @@ -6,8 +6,6 @@ '96', 'Biblioteca de contenidos', 'sfMediaLibrary', 'informes', '9', '0', '' ); -SET FOREIGN_KEY_CHECKS = 1; - CREATE TABLE `rol_responsable` ( `id` INTEGER NOT NULL AUTO_INCREMENT, @@ -16,3 +14,21 @@ `activo` INTEGER default 1 NOT NULL, PRIMARY KEY (`id`) )Type=InnoDB; + +CREATE TABLE `evento` +( + `id` INTEGER NOT NULL AUTO_INCREMENT, + `fecha_inicio` DATETIME NOT NULL, + `fecha_fin` DATETIME NOT NULL, + `tipo` INTEGER default 0 NOT NULL, + `frecuencia` INTEGER default 0 NOT NULL, + `frecuencia_intervalo` INTEGER default 0 NOT NULL, + `recurrencia_fin` VARCHAR(16) default '', + `recurrencia_dias` INTEGER default 0 NOT NULL, + `estado` INTEGER default 0 NOT NULL, + PRIMARY KEY (`id`) +)Type=InnoDB; + +SET FOREIGN_KEY_CHECKS = 1; + + Modified: prosistem/alba/trunk/alba/data/sql/schema.sql =================================================================== --- prosistem/alba/trunk/alba/data/sql/schema.sql 2007-04-25 13:33:48 UTC (rev 4565) +++ prosistem/alba/trunk/alba/data/sql/schema.sql 2007-04-25 15:07:43 UTC (rev 4566) @@ -1375,5 +1375,42 @@ PRIMARY KEY (`id`) )Type=InnoDB; +#----------------------------------------------------------------------------- +#-- rol_responsable +#----------------------------------------------------------------------------- + +DROP TABLE IF EXISTS `rol_responsable`; + + +CREATE TABLE `rol_responsable` +( + `id` INTEGER NOT NULL AUTO_INCREMENT, + `nombre` VARCHAR(128) default '' NOT NULL, + `descripcion` VARCHAR(255) default '', + `activo` INTEGER default 1 NOT NULL, + PRIMARY KEY (`id`) +)Type=InnoDB; + +#----------------------------------------------------------------------------- +#-- evento +#----------------------------------------------------------------------------- + +DROP TABLE IF EXISTS `evento`; + + +CREATE TABLE `evento` +( + `id` INTEGER NOT NULL AUTO_INCREMENT, + `fecha_inicio` DATETIME NOT NULL, + `fecha_fin` DATETIME NOT NULL, + `tipo` INTEGER default 0 NOT NULL, + `frecuencia` INTEGER default 0 NOT NULL, + `frecuencia_intervalo` INTEGER default 0 NOT NULL, + `recurrencia_fin` VARCHAR(16) default '', + `recurrencia_dias` INTEGER default 0 NOT NULL, + `estado` INTEGER default 0 NOT NULL, + PRIMARY KEY (`id`) +)Type=InnoDB; + # This restores the fkey checks, after having unset them earlier SET FOREIGN_KEY_CHECKS = 1; Added: prosistem/alba/trunk/alba/lib/model/Evento.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/Evento.php 2007-04-25 13:33:48 UTC (rev 4565) +++ prosistem/alba/trunk/alba/lib/model/Evento.php 2007-04-25 15:07:43 UTC (rev 4566) @@ -0,0 +1,12 @@ +<?php + +/** + * Subclass for representing a row from the 'evento' table. + * + * + * + * @package lib.model + */ +class Evento extends BaseEvento +{ +} Property changes on: prosistem/alba/trunk/alba/lib/model/Evento.php ___________________________________________________________________ Name: svn:keywords + "Id Author URL Date Rev" Added: prosistem/alba/trunk/alba/lib/model/EventoPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/EventoPeer.php 2007-04-25 13:33:48 UTC (rev 4565) +++ prosistem/alba/trunk/alba/lib/model/EventoPeer.php 2007-04-25 15:07:43 UTC (rev 4566) @@ -0,0 +1,12 @@ +<?php + +/** + * Subclass for performing query and update operations on the 'evento' table. + * + * + * + * @package lib.model + */ +class EventoPeer extends BaseEventoPeer +{ +} Property changes on: prosistem/alba/trunk/alba/lib/model/EventoPeer.php ___________________________________________________________________ Name: svn:keywords + "Id Author URL Date Rev" Added: prosistem/alba/trunk/alba/lib/model/map/EventoMapBuilder.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/map/EventoMapBuilder.php 2007-04-25 13:33:48 UTC (rev 4565) +++ prosistem/alba/trunk/alba/lib/model/map/EventoMapBuilder.php 2007-04-25 15:07:43 UTC (rev 4566) @@ -0,0 +1,54 @@ +<?php + + + +class EventoMapBuilder { + + + const CLASS_NAME = 'lib.model.map.EventoMapBuilder'; + + + private $dbMap; + + + public function isBuilt() + { + return ($this->dbMap !== null); + } + + + public function getDatabaseMap() + { + return $this->dbMap; + } + + + public function doBuild() + { + $this->dbMap = Propel::getDatabaseMap('alba'); + + $tMap = $this->dbMap->addTable('evento'); + $tMap->setPhpName('Evento'); + + $tMap->setUseIdGenerator(true); + + $tMap->addPrimaryKey('ID', 'Id', 'int', CreoleTypes::INTEGER, true, null); + + $tMap->addColumn('FECHA_INICIO', 'FechaInicio', 'int', CreoleTypes::TIMESTAMP, true); + + $tMap->addColumn('FECHA_FIN', 'FechaFin', 'int', CreoleTypes::TIMESTAMP, true); + + $tMap->addColumn('TIPO', 'Tipo', 'int', CreoleTypes::INTEGER, true); + + $tMap->addColumn('FRECUENCIA', 'Frecuencia', 'int', CreoleTypes::INTEGER, true); + + $tMap->addColumn('FRECUENCIA_INTERVALO', 'FrecuenciaIntervalo', 'int', CreoleTypes::INTEGER, true); + + $tMap->addColumn('RECURRENCIA_FIN', 'RecurrenciaFin', 'string', CreoleTypes::VARCHAR, false, 16); + + $tMap->addColumn('RECURRENCIA_DIAS', 'RecurrenciaDias', 'int', CreoleTypes::INTEGER, true); + + $tMap->addColumn('ESTADO', 'Estado', 'int', CreoleTypes::INTEGER, true); + + } +} \ No newline at end of file Property changes on: prosistem/alba/trunk/alba/lib/model/map/EventoMapBuilder.php ___________________________________________________________________ Name: svn:keywords + "Id Author URL Date Rev" Added: prosistem/alba/trunk/alba/lib/model/om/BaseEvento.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseEvento.php 2007-04-25 13:33:48 UTC (rev 4565) +++ prosistem/alba/trunk/alba/lib/model/om/BaseEvento.php 2007-04-25 15:07:43 UTC (rev 4566) @@ -0,0 +1,593 @@ +<?php + + +abstract class BaseEvento extends BaseObject implements Persistent { + + + + protected static $peer; + + + + protected $id; + + + + protected $fecha_inicio; + + + + protected $fecha_fin; + + + + protected $tipo = 0; + + + + protected $frecuencia = 0; + + + + protected $frecuencia_intervalo = 0; + + + + protected $recurrencia_fin = ''; + + + + protected $recurrencia_dias = 0; + + + + protected $estado = 0; + + + protected $alreadyInSave = false; + + + protected $alreadyInValidation = false; + + + public function getId() + { + + return $this->id; + } + + + public function getFechaInicio($format = 'Y-m-d H:i:s') + { + + if ($this->fecha_inicio === null || $this->fecha_inicio === '') { + return null; + } elseif (!is_int($this->fecha_inicio)) { + $ts = strtotime($this->fecha_inicio); + if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse value of [fecha_inicio] as date/time value: " . var_export($this->fecha_inicio, true)); + } + } else { + $ts = $this->fecha_inicio; + } + if ($format === null) { + return $ts; + } elseif (strpos($format, '%') !== false) { + return strftime($format, $ts); + } else { + return date($format, $ts); + } + } + + + public function getFechaFin($format = 'Y-m-d H:i:s') + { + + if ($this->fecha_fin === null || $this->fecha_fin === '') { + return null; + } elseif (!is_int($this->fecha_fin)) { + $ts = strtotime($this->fecha_fin); + if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse value of [fecha_fin] as date/time value: " . var_export($this->fecha_fin, true)); + } + } else { + $ts = $this->fecha_fin; + } + if ($format === null) { + return $ts; + } elseif (strpos($format, '%') !== false) { + return strftime($format, $ts); + } else { + return date($format, $ts); + } + } + + + public function getTipo() + { + + return $this->tipo; + } + + + public function getFrecuencia() + { + + return $this->frecuencia; + } + + + public function getFrecuenciaIntervalo() + { + + return $this->frecuencia_intervalo; + } + + + public function getRecurrenciaFin() + { + + return $this->recurrencia_fin; + } + + + public function getRecurrenciaDias() + { + + return $this->recurrencia_dias; + } + + + public function getEstado() + { + + return $this->estado; + } + + + public function setId($v) + { + + if ($this->id !== $v) { + $this->id = $v; + $this->modifiedColumns[] = EventoPeer::ID; + } + + } + + public function setFechaInicio($v) + { + + if ($v !== null && !is_int($v)) { + $ts = strtotime($v); + if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse date/time value for [fecha_inicio] from input: " . var_export($v, true)); + } + } else { + $ts = $v; + } + if ($this->fecha_inicio !== $ts) { + $this->fecha_inicio = $ts; + $this->modifiedColumns[] = EventoPeer::FECHA_INICIO; + } + + } + + public function setFechaFin($v) + { + + if ($v !== null && !is_int($v)) { + $ts = strtotime($v); + if ($ts === -1 || $ts === false) { throw new PropelException("Unable to parse date/time value for [fecha_fin] from input: " . var_export($v, true)); + } + } else { + $ts = $v; + } + if ($this->fecha_fin !== $ts) { + $this->fecha_fin = $ts; + $this->modifiedColumns[] = EventoPeer::FECHA_FIN; + } + + } + + public function setTipo($v) + { + + if ($this->tipo !== $v || $v === 0) { + $this->tipo = $v; + $this->modifiedColumns[] = EventoPeer::TIPO; + } + + } + + public function setFrecuencia($v) + { + + if ($this->frecuencia !== $v || $v === 0) { + $this->frecuencia = $v; + $this->modifiedColumns[] = EventoPeer::FRECUENCIA; + } + + } + + public function setFrecuenciaIntervalo($v) + { + + if ($this->frecuencia_intervalo !== $v || $v === 0) { + $this->frecuencia_intervalo = $v; + $this->modifiedColumns[] = EventoPeer::FRECUENCIA_INTERVALO; + } + + } + + public function setRecurrenciaFin($v) + { + + if ($this->recurrencia_fin !== $v || $v === '') { + $this->recurrencia_fin = $v; + $this->modifiedColumns[] = EventoPeer::RECURRENCIA_FIN; + } + + } + + public function setRecurrenciaDias($v) + { + + if ($this->recurrencia_dias !== $v || $v === 0) { + $this->recurrencia_dias = $v; + $this->modifiedColumns[] = EventoPeer::RECURRENCIA_DIAS; + } + + } + + public function setEstado($v) + { + + if ($this->estado !== $v || $v === 0) { + $this->estado = $v; + $this->modifiedColumns[] = EventoPeer::ESTADO; + } + + } + + public function hydrate(ResultSet $rs, $startcol = 1) + { + try { + + $this->id = $rs->getInt($startcol + 0); + + $this->fecha_inicio = $rs->getTimestamp($startcol + 1, null); + + $this->fecha_fin = $rs->getTimestamp($startcol + 2, null); + + $this->tipo = $rs->getInt($startcol + 3); + + $this->frecuencia = $rs->getInt($startcol + 4); + + $this->frecuencia_intervalo = $rs->getInt($startcol + 5); + + $this->recurrencia_fin = $rs->getString($startcol + 6); + + $this->recurrencia_dias = $rs->getInt($startcol + 7); + + $this->estado = $rs->getInt($startcol + 8); + + $this->resetModified(); + + $this->setNew(false); + + return $startcol + 9; + } catch (Exception $e) { + throw new PropelException("Error populating Evento 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(EventoPeer::DATABASE_NAME); + } + + try { + $con->begin(); + EventoPeer::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(EventoPeer::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 = EventoPeer::doInsert($this, $con); + $affectedRows += 1; + $this->setId($pk); + $this->setNew(false); + } else { + $affectedRows += EventoPeer::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 = EventoPeer::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 = EventoPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM); + return $this->getByPosition($pos); + } + + + public function getByPosition($pos) + { + switch($pos) { + case 0: + return $this->getId(); + break; + case 1: + return $this->getFechaInicio(); + break; + case 2: + return $this->getFechaFin(); + break; + case 3: + return $this->getTipo(); + break; + case 4: + return $this->getFrecuencia(); + break; + case 5: + return $this->getFrecuenciaIntervalo(); + break; + case 6: + return $this->getRecurrenciaFin(); + break; + case 7: + return $this->getRecurrenciaDias(); + break; + case 8: + return $this->getEstado(); + break; + default: + return null; + break; + } } + + + public function toArray($keyType = BasePeer::TYPE_PHPNAME) + { + $keys = EventoPeer::getFieldNames($keyType); + $result = array( + $keys[0] => $this->getId(), + $keys[1] => $this->getFechaInicio(), + $keys[2] => $this->getFechaFin(), + $keys[3] => $this->getTipo(), + $keys[4] => $this->getFrecuencia(), + $keys[5] => $this->getFrecuenciaIntervalo(), + $keys[6] => $this->getRecurrenciaFin(), + $keys[7] => $this->getRecurrenciaDias(), + $keys[8] => $this->getEstado(), + ); + return $result; + } + + + public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME) + { + $pos = EventoPeer::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->setFechaInicio($value); + break; + case 2: + $this->setFechaFin($value); + break; + case 3: + $this->setTipo($value); + break; + case 4: + $this->setFrecuencia($value); + break; + case 5: + $this->setFrecuenciaIntervalo($value); + break; + case 6: + $this->setRecurrenciaFin($value); + break; + case 7: + $this->setRecurrenciaDias($value); + break; + case 8: + $this->setEstado($value); + break; + } } + + + public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) + { + $keys = EventoPeer::getFieldNames($keyType); + + if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); + if (array_key_exists($keys[1], $arr)) $this->setFechaInicio($arr[$keys[1]]); + if (array_key_exists($keys[2], $arr)) $this->setFechaFin($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setTipo($arr[$keys[3]]); + if (array_key_exists($keys[4], $arr)) $this->setFrecuencia($arr[$keys[4]]); + if (array_key_exists($keys[5], $arr)) $this->setFrecuenciaIntervalo($arr[$keys[5]]); + if (array_key_exists($keys[6], $arr)) $this->setRecurrenciaFin($arr[$keys[6]]); + if (array_key_exists($keys[7], $arr)) $this->setRecurrenciaDias($arr[$keys[7]]); + if (array_key_exists($keys[8], $arr)) $this->setEstado($arr[$keys[8]]); + } + + + public function buildCriteria() + { + $criteria = new Criteria(EventoPeer::DATABASE_NAME); + + if ($this->isColumnModified(EventoPeer::ID)) $criteria->add(EventoPeer::ID, $this->id); + if ($this->isColumnModified(EventoPeer::FECHA_INICIO)) $criteria->add(EventoPeer::FECHA_INICIO, $this->fecha_inicio); + if ($this->isColumnModified(EventoPeer::FECHA_FIN)) $criteria->add(EventoPeer::FECHA_FIN, $this->fecha_fin); + if ($this->isColumnModified(EventoPeer::TIPO)) $criteria->add(EventoPeer::TIPO, $this->tipo); + if ($this->isColumnModified(EventoPeer::FRECUENCIA)) $criteria->add(EventoPeer::FRECUENCIA, $this->frecuencia); + if ($this->isColumnModified(EventoPeer::FRECUENCIA_INTERVALO)) $criteria->add(EventoPeer::FRECUENCIA_INTERVALO, $this->frecuencia_intervalo); + if ($this->isColumnModified(EventoPeer::RECURRENCIA_FIN)) $criteria->add(EventoPeer::RECURRENCIA_FIN, $this->recurrencia_fin); + if ($this->isColumnModified(EventoPeer::RECURRENCIA_DIAS)) $criteria->add(EventoPeer::RECURRENCIA_DIAS, $this->recurrencia_dias); + if ($this->isColumnModified(EventoPeer::ESTADO)) $criteria->add(EventoPeer::ESTADO, $this->estado); + + return $criteria; + } + + + public function buildPkeyCriteria() + { + $criteria = new Criteria(EventoPeer::DATABASE_NAME); + + $criteria->add(EventoPeer::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->setFechaInicio($this->fecha_inicio); + + $copyObj->setFechaFin($this->fecha_fin); + + $copyObj->setTipo($this->tipo); + + $copyObj->setFrecuencia($this->frecuencia); + + $copyObj->setFrecuenciaIntervalo($this->frecuencia_intervalo); + + $copyObj->setRecurrenciaFin($this->recurrencia_fin); + + $copyObj->setRecurrenciaDias($this->recurrencia_dias); + + $copyObj->setEstado($this->estado); + + + $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 EventoPeer(); + } + return self::$peer; + } + +} \ No newline at end of file Property changes on: prosistem/alba/trunk/alba/lib/model/om/BaseEvento.php ___________________________________________________________________ Name: svn:keywords + "Id Author URL Date Rev" Added: prosistem/alba/trunk/alba/lib/model/om/BaseEventoPeer.php =================================================================== --- prosistem/alba/trunk/alba/lib/model/om/BaseEventoPeer.php 2007-04-25 13:33:48 UTC (rev 4565) +++ prosistem/alba/trunk/alba/lib/model/om/BaseEventoPeer.php 2007-04-25 15:07:43 UTC (rev 4566) @@ -0,0 +1,403 @@ +<?php + + +abstract class BaseEventoPeer { + + + const DATABASE_NAME = 'alba'; + + + const TABLE_NAME = 'evento'; + + + const CLASS_DEFAULT = 'lib.model.Evento'; + + + const NUM_COLUMNS = 9; + + + const NUM_LAZY_LOAD_COLUMNS = 0; + + + + const ID = 'evento.ID'; + + + const FECHA_INICIO = 'evento.FECHA_INICIO'; + + + const FECHA_FIN = 'evento.FECHA_FIN'; + + + const TIPO = 'evento.TIPO'; + + + const FRECUENCIA = 'evento.FRECUENCIA'; + + + const FRECUENCIA_INTERVALO = 'evento.FRECUENCIA_INTERVALO'; + + + const RECURRENCIA_FIN = 'evento.RECURRENCIA_FIN'; + + + const RECURRENCIA_DIAS = 'evento.RECURRENCIA_DIAS'; + + + const ESTADO = 'evento.ESTADO'; + + + private static $phpNameMap = null; + + + + private static $fieldNames = array ( + BasePeer::TYPE_PHPNAME => array ('Id', 'FechaInicio', 'FechaFin', 'Tipo', 'Frecuencia', 'FrecuenciaIntervalo', 'RecurrenciaFin', 'RecurrenciaDias', 'Estado', ), + BasePeer::TYPE_COLNAME => array (EventoPeer::ID, EventoPeer::FECHA_INICIO, EventoPeer::FECHA_FIN, EventoPeer::TIPO, EventoPeer::FRECUENCIA, EventoPeer::FRECUENCIA_INTERVALO, EventoPeer::RECURRENCIA_FIN, EventoPeer::RECURRENCIA_DIAS, EventoPeer::ESTADO, ), + BasePeer::TYPE_FIELDNAME => array ('id', 'fecha_inicio', 'fecha_fin', 'tipo', 'frecuencia', 'frecuencia_intervalo', 'recurrencia_fin', 'recurrencia_dias', 'estado', ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, ) + ); + + + private static $fieldKeys = array ( + BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'FechaInicio' => 1, 'FechaFin' => 2, 'Tipo' => 3, 'Frecuencia' => 4, 'FrecuenciaIntervalo' => 5, 'RecurrenciaFin' => 6, 'RecurrenciaDias' => 7, 'Estado' => 8, ), + BasePeer::TYPE_COLNAME => array (EventoPeer::ID => 0, EventoPeer::FECHA_INICIO => 1, EventoPeer::FECHA_FIN => 2, EventoPeer::TIPO => 3, EventoPeer::FRECUENCIA => 4, EventoPeer::FRECUENCIA_INTERVALO => 5, EventoPeer::RECURRENCIA_FIN => 6, EventoPeer::RECURRENCIA_DIAS => 7, EventoPeer::ESTADO => 8, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'fecha_inicio' => 1, 'fecha_fin' => 2, 'tipo' => 3, 'frecuencia' => 4, 'frecuencia_intervalo' => 5, 'recurrencia_fin' => 6, 'recurrencia_dias' => 7, 'estado' => 8, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, ) + ); + + + public static function getMapBuilder() + { + include_once 'lib/model/map/EventoMapBuilder.php'; + return BasePeer::getMapBuilder('lib.model.map.EventoMapBuilder'); + } + + public static function getPhpNameMap() + { + if (self::$phpNameMap === null) { + $map = EventoPeer::getTableMap(); + $columns = $map->getColumns(); + $nameMap = array(); + foreach ($columns as $column) { + $nameMap[$column->getPhpName()] = $column->getColumnName(); + } + self::$phpNameMap = $nameMap; + } + return self::$phpNameMap; + } + + 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 TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM. ' . $type . ' was given.'); + } + return self::$fieldNames[$type]; + } + + + public static function alias($alias, $column) + { + return str_replace(EventoPeer::TABLE_NAME.'.', $alias.'.', $column); + } + + + public static function addSelectColumns(Criteria $criteria) + { + + $criteria->addSelectColumn(EventoPeer::ID); + + $criteria->addSelectColumn(EventoPeer::FECHA_INICIO); + + $criteria->addSelectColumn(EventoPeer::FECHA_FIN); + + $criteria->addSelectColumn(EventoPeer::TIPO); + + $criteria->addSelectColumn(EventoPeer::FRECUENCIA); + + $criteria->addSelectColumn(EventoPeer::FRECUENCIA_INTERVALO); + + $criteria->addSelectColumn(EventoPeer::RECURRENCIA_FIN); + + $criteria->addSelectColumn(EventoPeer::RECURRENCIA_DIAS); + + $criteria->addSelectColumn(EventoPeer::ESTADO); + + } + + const COUNT = 'COUNT(evento.ID)'; + const COUNT_DISTINCT = 'COUNT(DISTINCT evento.ID)'; + + + public static function doCount(Criteria $criteria, $distinct = false, $con = null) + { + $criteria = clone $criteria; + + $criteria->clearSelectColumns()->clearOrderByColumns(); + if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) { + $criteria->addSelectColumn(EventoPeer::COUNT_DISTINCT); + } else { + $criteria->addSelectColumn(EventoPeer::COUNT); + } + + foreach($criteria->getGroupByColumns() as $column) + { + $criteria->addSelectColumn($column); + } + + $rs = EventoPeer::doSelectRS($criteria, $con); + if ($rs->next()) { + return $rs->getInt(1); + } else { + return 0; + } + } + + public static function doSelectOne(Criteria $criteria, $con = null) + { + $critcopy = clone $criteria; + $critcopy->setLimit(1); + $objects = EventoPeer::doSelect($critcopy, $con); + if ($objects) { + return $objects[0]; + } + return null; + } + + public static function doSelect(Criteria $criteria, $con = null) + { + return EventoPeer::populateObjects(EventoPeer::doSelectRS($criteria, $con)); + } + + public static function doSelectRS(Criteria $criteria, $con = null) + { + if ($con === null) { + $con = Propel::getConnection(self::DATABASE_NAME); + } + + if (!$criteria->getSelectColumns()) { + $criteria = clone $criteria; + EventoPeer::addSelectColumns($criteria); + } + + $criteria->setDbName(self::DATABASE_NAME); + + return BasePeer::doSelect($criteria, $con); + } + + public static function populateObjects(ResultSet $rs) + { + $results = array(); + + $cls = EventoPeer::getOMClass(); + $cls = Propel::import($cls); + while($rs->next()) { + + $obj = new $cls(); + $obj->hydrate($rs); + $results[] = $obj; + + } + return $results; + } + + public static function getTableMap() + { + return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME); + } + + + public static function getOMClass() + { + return EventoPeer::CLASS_DEFAULT; + } + + + public static function doInsert($values, $con = null) + { + if ($con === null) { + $con = Propel::getConnection(self::DATABASE_NAME); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; } else { + $criteria = $values->buildCriteria(); } + + $criteria->remove(EventoPeer::ID); + + $criteria->setDbName(self::DATABASE_NAME); + + try { + $con->begin(); + $pk = BasePeer::doInsert($criteria, $con); + $con->commit(); + } catch(PropelException $e) { + $con->rollback(); + throw $e; + } + + return $pk; + } + + + public static function doUpdate($values, $con = null) + { + if ($con === null) { + $con = Propel::getConnection(self::DATABASE_NAME); + } + + $selectCriteria = new Criteria(self::DATABASE_NAME); + + if ($values instanceof Criteria) { + $criteria = clone $values; + $comparison = $criteria->getComparison(EventoPeer::ID); + $selectCriteria->add(EventoPeer::ID, $criteria->remove(EventoPeer::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(self::DATABASE_NAME); + } + $affectedRows = 0; try { + $con->begin(); + $affectedRows += BasePeer::doDeleteAll(EventoPeer::TABLE_NAME, $con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollback(); + throw $e; + } + } + + + public static function doDelete($values, $con = null) + { + if ($con === null) { + $con = Propel::getConnection(EventoPeer::DATABASE_NAME); + } + + if ($values instanceof Criteria) { + $criteria = clone $values; } elseif ($values instanceof Evento) { + + $criteria = $values->buildPkeyCriteria(); + } else { + $criteria = new Criteria(self::DATABASE_NAME); + $criteria->add(EventoPeer::ID, (array) $values, Criteria::IN); + } + + $criteria->setDbName(self::DATABASE_NAME); + + $affectedRows = 0; + try { + $con->begin(); + + $affectedRows += BasePeer::doDelete($criteria, $con); + $con->commit(); + return $affectedRows; + } catch (PropelException $e) { + $con->rollback(); + throw $e; + } + } + + + public static function doValidate(Evento $obj, $cols = null) + { + $columns = array(); + + if ($cols) { + $dbMap = Propel::getDatabaseMap(EventoPeer::DATABASE_NAME); + $tableMap = $dbMap->getTable(EventoPeer::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(EventoPeer::DATABASE_NAME, EventoPeer::TABLE_NAME, $columns); + if ($res !== true) { + $request = sfContext::getInstance()->getRequest(); + foreach ($res as $failed) { + $col = EventoPeer::translateFieldname($failed->getColumn(), BasePeer::TYPE_COLNAME, BasePeer::TYPE_PHPNAME); + $request->setError($col, $failed->getMessage()); + } + } + + return $res; + } + + + public static function retrieveByPK($pk, $con = null) + { + if ($con === null) { + $con = Propel::getConnection(self::DATABASE_NAME); + } + + $criteria = new Criteria(EventoPeer::DATABASE_NAME); + + $criteria->add(EventoPeer::ID, $pk); + + + $v = EventoPeer::doSelect($criteria, $con); + + return !empty($v) > 0 ? $v[0] : null; + } + + + public static function retrieveByPKs($pks, $con = null) + { + if ($con === null) { + $con = Propel::getConnection(self::DATABASE_NAME); + } + + $objs = null; + if (empty($pks)) { + $objs = array(); + } else { + $criteria = new Criteria(); + $criteria->add(EventoPeer::ID, $pks, Criteria::IN); + $objs = EventoPeer::doSelect($criteria, $con); + } + return $objs; + } + +} +if (Propel::isInit()) { + try { + BaseEventoPeer::getMapBuilder(); + } catch (Exception $e) { + Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR); + } +} else { + require_once 'lib/model/map/EventoMapBuilder.php'; + Propel::registerMapBuilder('lib.model.map.EventoMapBuilder'); +} Property changes on: prosistem/alba/trunk/alba/lib/model/om/BaseEventoPeer.php ___________________________________________________________________ Name: svn:keywords + "Id Author URL Date Rev"
participants (1)
-
commits@pressenter.com.ar