Commit e3b72a8e authored by Ana's avatar Ana

agregar modelo

parent b21e2c82
......@@ -10,4 +10,13 @@
<parameter name="Engine" value="MyISAM"/>
</vendor>
</table>
<table name="parametro_configuracion" phpName="ParametroConfiguracion" idMethod="native">
<column name="pco_id" phpName="PcoId" type="INTEGER" primaryKey="true" autoIncrement="true" required="true"/>
<column name="pco_nombre" phpName="PcoNombre" type="VARCHAR" size="100" required="false"/>
<column name="pco_valor" phpName="PcoValor" type="VARCHAR" size="1000" required="false"/>
<column name="pco_descripcion" phpName="PcoDescripcion" type="VARCHAR" size="1000" required="false"/>
<vendor type="mysql">
<parameter name="Engine" value="InnoDB"/>
</vendor>
</table>
</database>
<?php
namespace AppBundle\Model;
use AppBundle\Model\om\BaseParametroConfiguracion;
class ParametroConfiguracion extends BaseParametroConfiguracion
{
}
<?php
namespace AppBundle\Model;
use AppBundle\Model\om\BaseParametroConfiguracionPeer;
class ParametroConfiguracionPeer extends BaseParametroConfiguracionPeer
{
}
<?php
namespace AppBundle\Model;
use AppBundle\Model\om\BaseParametroConfiguracionQuery;
class ParametroConfiguracionQuery extends BaseParametroConfiguracionQuery
{
}
<?php
namespace AppBundle\Model\map;
use \RelationMap;
use \TableMap;
/**
* This class defines the structure of the 'parametro_configuracion' table.
*
*
*
* This map class is used by Propel to do runtime db structure discovery.
* For example, the createSelectSql() method checks the type of a given column used in an
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
* (i.e. if it's a text column type).
*
* @package propel.generator.src.AppBundle.Model.map
*/
class ParametroConfiguracionTableMap extends TableMap
{
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'src.AppBundle.Model.map.ParametroConfiguracionTableMap';
/**
* Initialize the table attributes, columns and validators
* Relations are not initialized by this method since they are lazy loaded
*
* @return void
* @throws PropelException
*/
public function initialize()
{
// attributes
$this->setName('parametro_configuracion');
$this->setPhpName('ParametroConfiguracion');
$this->setClassname('AppBundle\\Model\\ParametroConfiguracion');
$this->setPackage('src.AppBundle.Model');
$this->setUseIdGenerator(true);
// columns
$this->addPrimaryKey('pco_id', 'PcoId', 'INTEGER', true, null, null);
$this->addColumn('pco_nombre', 'PcoNombre', 'VARCHAR', false, 100, null);
$this->addColumn('pco_valor', 'PcoValor', 'VARCHAR', false, 1000, null);
$this->addColumn('pco_descripcion', 'PcoDescripcion', 'VARCHAR', false, 1000, null);
// validators
} // initialize()
/**
* Build the RelationMap objects for this table relationships
*/
public function buildRelations()
{
} // buildRelations()
} // ParametroConfiguracionTableMap
<?php
namespace AppBundle\Model\om;
use \BaseObject;
use \BasePeer;
use \Criteria;
use \Exception;
use \PDO;
use \Persistent;
use \Propel;
use \PropelException;
use \PropelPDO;
use AppBundle\Model\ParametroConfiguracion;
use AppBundle\Model\ParametroConfiguracionPeer;
use AppBundle\Model\ParametroConfiguracionQuery;
abstract class BaseParametroConfiguracion extends BaseObject implements Persistent
{
/**
* Peer class name
*/
const PEER = 'AppBundle\\Model\\ParametroConfiguracionPeer';
/**
* The Peer class.
* Instance provides a convenient way of calling static methods on a class
* that calling code may not be able to identify.
* @var ParametroConfiguracionPeer
*/
protected static $peer;
/**
* The flag var to prevent infinite loop in deep copy
* @var boolean
*/
protected $startCopy = false;
/**
* The value for the pco_id field.
* @var int
*/
protected $pco_id;
/**
* The value for the pco_nombre field.
* @var string
*/
protected $pco_nombre;
/**
* The value for the pco_valor field.
* @var string
*/
protected $pco_valor;
/**
* The value for the pco_descripcion field.
* @var string
*/
protected $pco_descripcion;
/**
* Flag to prevent endless save loop, if this object is referenced
* by another object which falls in this transaction.
* @var boolean
*/
protected $alreadyInSave = false;
/**
* Flag to prevent endless validation loop, if this object is referenced
* by another object which falls in this transaction.
* @var boolean
*/
protected $alreadyInValidation = false;
/**
* Flag to prevent endless clearAllReferences($deep=true) loop, if this object is referenced
* @var boolean
*/
protected $alreadyInClearAllReferencesDeep = false;
/**
* Get the [pco_id] column value.
*
* @return int
*/
public function getPcoId()
{
return $this->pco_id;
}
/**
* Get the [pco_nombre] column value.
*
* @return string
*/
public function getPcoNombre()
{
return $this->pco_nombre;
}
/**
* Get the [pco_valor] column value.
*
* @return string
*/
public function getPcoValor()
{
return $this->pco_valor;
}
/**
* Get the [pco_descripcion] column value.
*
* @return string
*/
public function getPcoDescripcion()
{
return $this->pco_descripcion;
}
/**
* Set the value of [pco_id] column.
*
* @param int $v new value
* @return ParametroConfiguracion The current object (for fluent API support)
*/
public function setPcoId($v)
{
if ($v !== null && is_numeric($v)) {
$v = (int) $v;
}
if ($this->pco_id !== $v) {
$this->pco_id = $v;
$this->modifiedColumns[] = ParametroConfiguracionPeer::PCO_ID;
}
return $this;
} // setPcoId()
/**
* Set the value of [pco_nombre] column.
*
* @param string $v new value
* @return ParametroConfiguracion The current object (for fluent API support)
*/
public function setPcoNombre($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->pco_nombre !== $v) {
$this->pco_nombre = $v;
$this->modifiedColumns[] = ParametroConfiguracionPeer::PCO_NOMBRE;
}
return $this;
} // setPcoNombre()
/**
* Set the value of [pco_valor] column.
*
* @param string $v new value
* @return ParametroConfiguracion The current object (for fluent API support)
*/
public function setPcoValor($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->pco_valor !== $v) {
$this->pco_valor = $v;
$this->modifiedColumns[] = ParametroConfiguracionPeer::PCO_VALOR;
}
return $this;
} // setPcoValor()
/**
* Set the value of [pco_descripcion] column.
*
* @param string $v new value
* @return ParametroConfiguracion The current object (for fluent API support)
*/
public function setPcoDescripcion($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->pco_descripcion !== $v) {
$this->pco_descripcion = $v;
$this->modifiedColumns[] = ParametroConfiguracionPeer::PCO_DESCRIPCION;
}
return $this;
} // setPcoDescripcion()
/**
* Indicates whether the columns in this object are only set to default values.
*
* This method can be used in conjunction with isModified() to indicate whether an object is both
* modified _and_ has some values set which are non-default.
*
* @return boolean Whether the columns in this object are only been set with default values.
*/
public function hasOnlyDefaultValues()
{
// otherwise, everything was equal, so return true
return true;
} // hasOnlyDefaultValues()
/**
* Hydrates (populates) the object variables with values from the database resultset.
*
* An offset (0-based "start column") is specified so that objects can be hydrated
* with a subset of the columns in the resultset rows. This is needed, for example,
* for results of JOIN queries where the resultset row includes columns from two or
* more tables.
*
* @param array $row The row returned by PDOStatement->fetch(PDO::FETCH_NUM)
* @param int $startcol 0-based offset column which indicates which resultset column to start with.
* @param boolean $rehydrate Whether this object is being re-hydrated from the database.
* @return int next starting column
* @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
*/
public function hydrate($row, $startcol = 0, $rehydrate = false)
{
try {
$this->pco_id = ($row[$startcol + 0] !== null) ? (int) $row[$startcol + 0] : null;
$this->pco_nombre = ($row[$startcol + 1] !== null) ? (string) $row[$startcol + 1] : null;
$this->pco_valor = ($row[$startcol + 2] !== null) ? (string) $row[$startcol + 2] : null;
$this->pco_descripcion = ($row[$startcol + 3] !== null) ? (string) $row[$startcol + 3] : null;
$this->resetModified();
$this->setNew(false);
if ($rehydrate) {
$this->ensureConsistency();
}
$this->postHydrate($row, $startcol, $rehydrate);
return $startcol + 4; // 4 = ParametroConfiguracionPeer::NUM_HYDRATE_COLUMNS.
} catch (Exception $e) {
throw new PropelException("Error populating ParametroConfiguracion object", $e);
}
}
/**
* Checks and repairs the internal consistency of the object.
*
* This method is executed after an already-instantiated object is re-hydrated
* from the database. It exists to check any foreign keys to make sure that
* the objects related to the current object are correct based on foreign key.
*
* You can override this method in the stub class, but you should always invoke
* the base method from the overridden method (i.e. parent::ensureConsistency()),
* in case your model changes.
*
* @throws PropelException
*/
public function ensureConsistency()
{
} // ensureConsistency
/**
* Reloads this object from datastore based on primary key and (optionally) resets all associated objects.
*
* This will only work if the object has been saved and has a valid primary key set.
*
* @param boolean $deep (optional) Whether to also de-associated any related objects.
* @param PropelPDO $con (optional) The PropelPDO connection to use.
* @return void
* @throws PropelException - if this object is deleted, unsaved or doesn't have pk match in db
*/
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(ParametroConfiguracionPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
// We don't need to alter the object instance pool; we're just modifying this instance
// already in the pool.
$stmt = ParametroConfiguracionPeer::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); // rehydrate
if ($deep) { // also de-associate any related objects?
} // if (deep)
}
/**
* Removes this object from datastore and sets delete attribute.
*
* @param PropelPDO $con
* @return void
* @throws PropelException
* @throws Exception
* @see BaseObject::setDeleted()
* @see BaseObject::isDeleted()
*/
public function delete(PropelPDO $con = null)
{
if ($this->isDeleted()) {
throw new PropelException("This object has already been deleted.");
}
if ($con === null) {
$con = Propel::getConnection(ParametroConfiguracionPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
$con->beginTransaction();
try {
$deleteQuery = ParametroConfiguracionQuery::create()
->filterByPrimaryKey($this->getPrimaryKey());
$ret = $this->preDelete($con);
if ($ret) {
$deleteQuery->delete($con);
$this->postDelete($con);
$con->commit();
$this->setDeleted(true);
} else {
$con->commit();
}
} catch (Exception $e) {
$con->rollBack();
throw $e;
}
}
/**
* Persists this object to the database.
*
* If the object is new, it inserts it; otherwise an update is performed.
* All modified related objects will also be persisted in the doSave()
* method. This method wraps all precipitate database operations in a
* single transaction.
*
* @param PropelPDO $con
* @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
* @throws PropelException
* @throws Exception
* @see doSave()
*/
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(ParametroConfiguracionPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
$con->beginTransaction();
$isInsert = $this->isNew();
try {
$ret = $this->preSave($con);
if ($isInsert) {
$ret = $ret && $this->preInsert($con);
} else {
$ret = $ret && $this->preUpdate($con);
}
if ($ret) {
$affectedRows = $this->doSave($con);
if ($isInsert) {
$this->postInsert($con);
} else {
$this->postUpdate($con);
}
$this->postSave($con);
ParametroConfiguracionPeer::addInstanceToPool($this);
} else {
$affectedRows = 0;
}
$con->commit();
return $affectedRows;
} catch (Exception $e) {
$con->rollBack();
throw $e;
}
}
/**
* Performs the work of inserting or updating the row in the database.
*
* If the object is new, it inserts it; otherwise an update is performed.
* All related objects are also updated in this method.
*
* @param PropelPDO $con
* @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
* @throws PropelException
* @see save()
*/
protected function doSave(PropelPDO $con)
{
$affectedRows = 0; // initialize var to track total num of affected rows
if (!$this->alreadyInSave) {
$this->alreadyInSave = true;
if ($this->isNew() || $this->isModified()) {
// persist changes
if ($this->isNew()) {
$this->doInsert($con);
} else {
$this->doUpdate($con);
}
$affectedRows += 1;
$this->resetModified();
}
$this->alreadyInSave = false;
}
return $affectedRows;
} // doSave()
/**
* Insert the row in the database.
*
* @param PropelPDO $con
*
* @throws PropelException
* @see doSave()
*/
protected function doInsert(PropelPDO $con)
{
$modifiedColumns = array();
$index = 0;
$this->modifiedColumns[] = ParametroConfiguracionPeer::PCO_ID;
if (null !== $this->pco_id) {
throw new PropelException('Cannot insert a value for auto-increment primary key (' . ParametroConfiguracionPeer::PCO_ID . ')');
}
// check the columns in natural order for more readable SQL queries
if ($this->isColumnModified(ParametroConfiguracionPeer::PCO_ID)) {
$modifiedColumns[':p' . $index++] = '`pco_id`';
}
if ($this->isColumnModified(ParametroConfiguracionPeer::PCO_NOMBRE)) {
$modifiedColumns[':p' . $index++] = '`pco_nombre`';
}
if ($this->isColumnModified(ParametroConfiguracionPeer::PCO_VALOR)) {
$modifiedColumns[':p' . $index++] = '`pco_valor`';
}
if ($this->isColumnModified(ParametroConfiguracionPeer::PCO_DESCRIPCION)) {
$modifiedColumns[':p' . $index++] = '`pco_descripcion`';
}
$sql = sprintf(
'INSERT INTO `parametro_configuracion` (%s) VALUES (%s)',
implode(', ', $modifiedColumns),
implode(', ', array_keys($modifiedColumns))
);
try {
$stmt = $con->prepare($sql);
foreach ($modifiedColumns as $identifier => $columnName) {
switch ($columnName) {
case '`pco_id`':
$stmt->bindValue($identifier, $this->pco_id, PDO::PARAM_INT);
break;
case '`pco_nombre`':
$stmt->bindValue($identifier, $this->pco_nombre, PDO::PARAM_STR);
break;
case '`pco_valor`':
$stmt->bindValue($identifier, $this->pco_valor, PDO::PARAM_STR);
break;
case '`pco_descripcion`':
$stmt->bindValue($identifier, $this->pco_descripcion, PDO::PARAM_STR);
break;
}
}
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute INSERT statement [%s]', $sql), $e);
}
try {
$pk = $con->lastInsertId();
} catch (Exception $e) {
throw new PropelException('Unable to get autoincrement id.', $e);
}
$this->setPcoId($pk);
$this->setNew(false);
}
/**
* Update the row in the database.
*
* @param PropelPDO $con
*
* @see doSave()
*/
protected function doUpdate(PropelPDO $con)
{
$selectCriteria = $this->buildPkeyCriteria();
$valuesCriteria = $this->buildCriteria();
BasePeer::doUpdate($selectCriteria, $valuesCriteria, $con);
}
/**
* Array of ValidationFailed objects.
* @var array ValidationFailed[]
*/
protected $validationFailures = array();
/**
* Gets any ValidationFailed objects that resulted from last call to validate().
*
*
* @return array ValidationFailed[]
* @see validate()
*/
public function getValidationFailures()
{
return $this->validationFailures;
}
/**
* Validates the objects modified field values and all objects related to this table.
*
* If $columns is either a column name or an array of column names
* only those columns are validated.
*
* @param mixed $columns Column name or an array of column names.
* @return boolean Whether all columns pass validation.
* @see doValidate()
* @see getValidationFailures()
*/
public function validate($columns = null)
{
$res = $this->doValidate($columns);
if ($res === true) {
$this->validationFailures = array();
return true;
}
$this->validationFailures = $res;
return false;
}
/**
* This function performs the validation work for complex object models.
*
* In addition to checking the current object, all related objects will
* also be validated. If all pass then <code>true</code> is returned; otherwise
* an aggregated array of ValidationFailed objects will be returned.
*
* @param array $columns Array of column names to validate.
* @return mixed <code>true</code> if all validations pass; array of <code>ValidationFailed</code> objects otherwise.
*/
protected function doValidate($columns = null)
{
if (!$this->alreadyInValidation) {
$this->alreadyInValidation = true;
$retval = null;
$failureMap = array();
if (($retval = ParametroConfiguracionPeer::doValidate($this, $columns)) !== true) {
$failureMap = array_merge($failureMap, $retval);
}
$this->alreadyInValidation = false;
}
return (!empty($failureMap) ? $failureMap : true);
}
/**
* Retrieves a field from the object by name passed in as a string.
*
* @param string $name name
* @param string $type The type of fieldname the $name is of:
* one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
* BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
* Defaults to BasePeer::TYPE_PHPNAME
* @return mixed Value of field.
*/
public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
{
$pos = ParametroConfiguracionPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
$field = $this->getByPosition($pos);
return $field;
}
/**
* Retrieves a field from the object by Position as specified in the xml schema.
* Zero-based.
*
* @param int $pos position in xml schema
* @return mixed Value of field at $pos
*/
public function getByPosition($pos)
{
switch ($pos) {
case 0:
return $this->getPcoId();
break;
case 1:
return $this->getPcoNombre();
break;
case 2:
return $this->getPcoValor();
break;
case 3:
return $this->getPcoDescripcion();
break;
default:
return null;
break;
} // switch()
}
/**
* Exports the object as an array.
*
* You can specify the key type of the array by passing one of the class
* type constants.
*
* @param string $keyType (optional) One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
* BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
* Defaults to BasePeer::TYPE_PHPNAME.
* @param boolean $includeLazyLoadColumns (optional) Whether to include lazy loaded columns. Defaults to true.
* @param array $alreadyDumpedObjects List of objects to skip to avoid recursion
*
* @return array an associative array containing the field names (as keys) and field values
*/
public function toArray($keyType = BasePeer::TYPE_PHPNAME, $includeLazyLoadColumns = true, $alreadyDumpedObjects = array())
{
if (isset($alreadyDumpedObjects['ParametroConfiguracion'][$this->getPrimaryKey()])) {
return '*RECURSION*';
}
$alreadyDumpedObjects['ParametroConfiguracion'][$this->getPrimaryKey()] = true;
$keys = ParametroConfiguracionPeer::getFieldNames($keyType);
$result = array(
$keys[0] => $this->getPcoId(),
$keys[1] => $this->getPcoNombre(),
$keys[2] => $this->getPcoValor(),
$keys[3] => $this->getPcoDescripcion(),
);
$virtualColumns = $this->virtualColumns;
foreach ($virtualColumns as $key => $virtualColumn) {
$result[$key] = $virtualColumn;
}
return $result;
}
/**
* Sets a field from the object by name passed in as a string.
*
* @param string $name peer name
* @param mixed $value field value
* @param string $type The type of fieldname the $name is of:
* one of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
* BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
* Defaults to BasePeer::TYPE_PHPNAME
* @return void
*/
public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
{
$pos = ParametroConfiguracionPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
$this->setByPosition($pos, $value);
}
/**
* Sets a field from the object by Position as specified in the xml schema.
* Zero-based.
*
* @param int $pos position in xml schema
* @param mixed $value field value
* @return void
*/
public function setByPosition($pos, $value)
{
switch ($pos) {
case 0:
$this->setPcoId($value);
break;
case 1:
$this->setPcoNombre($value);
break;
case 2:
$this->setPcoValor($value);
break;
case 3:
$this->setPcoDescripcion($value);
break;
} // switch()
}
/**
* Populates the object using an array.
*
* This is particularly useful when populating an object from one of the
* request arrays (e.g. $_POST). This method goes through the column
* names, checking to see whether a matching key exists in populated
* array. If so the setByName() method is called for that column.
*
* You can specify the key type of the array by additionally passing one
* of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
* BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
* The default key type is the column's BasePeer::TYPE_PHPNAME
*
* @param array $arr An array to populate the object from.
* @param string $keyType The type of keys the array uses.
* @return void
*/
public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
{
$keys = ParametroConfiguracionPeer::getFieldNames($keyType);
if (array_key_exists($keys[0], $arr)) $this->setPcoId($arr[$keys[0]]);
if (array_key_exists($keys[1], $arr)) $this->setPcoNombre($arr[$keys[1]]);
if (array_key_exists($keys[2], $arr)) $this->setPcoValor($arr[$keys[2]]);
if (array_key_exists($keys[3], $arr)) $this->setPcoDescripcion($arr[$keys[3]]);
}
/**
* Build a Criteria object containing the values of all modified columns in this object.
*
* @return Criteria The Criteria object containing all modified values.
*/
public function buildCriteria()
{
$criteria = new Criteria(ParametroConfiguracionPeer::DATABASE_NAME);
if ($this->isColumnModified(ParametroConfiguracionPeer::PCO_ID)) $criteria->add(ParametroConfiguracionPeer::PCO_ID, $this->pco_id);
if ($this->isColumnModified(ParametroConfiguracionPeer::PCO_NOMBRE)) $criteria->add(ParametroConfiguracionPeer::PCO_NOMBRE, $this->pco_nombre);
if ($this->isColumnModified(ParametroConfiguracionPeer::PCO_VALOR)) $criteria->add(ParametroConfiguracionPeer::PCO_VALOR, $this->pco_valor);
if ($this->isColumnModified(ParametroConfiguracionPeer::PCO_DESCRIPCION)) $criteria->add(ParametroConfiguracionPeer::PCO_DESCRIPCION, $this->pco_descripcion);
return $criteria;
}
/**
* Builds a Criteria object containing the primary key for this object.
*
* Unlike buildCriteria() this method includes the primary key values regardless
* of whether or not they have been modified.
*
* @return Criteria The Criteria object containing value(s) for primary key(s).
*/
public function buildPkeyCriteria()
{
$criteria = new Criteria(ParametroConfiguracionPeer::DATABASE_NAME);
$criteria->add(ParametroConfiguracionPeer::PCO_ID, $this->pco_id);
return $criteria;
}
/**
* Returns the primary key for this object (row).
* @return int
*/
public function getPrimaryKey()
{
return $this->getPcoId();
}
/**
* Generic method to set the primary key (pco_id column).
*
* @param int $key Primary key.
* @return void
*/
public function setPrimaryKey($key)
{
$this->setPcoId($key);
}
/**
* Returns true if the primary key for this object is null.
* @return boolean
*/
public function isPrimaryKeyNull()
{
return null === $this->getPcoId();
}
/**
* Sets contents of passed object to values from current object.
*
* If desired, this method can also make copies of all associated (fkey referrers)
* objects.
*
* @param object $copyObj An object of ParametroConfiguracion (or compatible) type.
* @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
* @param boolean $makeNew Whether to reset autoincrement PKs and make the object new.
* @throws PropelException
*/
public function copyInto($copyObj, $deepCopy = false, $makeNew = true)
{
$copyObj->setPcoNombre($this->getPcoNombre());
$copyObj->setPcoValor($this->getPcoValor());
$copyObj->setPcoDescripcion($this->getPcoDescripcion());
if ($makeNew) {
$copyObj->setNew(true);
$copyObj->setPcoId(NULL); // this is a auto-increment column, so set to default value
}
}
/**
* Makes a copy of this object that will be inserted as a new row in table when saved.
* It creates a new object filling in the simple attributes, but skipping any primary
* keys that are defined for the table.
*
* If desired, this method can also make copies of all associated (fkey referrers)
* objects.
*
* @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
* @return ParametroConfiguracion Clone of current object.
* @throws PropelException
*/
public function copy($deepCopy = false)
{
// we use get_class(), because this might be a subclass
$clazz = get_class($this);
$copyObj = new $clazz();
$this->copyInto($copyObj, $deepCopy);
return $copyObj;
}
/**
* Returns a peer instance associated with this om.
*
* Since Peer classes are not to have any instance attributes, this method returns the
* same instance for all member of this class. The method could therefore
* be static, but this would prevent one from overriding the behavior.
*
* @return ParametroConfiguracionPeer
*/
public function getPeer()
{
if (self::$peer === null) {
self::$peer = new ParametroConfiguracionPeer();
}
return self::$peer;
}
/**
* Clears the current object and sets all attributes to their default values
*/
public function clear()
{
$this->pco_id = null;
$this->pco_nombre = null;
$this->pco_valor = null;
$this->pco_descripcion = null;
$this->alreadyInSave = false;
$this->alreadyInValidation = false;
$this->alreadyInClearAllReferencesDeep = false;
$this->clearAllReferences();
$this->resetModified();
$this->setNew(true);
$this->setDeleted(false);
}
/**
* Resets all references to other model objects or collections of model objects.
*
* This method is a user-space workaround for PHP's inability to garbage collect
* objects with circular references (even in PHP 5.3). This is currently necessary
* when using Propel in certain daemon or large-volume/high-memory operations.
*
* @param boolean $deep Whether to also clear the references on all referrer objects.
*/
public function clearAllReferences($deep = false)
{
if ($deep && !$this->alreadyInClearAllReferencesDeep) {
$this->alreadyInClearAllReferencesDeep = true;
$this->alreadyInClearAllReferencesDeep = false;
} // if ($deep)
}
/**
* return the string representation of this object
*
* @return string
*/
public function __toString()
{
return (string) $this->exportTo(ParametroConfiguracionPeer::DEFAULT_STRING_FORMAT);
}
/**
* return true is the object is in saving state
*
* @return boolean
*/
public function isAlreadyInSave()
{
return $this->alreadyInSave;
}
}
<?php
namespace AppBundle\Model\om;
use \BasePeer;
use \Criteria;
use \PDO;
use \PDOStatement;
use \Propel;
use \PropelException;
use \PropelPDO;
use AppBundle\Model\ParametroConfiguracion;
use AppBundle\Model\ParametroConfiguracionPeer;
use AppBundle\Model\map\ParametroConfiguracionTableMap;
abstract class BaseParametroConfiguracionPeer
{
/** the default database name for this class */
const DATABASE_NAME = 'default';
/** the table name for this class */
const TABLE_NAME = 'parametro_configuracion';
/** the related Propel class for this table */
const OM_CLASS = 'AppBundle\\Model\\ParametroConfiguracion';
/** the related TableMap class for this table */
const TM_CLASS = 'AppBundle\\Model\\map\\ParametroConfiguracionTableMap';
/** The total number of columns. */
const NUM_COLUMNS = 4;
/** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0;
/** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
const NUM_HYDRATE_COLUMNS = 4;
/** the column name for the pco_id field */
const PCO_ID = 'parametro_configuracion.pco_id';
/** the column name for the pco_nombre field */
const PCO_NOMBRE = 'parametro_configuracion.pco_nombre';
/** the column name for the pco_valor field */
const PCO_VALOR = 'parametro_configuracion.pco_valor';
/** the column name for the pco_descripcion field */
const PCO_DESCRIPCION = 'parametro_configuracion.pco_descripcion';
/** The default string format for model objects of the related table **/
const DEFAULT_STRING_FORMAT = 'YAML';
/**
* An identity map to hold any loaded instances of ParametroConfiguracion objects.
* This must be public so that other peer classes can access this when hydrating from JOIN
* queries.
* @var array ParametroConfiguracion[]
*/
public static $instances = array();
/**
* holds an array of fieldnames
*
* first dimension keys are the type constants
* e.g. ParametroConfiguracionPeer::$fieldNames[ParametroConfiguracionPeer::TYPE_PHPNAME][0] = 'Id'
*/
protected static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('PcoId', 'PcoNombre', 'PcoValor', 'PcoDescripcion', ),
BasePeer::TYPE_STUDLYPHPNAME => array ('pcoId', 'pcoNombre', 'pcoValor', 'pcoDescripcion', ),
BasePeer::TYPE_COLNAME => array (ParametroConfiguracionPeer::PCO_ID, ParametroConfiguracionPeer::PCO_NOMBRE, ParametroConfiguracionPeer::PCO_VALOR, ParametroConfiguracionPeer::PCO_DESCRIPCION, ),
BasePeer::TYPE_RAW_COLNAME => array ('PCO_ID', 'PCO_NOMBRE', 'PCO_VALOR', 'PCO_DESCRIPCION', ),
BasePeer::TYPE_FIELDNAME => array ('pco_id', 'pco_nombre', 'pco_valor', 'pco_descripcion', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, )
);
/**
* holds an array of keys for quick access to the fieldnames array
*
* first dimension keys are the type constants
* e.g. ParametroConfiguracionPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
BasePeer::TYPE_PHPNAME => array ('PcoId' => 0, 'PcoNombre' => 1, 'PcoValor' => 2, 'PcoDescripcion' => 3, ),
BasePeer::TYPE_STUDLYPHPNAME => array ('pcoId' => 0, 'pcoNombre' => 1, 'pcoValor' => 2, 'pcoDescripcion' => 3, ),
BasePeer::TYPE_COLNAME => array (ParametroConfiguracionPeer::PCO_ID => 0, ParametroConfiguracionPeer::PCO_NOMBRE => 1, ParametroConfiguracionPeer::PCO_VALOR => 2, ParametroConfiguracionPeer::PCO_DESCRIPCION => 3, ),
BasePeer::TYPE_RAW_COLNAME => array ('PCO_ID' => 0, 'PCO_NOMBRE' => 1, 'PCO_VALOR' => 2, 'PCO_DESCRIPCION' => 3, ),
BasePeer::TYPE_FIELDNAME => array ('pco_id' => 0, 'pco_nombre' => 1, 'pco_valor' => 2, 'pco_descripcion' => 3, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, )
);
/**
* Translates a fieldname to another type
*
* @param string $name field name
* @param string $fromType One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
* BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
* @param string $toType One of the class type constants
* @return string translated name of the field.
* @throws PropelException - if the specified name could not be found in the fieldname mappings.
*/
public static function translateFieldName($name, $fromType, $toType)
{
$toNames = ParametroConfiguracionPeer::getFieldNames($toType);
$key = isset(ParametroConfiguracionPeer::$fieldKeys[$fromType][$name]) ? ParametroConfiguracionPeer::$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(ParametroConfiguracionPeer::$fieldKeys[$fromType], true));
}
return $toNames[$key];
}
/**
* Returns an array of field names.
*
* @param string $type The type of fieldnames to return:
* One of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME
* BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM
* @return array A list of field names
* @throws PropelException - if the type is not valid.
*/
public static function getFieldNames($type = BasePeer::TYPE_PHPNAME)
{
if (!array_key_exists($type, ParametroConfiguracionPeer::$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 ParametroConfiguracionPeer::$fieldNames[$type];
}
/**
* Convenience method which changes table.column to alias.column.
*
* Using this method you can maintain SQL abstraction while using column aliases.
* <code>
* $c->addAlias("alias1", TablePeer::TABLE_NAME);
* $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
* </code>
* @param string $alias The alias for the current table.
* @param string $column The column name for current table. (i.e. ParametroConfiguracionPeer::COLUMN_NAME).
* @return string
*/
public static function alias($alias, $column)
{
return str_replace(ParametroConfiguracionPeer::TABLE_NAME.'.', $alias.'.', $column);
}
/**
* Add all the columns needed to create a new object.
*
* Note: any columns that were marked with lazyLoad="true" in the
* XML schema will not be added to the select list and only loaded
* on demand.
*
* @param Criteria $criteria object containing the columns to add.
* @param string $alias optional table alias
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function addSelectColumns(Criteria $criteria, $alias = null)
{
if (null === $alias) {
$criteria->addSelectColumn(ParametroConfiguracionPeer::PCO_ID);
$criteria->addSelectColumn(ParametroConfiguracionPeer::PCO_NOMBRE);
$criteria->addSelectColumn(ParametroConfiguracionPeer::PCO_VALOR);
$criteria->addSelectColumn(ParametroConfiguracionPeer::PCO_DESCRIPCION);
} else {
$criteria->addSelectColumn($alias . '.pco_id');
$criteria->addSelectColumn($alias . '.pco_nombre');
$criteria->addSelectColumn($alias . '.pco_valor');
$criteria->addSelectColumn($alias . '.pco_descripcion');
}
}
/**
* Returns the number of rows matching criteria.
*
* @param Criteria $criteria
* @param boolean $distinct Whether to select only distinct columns; deprecated: use Criteria->setDistinct() instead.
* @param PropelPDO $con
* @return int Number of matching rows.
*/
public static function doCount(Criteria $criteria, $distinct = false, PropelPDO $con = null)
{
// we may modify criteria, so copy it first
$criteria = clone $criteria;
// We need to set the primary table name, since in the case that there are no WHERE columns
// it will be impossible for the BasePeer::createSelectSql() method to determine which
// tables go into the FROM clause.
$criteria->setPrimaryTableName(ParametroConfiguracionPeer::TABLE_NAME);
if ($distinct && !in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
$criteria->setDistinct();
}
if (!$criteria->hasSelectClause()) {
ParametroConfiguracionPeer::addSelectColumns($criteria);
}
$criteria->clearOrderByColumns(); // ORDER BY won't ever affect the count
$criteria->setDbName(ParametroConfiguracionPeer::DATABASE_NAME); // Set the correct dbName
if ($con === null) {
$con = Propel::getConnection(ParametroConfiguracionPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
// BasePeer returns a PDOStatement
$stmt = BasePeer::doCount($criteria, $con);
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$count = (int) $row[0];
} else {
$count = 0; // no rows returned; we infer that means 0 matches.
}
$stmt->closeCursor();
return $count;
}
/**
* Selects one object from the DB.
*
* @param Criteria $criteria object used to create the SELECT statement.
* @param PropelPDO $con
* @return ParametroConfiguracion
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelectOne(Criteria $criteria, PropelPDO $con = null)
{
$critcopy = clone $criteria;
$critcopy->setLimit(1);
$objects = ParametroConfiguracionPeer::doSelect($critcopy, $con);
if ($objects) {
return $objects[0];
}
return null;
}
/**
* Selects several row from the DB.
*
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
* @param PropelPDO $con
* @return array Array of selected Objects
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelect(Criteria $criteria, PropelPDO $con = null)
{
return ParametroConfiguracionPeer::populateObjects(ParametroConfiguracionPeer::doSelectStmt($criteria, $con));
}
/**
* Prepares the Criteria object and uses the parent doSelect() method to execute a PDOStatement.
*
* Use this method directly if you want to work with an executed statement directly (for example
* to perform your own object hydration).
*
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
* @param PropelPDO $con The connection to use
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
* @return PDOStatement The executed PDOStatement object.
* @see BasePeer::doSelect()
*/
public static function doSelectStmt(Criteria $criteria, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(ParametroConfiguracionPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
if (!$criteria->hasSelectClause()) {
$criteria = clone $criteria;
ParametroConfiguracionPeer::addSelectColumns($criteria);
}
// Set the correct dbName
$criteria->setDbName(ParametroConfiguracionPeer::DATABASE_NAME);
// BasePeer returns a PDOStatement
return BasePeer::doSelect($criteria, $con);
}
/**
* Adds an object to the instance pool.
*
* Propel keeps cached copies of objects in an instance pool when they are retrieved
* from the database. In some cases -- especially when you override doSelect*()
* methods in your stub classes -- you may need to explicitly add objects
* to the cache in order to ensure that the same objects are always returned by doSelect*()
* and retrieveByPK*() calls.
*
* @param ParametroConfiguracion $obj A ParametroConfiguracion object.
* @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
*/
public static function addInstanceToPool($obj, $key = null)
{
if (Propel::isInstancePoolingEnabled()) {
if ($key === null) {
$key = (string) $obj->getPcoId();
} // if key === null
ParametroConfiguracionPeer::$instances[$key] = $obj;
}
}
/**
* Removes an object from the instance pool.
*
* Propel keeps cached copies of objects in an instance pool when they are retrieved
* from the database. In some cases -- especially when you override doDelete
* methods in your stub classes -- you may need to explicitly remove objects
* from the cache in order to prevent returning objects that no longer exist.
*
* @param mixed $value A ParametroConfiguracion object or a primary key value.
*
* @return void
* @throws PropelException - if the value is invalid.
*/
public static function removeInstanceFromPool($value)
{
if (Propel::isInstancePoolingEnabled() && $value !== null) {
if (is_object($value) && $value instanceof ParametroConfiguracion) {
$key = (string) $value->getPcoId();
} elseif (is_scalar($value)) {
// assume we've been passed a primary key
$key = (string) $value;
} else {
$e = new PropelException("Invalid value passed to removeInstanceFromPool(). Expected primary key or ParametroConfiguracion object; got " . (is_object($value) ? get_class($value) . ' object.' : var_export($value,true)));
throw $e;
}
unset(ParametroConfiguracionPeer::$instances[$key]);
}
} // removeInstanceFromPool()
/**
* Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
*
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
* a multi-column primary key, a serialize()d version of the primary key will be returned.
*
* @param string $key The key (@see getPrimaryKeyHash()) for this instance.
* @return ParametroConfiguracion Found object or null if 1) no instance exists for specified key or 2) instance pooling has been disabled.
* @see getPrimaryKeyHash()
*/
public static function getInstanceFromPool($key)
{
if (Propel::isInstancePoolingEnabled()) {
if (isset(ParametroConfiguracionPeer::$instances[$key])) {
return ParametroConfiguracionPeer::$instances[$key];
}
}
return null; // just to be explicit
}
/**
* Clear the instance pool.
*
* @return void
*/
public static function clearInstancePool($and_clear_all_references = false)
{
if ($and_clear_all_references) {
foreach (ParametroConfiguracionPeer::$instances as $instance) {
$instance->clearAllReferences(true);
}
}
ParametroConfiguracionPeer::$instances = array();
}
/**
* Method to invalidate the instance pool of all tables related to parametro_configuracion
* by a foreign key with ON DELETE CASCADE
*/
public static function clearRelatedInstancePool()
{
}
/**
* Retrieves a string version of the primary key from the DB resultset row that can be used to uniquely identify a row in this table.
*
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
* a multi-column primary key, a serialize()d version of the primary key will be returned.
*
* @param array $row PropelPDO resultset row.
* @param int $startcol The 0-based offset for reading from the resultset row.
* @return string A string version of PK or null if the components of primary key in result array are all null.
*/
public static function getPrimaryKeyHashFromRow($row, $startcol = 0)
{
// If the PK cannot be derived from the row, return null.
if ($row[$startcol] === null) {
return null;
}
return (string) $row[$startcol];
}
/**
* Retrieves the primary key from the DB resultset row
* For tables with a single-column primary key, that simple pkey value will be returned. For tables with
* a multi-column primary key, an array of the primary key columns will be returned.
*
* @param array $row PropelPDO resultset row.
* @param int $startcol The 0-based offset for reading from the resultset row.
* @return mixed The primary key of the row
*/
public static function getPrimaryKeyFromRow($row, $startcol = 0)
{
return (int) $row[$startcol];
}
/**
* The returned array will contain objects of the default type or
* objects that inherit from the default.
*
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function populateObjects(PDOStatement $stmt)
{
$results = array();
// set the class once to avoid overhead in the loop
$cls = ParametroConfiguracionPeer::getOMClass();
// populate the object(s)
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$key = ParametroConfiguracionPeer::getPrimaryKeyHashFromRow($row, 0);
if (null !== ($obj = ParametroConfiguracionPeer::getInstanceFromPool($key))) {
// We no longer rehydrate the object, since this can cause data loss.
// See http://www.propelorm.org/ticket/509
// $obj->hydrate($row, 0, true); // rehydrate
$results[] = $obj;
} else {
$obj = new $cls();
$obj->hydrate($row);
$results[] = $obj;
ParametroConfiguracionPeer::addInstanceToPool($obj, $key);
} // if key exists
}
$stmt->closeCursor();
return $results;
}
/**
* Populates an object of the default type or an object that inherit from the default.
*
* @param array $row PropelPDO resultset row.
* @param int $startcol The 0-based offset for reading from the resultset row.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
* @return array (ParametroConfiguracion object, last column rank)
*/
public static function populateObject($row, $startcol = 0)
{
$key = ParametroConfiguracionPeer::getPrimaryKeyHashFromRow($row, $startcol);
if (null !== ($obj = ParametroConfiguracionPeer::getInstanceFromPool($key))) {
// We no longer rehydrate the object, since this can cause data loss.
// See http://www.propelorm.org/ticket/509
// $obj->hydrate($row, $startcol, true); // rehydrate
$col = $startcol + ParametroConfiguracionPeer::NUM_HYDRATE_COLUMNS;
} else {
$cls = ParametroConfiguracionPeer::OM_CLASS;
$obj = new $cls();
$col = $obj->hydrate($row, $startcol);
ParametroConfiguracionPeer::addInstanceToPool($obj, $key);
}
return array($obj, $col);
}
/**
* Returns the TableMap related to this peer.
* This method is not needed for general use but a specific application could have a need.
* @return TableMap
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function getTableMap()
{
return Propel::getDatabaseMap(ParametroConfiguracionPeer::DATABASE_NAME)->getTable(ParametroConfiguracionPeer::TABLE_NAME);
}
/**
* Add a TableMap instance to the database for this peer class.
*/
public static function buildTableMap()
{
$dbMap = Propel::getDatabaseMap(BaseParametroConfiguracionPeer::DATABASE_NAME);
if (!$dbMap->hasTable(BaseParametroConfiguracionPeer::TABLE_NAME)) {
$dbMap->addTableObject(new \AppBundle\Model\map\ParametroConfiguracionTableMap());
}
}
/**
* The class that the Peer will make instances of.
*
*
* @return string ClassName
*/
public static function getOMClass($row = 0, $colnum = 0)
{
return ParametroConfiguracionPeer::OM_CLASS;
}
/**
* Performs an INSERT on the database, given a ParametroConfiguracion or Criteria object.
*
* @param mixed $values Criteria or ParametroConfiguracion object containing data that is used to create the INSERT statement.
* @param PropelPDO $con the PropelPDO connection to use
* @return mixed The new primary key.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doInsert($values, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(ParametroConfiguracionPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
} else {
$criteria = $values->buildCriteria(); // build Criteria from ParametroConfiguracion object
}
if ($criteria->containsKey(ParametroConfiguracionPeer::PCO_ID) && $criteria->keyContainsValue(ParametroConfiguracionPeer::PCO_ID) ) {
throw new PropelException('Cannot insert a value for auto-increment primary key ('.ParametroConfiguracionPeer::PCO_ID.')');
}
// Set the correct dbName
$criteria->setDbName(ParametroConfiguracionPeer::DATABASE_NAME);
try {
// use transaction because $criteria could contain info
// for more than one table (I guess, conceivably)
$con->beginTransaction();
$pk = BasePeer::doInsert($criteria, $con);
$con->commit();
} catch (Exception $e) {
$con->rollBack();
throw $e;
}
return $pk;
}
/**
* Performs an UPDATE on the database, given a ParametroConfiguracion or Criteria object.
*
* @param mixed $values Criteria or ParametroConfiguracion object containing data that is used to create the UPDATE statement.
* @param PropelPDO $con The connection to use (specify PropelPDO connection object to exert more control over transactions).
* @return int The number of affected rows (if supported by underlying database driver).
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doUpdate($values, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(ParametroConfiguracionPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
$selectCriteria = new Criteria(ParametroConfiguracionPeer::DATABASE_NAME);
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
$comparison = $criteria->getComparison(ParametroConfiguracionPeer::PCO_ID);
$value = $criteria->remove(ParametroConfiguracionPeer::PCO_ID);
if ($value) {
$selectCriteria->add(ParametroConfiguracionPeer::PCO_ID, $value, $comparison);
} else {
$selectCriteria->setPrimaryTableName(ParametroConfiguracionPeer::TABLE_NAME);
}
} else { // $values is ParametroConfiguracion object
$criteria = $values->buildCriteria(); // gets full criteria
$selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
}
// set the correct dbName
$criteria->setDbName(ParametroConfiguracionPeer::DATABASE_NAME);
return BasePeer::doUpdate($selectCriteria, $criteria, $con);
}
/**
* Deletes all rows from the parametro_configuracion table.
*
* @param PropelPDO $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver).
* @throws PropelException
*/
public static function doDeleteAll(PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(ParametroConfiguracionPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->beginTransaction();
$affectedRows += BasePeer::doDeleteAll(ParametroConfiguracionPeer::TABLE_NAME, $con, ParametroConfiguracionPeer::DATABASE_NAME);
// Because this db requires some delete cascade/set null emulation, we have to
// clear the cached instance *after* the emulation has happened (since
// instances get re-added by the select statement contained therein).
ParametroConfiguracionPeer::clearInstancePool();
ParametroConfiguracionPeer::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (Exception $e) {
$con->rollBack();
throw $e;
}
}
/**
* Performs a DELETE on the database, given a ParametroConfiguracion or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or ParametroConfiguracion object or primary key or array of primary keys
* which is used to create the DELETE statement
* @param PropelPDO $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver). This includes CASCADE-related rows
* if supported by native driver or if emulated using Propel.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doDelete($values, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(ParametroConfiguracionPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
if ($values instanceof Criteria) {
// invalidate the cache for all objects of this type, since we have no
// way of knowing (without running a query) what objects should be invalidated
// from the cache based on this Criteria.
ParametroConfiguracionPeer::clearInstancePool();
// rename for clarity
$criteria = clone $values;
} elseif ($values instanceof ParametroConfiguracion) { // it's a model object
// invalidate the cache for this single object
ParametroConfiguracionPeer::removeInstanceFromPool($values);
// create criteria based on pk values
$criteria = $values->buildPkeyCriteria();
} else { // it's a primary key, or an array of pks
$criteria = new Criteria(ParametroConfiguracionPeer::DATABASE_NAME);
$criteria->add(ParametroConfiguracionPeer::PCO_ID, (array) $values, Criteria::IN);
// invalidate the cache for this object(s)
foreach ((array) $values as $singleval) {
ParametroConfiguracionPeer::removeInstanceFromPool($singleval);
}
}
// Set the correct dbName
$criteria->setDbName(ParametroConfiguracionPeer::DATABASE_NAME);
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->beginTransaction();
$affectedRows += BasePeer::doDelete($criteria, $con);
ParametroConfiguracionPeer::clearRelatedInstancePool();
$con->commit();
return $affectedRows;
} catch (Exception $e) {
$con->rollBack();
throw $e;
}
}
/**
* Validates all modified columns of given ParametroConfiguracion object.
* If parameter $columns is either a single column name or an array of column names
* than only those columns are validated.
*
* NOTICE: This does not apply to primary or foreign keys for now.
*
* @param ParametroConfiguracion $obj The object to validate.
* @param mixed $cols Column name or array of column names.
*
* @return mixed TRUE if all columns are valid or the error message of the first invalid column.
*/
public static function doValidate($obj, $cols = null)
{
$columns = array();
if ($cols) {
$dbMap = Propel::getDatabaseMap(ParametroConfiguracionPeer::DATABASE_NAME);
$tableMap = $dbMap->getTable(ParametroConfiguracionPeer::TABLE_NAME);
if (! is_array($cols)) {
$cols = array($cols);
}
foreach ($cols as $colName) {
if ($tableMap->hasColumn($colName)) {
$get = 'get' . $tableMap->getColumn($colName)->getPhpName();
$columns[$colName] = $obj->$get();
}
}
} else {
}
return BasePeer::doValidate(ParametroConfiguracionPeer::DATABASE_NAME, ParametroConfiguracionPeer::TABLE_NAME, $columns);
}
/**
* Retrieve a single object by pkey.
*
* @param int $pk the primary key.
* @param PropelPDO $con the connection to use
* @return ParametroConfiguracion
*/
public static function retrieveByPK($pk, PropelPDO $con = null)
{
if (null !== ($obj = ParametroConfiguracionPeer::getInstanceFromPool((string) $pk))) {
return $obj;
}
if ($con === null) {
$con = Propel::getConnection(ParametroConfiguracionPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$criteria = new Criteria(ParametroConfiguracionPeer::DATABASE_NAME);
$criteria->add(ParametroConfiguracionPeer::PCO_ID, $pk);
$v = ParametroConfiguracionPeer::doSelect($criteria, $con);
return !empty($v) > 0 ? $v[0] : null;
}
/**
* Retrieve multiple objects by pkey.
*
* @param array $pks List of primary keys
* @param PropelPDO $con the connection to use
* @return ParametroConfiguracion[]
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function retrieveByPKs($pks, PropelPDO $con = null)
{
if ($con === null) {
$con = Propel::getConnection(ParametroConfiguracionPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$objs = null;
if (empty($pks)) {
$objs = array();
} else {
$criteria = new Criteria(ParametroConfiguracionPeer::DATABASE_NAME);
$criteria->add(ParametroConfiguracionPeer::PCO_ID, $pks, Criteria::IN);
$objs = ParametroConfiguracionPeer::doSelect($criteria, $con);
}
return $objs;
}
} // BaseParametroConfiguracionPeer
// This is the static code needed to register the TableMap for this table with the main Propel class.
//
BaseParametroConfiguracionPeer::buildTableMap();
<?php
namespace AppBundle\Model\om;
use \Criteria;
use \Exception;
use \ModelCriteria;
use \PDO;
use \Propel;
use \PropelException;
use \PropelObjectCollection;
use \PropelPDO;
use AppBundle\Model\ParametroConfiguracion;
use AppBundle\Model\ParametroConfiguracionPeer;
use AppBundle\Model\ParametroConfiguracionQuery;
/**
* @method ParametroConfiguracionQuery orderByPcoId($order = Criteria::ASC) Order by the pco_id column
* @method ParametroConfiguracionQuery orderByPcoNombre($order = Criteria::ASC) Order by the pco_nombre column
* @method ParametroConfiguracionQuery orderByPcoValor($order = Criteria::ASC) Order by the pco_valor column
* @method ParametroConfiguracionQuery orderByPcoDescripcion($order = Criteria::ASC) Order by the pco_descripcion column
*
* @method ParametroConfiguracionQuery groupByPcoId() Group by the pco_id column
* @method ParametroConfiguracionQuery groupByPcoNombre() Group by the pco_nombre column
* @method ParametroConfiguracionQuery groupByPcoValor() Group by the pco_valor column
* @method ParametroConfiguracionQuery groupByPcoDescripcion() Group by the pco_descripcion column
*
* @method ParametroConfiguracionQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ParametroConfiguracionQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
* @method ParametroConfiguracionQuery innerJoin($relation) Adds a INNER JOIN clause to the query
*
* @method ParametroConfiguracion findOne(PropelPDO $con = null) Return the first ParametroConfiguracion matching the query
* @method ParametroConfiguracion findOneOrCreate(PropelPDO $con = null) Return the first ParametroConfiguracion matching the query, or a new ParametroConfiguracion object populated from the query conditions when no match is found
*
* @method ParametroConfiguracion findOneByPcoNombre(string $pco_nombre) Return the first ParametroConfiguracion filtered by the pco_nombre column
* @method ParametroConfiguracion findOneByPcoValor(string $pco_valor) Return the first ParametroConfiguracion filtered by the pco_valor column
* @method ParametroConfiguracion findOneByPcoDescripcion(string $pco_descripcion) Return the first ParametroConfiguracion filtered by the pco_descripcion column
*
* @method array findByPcoId(int $pco_id) Return ParametroConfiguracion objects filtered by the pco_id column
* @method array findByPcoNombre(string $pco_nombre) Return ParametroConfiguracion objects filtered by the pco_nombre column
* @method array findByPcoValor(string $pco_valor) Return ParametroConfiguracion objects filtered by the pco_valor column
* @method array findByPcoDescripcion(string $pco_descripcion) Return ParametroConfiguracion objects filtered by the pco_descripcion column
*/
abstract class BaseParametroConfiguracionQuery extends ModelCriteria
{
/**
* Initializes internal state of BaseParametroConfiguracionQuery object.
*
* @param string $dbName The dabase name
* @param string $modelName The phpName of a model, e.g. 'Book'
* @param string $modelAlias The alias for the model in this query, e.g. 'b'
*/
public function __construct($dbName = null, $modelName = null, $modelAlias = null)
{
if (null === $dbName) {
$dbName = 'default';
}
if (null === $modelName) {
$modelName = 'AppBundle\\Model\\ParametroConfiguracion';
}
parent::__construct($dbName, $modelName, $modelAlias);
}
/**
* Returns a new ParametroConfiguracionQuery object.
*
* @param string $modelAlias The alias of a model in the query
* @param ParametroConfiguracionQuery|Criteria $criteria Optional Criteria to build the query from
*
* @return ParametroConfiguracionQuery
*/
public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof ParametroConfiguracionQuery) {
return $criteria;
}
$query = new ParametroConfiguracionQuery(null, null, $modelAlias);
if ($criteria instanceof Criteria) {
$query->mergeWith($criteria);
}
return $query;
}
/**
* Find object by primary key.
* Propel uses the instance pool to skip the database if the object exists.
* Go fast if the query is untouched.
*
* <code>
* $obj = $c->findPk(12, $con);
* </code>
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con an optional connection object
*
* @return ParametroConfiguracion|ParametroConfiguracion[]|mixed the result, formatted by the current formatter
*/
public function findPk($key, $con = null)
{
if ($key === null) {
return null;
}
if ((null !== ($obj = ParametroConfiguracionPeer::getInstanceFromPool((string) $key))) && !$this->formatter) {
// the object is already in the instance pool
return $obj;
}
if ($con === null) {
$con = Propel::getConnection(ParametroConfiguracionPeer::DATABASE_NAME, Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
if ($this->formatter || $this->modelAlias || $this->with || $this->select
|| $this->selectColumns || $this->asColumns || $this->selectModifiers
|| $this->map || $this->having || $this->joins) {
return $this->findPkComplex($key, $con);
} else {
return $this->findPkSimple($key, $con);
}
}
/**
* Alias of findPk to use instance pooling
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return ParametroConfiguracion A model object, or null if the key is not found
* @throws PropelException
*/
public function findOneByPcoId($key, $con = null)
{
return $this->findPk($key, $con);
}
/**
* Find object by primary key using raw SQL to go fast.
* Bypass doSelect() and the object formatter by using generated code.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return ParametroConfiguracion A model object, or null if the key is not found
* @throws PropelException
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT `pco_id`, `pco_nombre`, `pco_valor`, `pco_descripcion` FROM `parametro_configuracion` WHERE `pco_id` = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
$stmt->execute();
} catch (Exception $e) {
Propel::log($e->getMessage(), Propel::LOG_ERR);
throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
}
$obj = null;
if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$obj = new ParametroConfiguracion();
$obj->hydrate($row);
ParametroConfiguracionPeer::addInstanceToPool($obj, (string) $key);
}
$stmt->closeCursor();
return $obj;
}
/**
* Find object by primary key.
*
* @param mixed $key Primary key to use for the query
* @param PropelPDO $con A connection object
*
* @return ParametroConfiguracion|ParametroConfiguracion[]|mixed the result, formatted by the current formatter
*/
protected function findPkComplex($key, $con)
{
// As the query uses a PK condition, no limit(1) is necessary.
$criteria = $this->isKeepQuery() ? clone $this : $this;
$stmt = $criteria
->filterByPrimaryKey($key)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
}
/**
* Find objects by primary key
* <code>
* $objs = $c->findPks(array(12, 56, 832), $con);
* </code>
* @param array $keys Primary keys to use for the query
* @param PropelPDO $con an optional connection object
*
* @return PropelObjectCollection|ParametroConfiguracion[]|mixed the list of results, formatted by the current formatter
*/
public function findPks($keys, $con = null)
{
if ($con === null) {
$con = Propel::getConnection($this->getDbName(), Propel::CONNECTION_READ);
}
$this->basePreSelect($con);
$criteria = $this->isKeepQuery() ? clone $this : $this;
$stmt = $criteria
->filterByPrimaryKeys($keys)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->format($stmt);
}
/**
* Filter the query by primary key
*
* @param mixed $key Primary key to use for the query
*
* @return ParametroConfiguracionQuery The current query, for fluid interface
*/
public function filterByPrimaryKey($key)
{
return $this->addUsingAlias(ParametroConfiguracionPeer::PCO_ID, $key, Criteria::EQUAL);
}
/**
* Filter the query by a list of primary keys
*
* @param array $keys The list of primary key to use for the query
*
* @return ParametroConfiguracionQuery The current query, for fluid interface
*/
public function filterByPrimaryKeys($keys)
{
return $this->addUsingAlias(ParametroConfiguracionPeer::PCO_ID, $keys, Criteria::IN);
}
/**
* Filter the query on the pco_id column
*
* Example usage:
* <code>
* $query->filterByPcoId(1234); // WHERE pco_id = 1234
* $query->filterByPcoId(array(12, 34)); // WHERE pco_id IN (12, 34)
* $query->filterByPcoId(array('min' => 12)); // WHERE pco_id >= 12
* $query->filterByPcoId(array('max' => 12)); // WHERE pco_id <= 12
* </code>
*
* @param mixed $pcoId The value to use as filter.
* Use scalar values for equality.
* Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ParametroConfiguracionQuery The current query, for fluid interface
*/
public function filterByPcoId($pcoId = null, $comparison = null)
{
if (is_array($pcoId)) {
$useMinMax = false;
if (isset($pcoId['min'])) {
$this->addUsingAlias(ParametroConfiguracionPeer::PCO_ID, $pcoId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($pcoId['max'])) {
$this->addUsingAlias(ParametroConfiguracionPeer::PCO_ID, $pcoId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(ParametroConfiguracionPeer::PCO_ID, $pcoId, $comparison);
}
/**
* Filter the query on the pco_nombre column
*
* Example usage:
* <code>
* $query->filterByPcoNombre('fooValue'); // WHERE pco_nombre = 'fooValue'
* $query->filterByPcoNombre('%fooValue%'); // WHERE pco_nombre LIKE '%fooValue%'
* </code>
*
* @param string $pcoNombre The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ParametroConfiguracionQuery The current query, for fluid interface
*/
public function filterByPcoNombre($pcoNombre = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($pcoNombre)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $pcoNombre)) {
$pcoNombre = str_replace('*', '%', $pcoNombre);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(ParametroConfiguracionPeer::PCO_NOMBRE, $pcoNombre, $comparison);
}
/**
* Filter the query on the pco_valor column
*
* Example usage:
* <code>
* $query->filterByPcoValor('fooValue'); // WHERE pco_valor = 'fooValue'
* $query->filterByPcoValor('%fooValue%'); // WHERE pco_valor LIKE '%fooValue%'
* </code>
*
* @param string $pcoValor The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ParametroConfiguracionQuery The current query, for fluid interface
*/
public function filterByPcoValor($pcoValor = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($pcoValor)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $pcoValor)) {
$pcoValor = str_replace('*', '%', $pcoValor);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(ParametroConfiguracionPeer::PCO_VALOR, $pcoValor, $comparison);
}
/**
* Filter the query on the pco_descripcion column
*
* Example usage:
* <code>
* $query->filterByPcoDescripcion('fooValue'); // WHERE pco_descripcion = 'fooValue'
* $query->filterByPcoDescripcion('%fooValue%'); // WHERE pco_descripcion LIKE '%fooValue%'
* </code>
*
* @param string $pcoDescripcion The value to use as filter.
* Accepts wildcards (* and % trigger a LIKE)
* @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
*
* @return ParametroConfiguracionQuery The current query, for fluid interface
*/
public function filterByPcoDescripcion($pcoDescripcion = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($pcoDescripcion)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $pcoDescripcion)) {
$pcoDescripcion = str_replace('*', '%', $pcoDescripcion);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(ParametroConfiguracionPeer::PCO_DESCRIPCION, $pcoDescripcion, $comparison);
}
/**
* Exclude object from result
*
* @param ParametroConfiguracion $parametroConfiguracion Object to remove from the list of results
*
* @return ParametroConfiguracionQuery The current query, for fluid interface
*/
public function prune($parametroConfiguracion = null)
{
if ($parametroConfiguracion) {
$this->addUsingAlias(ParametroConfiguracionPeer::PCO_ID, $parametroConfiguracion->getPcoId(), Criteria::NOT_EQUAL);
}
return $this;
}
}
......@@ -10,4 +10,13 @@
<parameter name="Engine" value="MyISAM"/>
</vendor>
</table>
</database>
<table name="parametro_configuracion" phpName="ParametroConfiguracion" idMethod="native">
<column name="pco_id" phpName="PcoId" type="INTEGER" primaryKey="true" autoIncrement="true" required="true"/>
<column name="pco_nombre" phpName="PcoNombre" type="VARCHAR" size="100" required="false"/>
<column name="pco_valor" phpName="PcoValor" type="VARCHAR" size="1000" required="false"/>
<column name="pco_descripcion" phpName="PcoDescripcion" type="VARCHAR" size="1000" required="false"/>
<vendor type="mysql">
<parameter name="Engine" value="InnoDB"/>
</vendor>
</table>
</database>
\ No newline at end of file
......@@ -19,6 +19,7 @@ use FOS\RestBundle\View\View;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
class EnvioSmsController extends FOSRestController
{
......@@ -110,7 +111,7 @@ class EnvioSmsController extends FOSRestController
$post['to'] = array($movil);
$post['text'] = $mensaje;
$post['from'] = $movil;
$post['dlr-url'] ="http://localhost/apirestsms/notifica.php?idenvio=". $campana . "&tel=%P&estado=%d"; //esta url debe ser cambiada
$post['dlr-url'] ="http://localhost/apirestsms/notifica/". $campana . "/%P/%d";
$user = $usuario;
$password = $password;
$ch = curl_init();
......@@ -253,4 +254,19 @@ $val=strVal($messageId);
}
}
/**
* @Route("/notifica/{idenvio}/{tel}/{estado}")
*/
public function notificaAction($idenvio, $tel,$estado){
$notifica = new Notifica();
$notifica->setCampana($idenvio);
$notifica->setTelefono($tel);
$notifica->setEstado($estado);
$notifica->save();
}
}
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment