/lib/model/om/BaseAlbaConfig.php
https://github.com/proyectoalba/alba · PHP · 420 lines · 301 code · 119 blank · 0 comment · 34 complexity · ed7ecc78d404117a4b2173844f5f4988 MD5 · raw file
- <?php
- abstract class BaseAlbaConfig extends BaseObject implements Persistent {
- const PEER = 'AlbaConfigPeer';
-
- protected static $peer;
-
- protected $id;
-
- protected $nombre;
-
- protected $valor;
-
- 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 getValor()
- {
- return $this->valor;
- }
-
- public function setId($v)
- {
- if ($v !== null) {
- $v = (int) $v;
- }
- if ($this->id !== $v) {
- $this->id = $v;
- $this->modifiedColumns[] = AlbaConfigPeer::ID;
- }
- return $this;
- }
-
- public function setNombre($v)
- {
- if ($v !== null) {
- $v = (string) $v;
- }
- if ($this->nombre !== $v) {
- $this->nombre = $v;
- $this->modifiedColumns[] = AlbaConfigPeer::NOMBRE;
- }
- return $this;
- }
-
- public function setValor($v)
- {
- if ($v !== null) {
- $v = (string) $v;
- }
- if ($this->valor !== $v) {
- $this->valor = $v;
- $this->modifiedColumns[] = AlbaConfigPeer::VALOR;
- }
- 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->valor = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
- $this->resetModified();
- $this->setNew(false);
- if ($rehydrate) {
- $this->ensureConsistency();
- }
- return $startcol + 3;
- } catch (Exception $e) {
- throw new PropelException("Error populating AlbaConfig 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(AlbaConfigPeer::DATABASE_NAME, Propel::CONNECTION_READ);
- }
-
- $stmt = AlbaConfigPeer::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(AlbaConfigPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
- }
-
- $con->beginTransaction();
- try {
- AlbaConfigPeer::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(AlbaConfigPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
- }
-
- $con->beginTransaction();
- try {
- $affectedRows = $this->doSave($con);
- $con->commit();
- AlbaConfigPeer::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[] = AlbaConfigPeer::ID;
- }
- if ($this->isModified()) {
- if ($this->isNew()) {
- $pk = AlbaConfigPeer::doInsert($this, $con);
- $affectedRows += 1;
- $this->setId($pk);
- $this->setNew(false);
- } else {
- $affectedRows += AlbaConfigPeer::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 = AlbaConfigPeer::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 = AlbaConfigPeer::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;
- case 2:
- return $this->getValor();
- break;
- default:
- return null;
- break;
- } }
-
- public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true)
- {
- $keys = AlbaConfigPeer::getFieldNames($keyType);
- $result = array(
- $keys[0] => $this->getId(),
- $keys[1] => $this->getNombre(),
- $keys[2] => $this->getValor(),
- );
- return $result;
- }
-
- public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
- {
- $pos = AlbaConfigPeer::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;
- case 2:
- $this->setValor($value);
- break;
- } }
-
- public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
- {
- $keys = AlbaConfigPeer::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]]);
- if (array_key_exists($keys[2], $arr)) $this->setValor($arr[$keys[2]]);
- }
-
- public function buildCriteria()
- {
- $criteria = new Criteria(AlbaConfigPeer::DATABASE_NAME);
- if ($this->isColumnModified(AlbaConfigPeer::ID)) $criteria->add(AlbaConfigPeer::ID, $this->id);
- if ($this->isColumnModified(AlbaConfigPeer::NOMBRE)) $criteria->add(AlbaConfigPeer::NOMBRE, $this->nombre);
- if ($this->isColumnModified(AlbaConfigPeer::VALOR)) $criteria->add(AlbaConfigPeer::VALOR, $this->valor);
- return $criteria;
- }
-
- public function buildPkeyCriteria()
- {
- $criteria = new Criteria(AlbaConfigPeer::DATABASE_NAME);
- $criteria->add(AlbaConfigPeer::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->setValor($this->valor);
- $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 AlbaConfigPeer();
- }
- return self::$peer;
- }
-
- public function clearAllReferences($deep = false)
- {
- if ($deep) {
- }
- }
- }