Commit e278cb59 authored by Ana's avatar Ana

añadir grabado de status

parent f2db3651
...@@ -3,9 +3,10 @@ ...@@ -3,9 +3,10 @@
<database name="default" defaultIdMethod="native"> <database name="default" defaultIdMethod="native">
<table name="notifica" phpName="Notifica" idMethod="native"> <table name="notifica" phpName="Notifica" idMethod="native">
<column name="id" phpName="Id" type="INTEGER" primaryKey="true" autoIncrement="true" required="true"/> <column name="id" phpName="Id" type="INTEGER" primaryKey="true" autoIncrement="true" required="true"/>
<column name="campana" phpName="Campana" type="INTEGER" required="true"/> <column name="campana" phpName="Campana" type="CLOB" required="true"/>
<column name="telefono" phpName="Telefono" type="VARCHAR" size="20" required="true"/> <column name="telefono" phpName="Telefono" type="VARCHAR" size="20" required="true"/>
<column name="estado" phpName="Estado" type="INTEGER" required="true"/> <column name="estado" phpName="Estado" type="LONGVARCHAR" required="true"/>
<column name="idmetodo" phpName="Idmetodo" type="INTEGER" required="true" defaultValue="0"/>
<vendor type="mysql"> <vendor type="mysql">
<parameter name="Engine" value="MyISAM"/> <parameter name="Engine" value="MyISAM"/>
</vendor> </vendor>
......
...@@ -31,9 +31,10 @@ SET time_zone = "+00:00"; ...@@ -31,9 +31,10 @@ SET time_zone = "+00:00";
CREATE TABLE `notifica` ( CREATE TABLE `notifica` (
`id` int(11) NOT NULL, `id` int(11) NOT NULL,
`campana` int(11) NOT NULL, `campana` longtext NOT NULL,
`telefono` varchar(20) NOT NULL, `telefono` varchar(20) NOT NULL,
`estado` int(11) NOT NULL `estado` text NOT NULL,
`idmetodo` int(11) NOT NULL DEFAULT '0'
) ENGINE=MyISAM DEFAULT CHARSET=latin1; ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
......
...@@ -43,9 +43,10 @@ class NotificaTableMap extends TableMap ...@@ -43,9 +43,10 @@ class NotificaTableMap extends TableMap
$this->setUseIdGenerator(true); $this->setUseIdGenerator(true);
// columns // columns
$this->addPrimaryKey('id', 'Id', 'INTEGER', true, null, null); $this->addPrimaryKey('id', 'Id', 'INTEGER', true, null, null);
$this->addColumn('campana', 'Campana', 'INTEGER', true, null, null); $this->addColumn('campana', 'Campana', 'CLOB', true, null, null);
$this->addColumn('telefono', 'Telefono', 'VARCHAR', true, 20, null); $this->addColumn('telefono', 'Telefono', 'VARCHAR', true, 20, null);
$this->addColumn('estado', 'Estado', 'INTEGER', true, null, null); $this->addColumn('estado', 'Estado', 'LONGVARCHAR', true, null, null);
$this->addColumn('idmetodo', 'Idmetodo', 'INTEGER', true, null, 0);
// validators // validators
} // initialize() } // initialize()
......
This diff is collapsed.
...@@ -29,13 +29,13 @@ abstract class BaseNotificaPeer ...@@ -29,13 +29,13 @@ abstract class BaseNotificaPeer
const TM_CLASS = 'AppBundle\\Model\\map\\NotificaTableMap'; const TM_CLASS = 'AppBundle\\Model\\map\\NotificaTableMap';
/** The total number of columns. */ /** The total number of columns. */
const NUM_COLUMNS = 4; const NUM_COLUMNS = 5;
/** The number of lazy-loaded columns. */ /** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0; const NUM_LAZY_LOAD_COLUMNS = 0;
/** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */ /** The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */
const NUM_HYDRATE_COLUMNS = 4; const NUM_HYDRATE_COLUMNS = 5;
/** the column name for the id field */ /** the column name for the id field */
const ID = 'notifica.id'; const ID = 'notifica.id';
...@@ -49,6 +49,9 @@ abstract class BaseNotificaPeer ...@@ -49,6 +49,9 @@ abstract class BaseNotificaPeer
/** the column name for the estado field */ /** the column name for the estado field */
const ESTADO = 'notifica.estado'; const ESTADO = 'notifica.estado';
/** the column name for the idmetodo field */
const IDMETODO = 'notifica.idmetodo';
/** The default string format for model objects of the related table **/ /** The default string format for model objects of the related table **/
const DEFAULT_STRING_FORMAT = 'YAML'; const DEFAULT_STRING_FORMAT = 'YAML';
...@@ -68,12 +71,12 @@ abstract class BaseNotificaPeer ...@@ -68,12 +71,12 @@ abstract class BaseNotificaPeer
* e.g. NotificaPeer::$fieldNames[NotificaPeer::TYPE_PHPNAME][0] = 'Id' * e.g. NotificaPeer::$fieldNames[NotificaPeer::TYPE_PHPNAME][0] = 'Id'
*/ */
protected static $fieldNames = array ( protected static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('Id', 'Campana', 'Telefono', 'Estado', ), BasePeer::TYPE_PHPNAME => array ('Id', 'Campana', 'Telefono', 'Estado', 'Idmetodo', ),
BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'campana', 'telefono', 'estado', ), BasePeer::TYPE_STUDLYPHPNAME => array ('id', 'campana', 'telefono', 'estado', 'idmetodo', ),
BasePeer::TYPE_COLNAME => array (NotificaPeer::ID, NotificaPeer::CAMPANA, NotificaPeer::TELEFONO, NotificaPeer::ESTADO, ), BasePeer::TYPE_COLNAME => array (NotificaPeer::ID, NotificaPeer::CAMPANA, NotificaPeer::TELEFONO, NotificaPeer::ESTADO, NotificaPeer::IDMETODO, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID', 'CAMPANA', 'TELEFONO', 'ESTADO', ), BasePeer::TYPE_RAW_COLNAME => array ('ID', 'CAMPANA', 'TELEFONO', 'ESTADO', 'IDMETODO', ),
BasePeer::TYPE_FIELDNAME => array ('id', 'campana', 'telefono', 'estado', ), BasePeer::TYPE_FIELDNAME => array ('id', 'campana', 'telefono', 'estado', 'idmetodo', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, ) BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, )
); );
/** /**
...@@ -83,12 +86,12 @@ abstract class BaseNotificaPeer ...@@ -83,12 +86,12 @@ abstract class BaseNotificaPeer
* e.g. NotificaPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 * e.g. NotificaPeer::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/ */
protected static $fieldKeys = array ( protected static $fieldKeys = array (
BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Campana' => 1, 'Telefono' => 2, 'Estado' => 3, ), BasePeer::TYPE_PHPNAME => array ('Id' => 0, 'Campana' => 1, 'Telefono' => 2, 'Estado' => 3, 'Idmetodo' => 4, ),
BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'campana' => 1, 'telefono' => 2, 'estado' => 3, ), BasePeer::TYPE_STUDLYPHPNAME => array ('id' => 0, 'campana' => 1, 'telefono' => 2, 'estado' => 3, 'idmetodo' => 4, ),
BasePeer::TYPE_COLNAME => array (NotificaPeer::ID => 0, NotificaPeer::CAMPANA => 1, NotificaPeer::TELEFONO => 2, NotificaPeer::ESTADO => 3, ), BasePeer::TYPE_COLNAME => array (NotificaPeer::ID => 0, NotificaPeer::CAMPANA => 1, NotificaPeer::TELEFONO => 2, NotificaPeer::ESTADO => 3, NotificaPeer::IDMETODO => 4, ),
BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'CAMPANA' => 1, 'TELEFONO' => 2, 'ESTADO' => 3, ), BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'CAMPANA' => 1, 'TELEFONO' => 2, 'ESTADO' => 3, 'IDMETODO' => 4, ),
BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'campana' => 1, 'telefono' => 2, 'estado' => 3, ), BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'campana' => 1, 'telefono' => 2, 'estado' => 3, 'idmetodo' => 4, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, ) BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, )
); );
/** /**
...@@ -166,11 +169,13 @@ abstract class BaseNotificaPeer ...@@ -166,11 +169,13 @@ abstract class BaseNotificaPeer
$criteria->addSelectColumn(NotificaPeer::CAMPANA); $criteria->addSelectColumn(NotificaPeer::CAMPANA);
$criteria->addSelectColumn(NotificaPeer::TELEFONO); $criteria->addSelectColumn(NotificaPeer::TELEFONO);
$criteria->addSelectColumn(NotificaPeer::ESTADO); $criteria->addSelectColumn(NotificaPeer::ESTADO);
$criteria->addSelectColumn(NotificaPeer::IDMETODO);
} else { } else {
$criteria->addSelectColumn($alias . '.id'); $criteria->addSelectColumn($alias . '.id');
$criteria->addSelectColumn($alias . '.campana'); $criteria->addSelectColumn($alias . '.campana');
$criteria->addSelectColumn($alias . '.telefono'); $criteria->addSelectColumn($alias . '.telefono');
$criteria->addSelectColumn($alias . '.estado'); $criteria->addSelectColumn($alias . '.estado');
$criteria->addSelectColumn($alias . '.idmetodo');
} }
} }
......
...@@ -19,11 +19,13 @@ use AppBundle\Model\NotificaQuery; ...@@ -19,11 +19,13 @@ use AppBundle\Model\NotificaQuery;
* @method NotificaQuery orderByCampana($order = Criteria::ASC) Order by the campana column * @method NotificaQuery orderByCampana($order = Criteria::ASC) Order by the campana column
* @method NotificaQuery orderByTelefono($order = Criteria::ASC) Order by the telefono column * @method NotificaQuery orderByTelefono($order = Criteria::ASC) Order by the telefono column
* @method NotificaQuery orderByEstado($order = Criteria::ASC) Order by the estado column * @method NotificaQuery orderByEstado($order = Criteria::ASC) Order by the estado column
* @method NotificaQuery orderByIdmetodo($order = Criteria::ASC) Order by the idmetodo column
* *
* @method NotificaQuery groupById() Group by the id column * @method NotificaQuery groupById() Group by the id column
* @method NotificaQuery groupByCampana() Group by the campana column * @method NotificaQuery groupByCampana() Group by the campana column
* @method NotificaQuery groupByTelefono() Group by the telefono column * @method NotificaQuery groupByTelefono() Group by the telefono column
* @method NotificaQuery groupByEstado() Group by the estado column * @method NotificaQuery groupByEstado() Group by the estado column
* @method NotificaQuery groupByIdmetodo() Group by the idmetodo column
* *
* @method NotificaQuery leftJoin($relation) Adds a LEFT JOIN clause to the query * @method NotificaQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method NotificaQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query * @method NotificaQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
...@@ -32,14 +34,16 @@ use AppBundle\Model\NotificaQuery; ...@@ -32,14 +34,16 @@ use AppBundle\Model\NotificaQuery;
* @method Notifica findOne(PropelPDO $con = null) Return the first Notifica matching the query * @method Notifica findOne(PropelPDO $con = null) Return the first Notifica matching the query
* @method Notifica findOneOrCreate(PropelPDO $con = null) Return the first Notifica matching the query, or a new Notifica object populated from the query conditions when no match is found * @method Notifica findOneOrCreate(PropelPDO $con = null) Return the first Notifica matching the query, or a new Notifica object populated from the query conditions when no match is found
* *
* @method Notifica findOneByCampana(int $campana) Return the first Notifica filtered by the campana column * @method Notifica findOneByCampana(string $campana) Return the first Notifica filtered by the campana column
* @method Notifica findOneByTelefono(string $telefono) Return the first Notifica filtered by the telefono column * @method Notifica findOneByTelefono(string $telefono) Return the first Notifica filtered by the telefono column
* @method Notifica findOneByEstado(int $estado) Return the first Notifica filtered by the estado column * @method Notifica findOneByEstado(string $estado) Return the first Notifica filtered by the estado column
* @method Notifica findOneByIdmetodo(int $idmetodo) Return the first Notifica filtered by the idmetodo column
* *
* @method array findById(int $id) Return Notifica objects filtered by the id column * @method array findById(int $id) Return Notifica objects filtered by the id column
* @method array findByCampana(int $campana) Return Notifica objects filtered by the campana column * @method array findByCampana(string $campana) Return Notifica objects filtered by the campana column
* @method array findByTelefono(string $telefono) Return Notifica objects filtered by the telefono column * @method array findByTelefono(string $telefono) Return Notifica objects filtered by the telefono column
* @method array findByEstado(int $estado) Return Notifica objects filtered by the estado column * @method array findByEstado(string $estado) Return Notifica objects filtered by the estado column
* @method array findByIdmetodo(int $idmetodo) Return Notifica objects filtered by the idmetodo column
*/ */
abstract class BaseNotificaQuery extends ModelCriteria abstract class BaseNotificaQuery extends ModelCriteria
{ {
...@@ -145,7 +149,7 @@ abstract class BaseNotificaQuery extends ModelCriteria ...@@ -145,7 +149,7 @@ abstract class BaseNotificaQuery extends ModelCriteria
*/ */
protected function findPkSimple($key, $con) protected function findPkSimple($key, $con)
{ {
$sql = 'SELECT `id`, `campana`, `telefono`, `estado` FROM `notifica` WHERE `id` = :p0'; $sql = 'SELECT `id`, `campana`, `telefono`, `estado`, `idmetodo` FROM `notifica` WHERE `id` = :p0';
try { try {
$stmt = $con->prepare($sql); $stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT); $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
...@@ -281,37 +285,24 @@ abstract class BaseNotificaQuery extends ModelCriteria ...@@ -281,37 +285,24 @@ abstract class BaseNotificaQuery extends ModelCriteria
* *
* Example usage: * Example usage:
* <code> * <code>
* $query->filterByCampana(1234); // WHERE campana = 1234 * $query->filterByCampana('fooValue'); // WHERE campana = 'fooValue'
* $query->filterByCampana(array(12, 34)); // WHERE campana IN (12, 34) * $query->filterByCampana('%fooValue%'); // WHERE campana LIKE '%fooValue%'
* $query->filterByCampana(array('min' => 12)); // WHERE campana >= 12
* $query->filterByCampana(array('max' => 12)); // WHERE campana <= 12
* </code> * </code>
* *
* @param mixed $campana The value to use as filter. * @param string $campana The value to use as filter.
* Use scalar values for equality. * Accepts wildcards (* and % trigger a LIKE)
* 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 * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
* *
* @return NotificaQuery The current query, for fluid interface * @return NotificaQuery The current query, for fluid interface
*/ */
public function filterByCampana($campana = null, $comparison = null) public function filterByCampana($campana = null, $comparison = null)
{ {
if (is_array($campana)) { if (null === $comparison) {
$useMinMax = false; if (is_array($campana)) {
if (isset($campana['min'])) {
$this->addUsingAlias(NotificaPeer::CAMPANA, $campana['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($campana['max'])) {
$this->addUsingAlias(NotificaPeer::CAMPANA, $campana['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN; $comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $campana)) {
$campana = str_replace('*', '%', $campana);
$comparison = Criteria::LIKE;
} }
} }
...@@ -352,13 +343,42 @@ abstract class BaseNotificaQuery extends ModelCriteria ...@@ -352,13 +343,42 @@ abstract class BaseNotificaQuery extends ModelCriteria
* *
* Example usage: * Example usage:
* <code> * <code>
* $query->filterByEstado(1234); // WHERE estado = 1234 * $query->filterByEstado('fooValue'); // WHERE estado = 'fooValue'
* $query->filterByEstado(array(12, 34)); // WHERE estado IN (12, 34) * $query->filterByEstado('%fooValue%'); // WHERE estado LIKE '%fooValue%'
* $query->filterByEstado(array('min' => 12)); // WHERE estado >= 12
* $query->filterByEstado(array('max' => 12)); // WHERE estado <= 12
* </code> * </code>
* *
* @param mixed $estado The value to use as filter. * @param string $estado 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 NotificaQuery The current query, for fluid interface
*/
public function filterByEstado($estado = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($estado)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $estado)) {
$estado = str_replace('*', '%', $estado);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(NotificaPeer::ESTADO, $estado, $comparison);
}
/**
* Filter the query on the idmetodo column
*
* Example usage:
* <code>
* $query->filterByIdmetodo(1234); // WHERE idmetodo = 1234
* $query->filterByIdmetodo(array(12, 34)); // WHERE idmetodo IN (12, 34)
* $query->filterByIdmetodo(array('min' => 12)); // WHERE idmetodo >= 12
* $query->filterByIdmetodo(array('max' => 12)); // WHERE idmetodo <= 12
* </code>
*
* @param mixed $idmetodo The value to use as filter.
* Use scalar values for equality. * Use scalar values for equality.
* Use array values for in_array() equivalent. * Use array values for in_array() equivalent.
* Use associative array('min' => $minValue, 'max' => $maxValue) for intervals. * Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
...@@ -366,16 +386,16 @@ abstract class BaseNotificaQuery extends ModelCriteria ...@@ -366,16 +386,16 @@ abstract class BaseNotificaQuery extends ModelCriteria
* *
* @return NotificaQuery The current query, for fluid interface * @return NotificaQuery The current query, for fluid interface
*/ */
public function filterByEstado($estado = null, $comparison = null) public function filterByIdmetodo($idmetodo = null, $comparison = null)
{ {
if (is_array($estado)) { if (is_array($idmetodo)) {
$useMinMax = false; $useMinMax = false;
if (isset($estado['min'])) { if (isset($idmetodo['min'])) {
$this->addUsingAlias(NotificaPeer::ESTADO, $estado['min'], Criteria::GREATER_EQUAL); $this->addUsingAlias(NotificaPeer::IDMETODO, $idmetodo['min'], Criteria::GREATER_EQUAL);
$useMinMax = true; $useMinMax = true;
} }
if (isset($estado['max'])) { if (isset($idmetodo['max'])) {
$this->addUsingAlias(NotificaPeer::ESTADO, $estado['max'], Criteria::LESS_EQUAL); $this->addUsingAlias(NotificaPeer::IDMETODO, $idmetodo['max'], Criteria::LESS_EQUAL);
$useMinMax = true; $useMinMax = true;
} }
if ($useMinMax) { if ($useMinMax) {
...@@ -386,7 +406,7 @@ abstract class BaseNotificaQuery extends ModelCriteria ...@@ -386,7 +406,7 @@ abstract class BaseNotificaQuery extends ModelCriteria
} }
} }
return $this->addUsingAlias(NotificaPeer::ESTADO, $estado, $comparison); return $this->addUsingAlias(NotificaPeer::IDMETODO, $idmetodo, $comparison);
} }
/** /**
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!--Autogenerated by PropelSchemaReverseTask class.-->
<database name="default" defaultIdMethod="native" namespace="AppBundle\Model"> <database name="default" defaultIdMethod="native" namespace="AppBundle\Model">
<table name="notifica" phpName="Notifica" idMethod="native"> <table name="notifica" phpName="Notifica" idMethod="native">
<column name="id" phpName="Id" type="INTEGER" primaryKey="true" autoIncrement="true" required="true"/> <column name="id" phpName="Id" type="INTEGER" primaryKey="true" autoIncrement="true" required="true"/>
<column name="campana" phpName="Campana" type="INTEGER" required="true"/> <column name="campana" phpName="Campana" type="CLOB" required="true"/>
<column name="telefono" phpName="Telefono" type="VARCHAR" size="20" required="true"/> <column name="telefono" phpName="Telefono" type="VARCHAR" size="20" required="true"/>
<column name="estado" phpName="Estado" type="INTEGER" required="true"/> <column name="estado" phpName="Estado" type="LONGVARCHAR" required="true"/>
<column name="idmetodo" phpName="Idmetodo" type="INTEGER" required="true" defaultValue="0"/>
<vendor type="mysql"> <vendor type="mysql">
<parameter name="Engine" value="MyISAM"/> <parameter name="Engine" value="MyISAM"/>
</vendor> </vendor>
......
...@@ -177,8 +177,22 @@ class EnvioSmsController extends FOSRestController { ...@@ -177,8 +177,22 @@ class EnvioSmsController extends FOSRestController {
'startTime' => $time, 'startTime' => $time,
]); ]);
$estado = '';
$telefono = '';
if ($result['events']) { if ($result['events']) {
$status = json_decode($result['events'][0]['message'], true);
$telefono= $status['delivery']['destination'];
$estado= $status['status'];
$notifica = new Notifica();
$notifica->setCampana($messageId);
$notifica->setTelefono($telefono);
$notifica->setEstado($estado);
$notifica->setIdMetodo(3);
$notifica->save();
return $result; return $result;
} else { } else {
$result = $cloud2->filterLogEvents([ $result = $cloud2->filterLogEvents([
...@@ -187,7 +201,20 @@ class EnvioSmsController extends FOSRestController { ...@@ -187,7 +201,20 @@ class EnvioSmsController extends FOSRestController {
'startTime' => $time, 'startTime' => $time,
]); ]);
$estado = '';
$telefono = '';
if ($result['events']) { if ($result['events']) {
$status = json_decode($result['events'][0]['message'], true);
$telefono= $status['delivery']['destination'];
$estado= $status['status'];
$notifica = new Notifica();
$notifica->setCampana($messageId);
$notifica->setTelefono($telefono);
$notifica->setEstado($estado);
$notifica->setIdMetodo(3);
$notifica->save();
return $result; return $result;
} else { } else {
$resp = array( $resp = array(
...@@ -198,6 +225,8 @@ class EnvioSmsController extends FOSRestController { ...@@ -198,6 +225,8 @@ class EnvioSmsController extends FOSRestController {
return $resp; return $resp;
} }
} }
} }
/** /**
......
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