update model with good namespace for newsletter entity
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace Thelia\Model\Base;
|
||||
|
||||
use \DateTime;
|
||||
use \Exception;
|
||||
use \PDO;
|
||||
use Propel\Runtime\Propel;
|
||||
@@ -15,8 +14,6 @@ use Propel\Runtime\Exception\BadMethodCallException;
|
||||
use Propel\Runtime\Exception\PropelException;
|
||||
use Propel\Runtime\Map\TableMap;
|
||||
use Propel\Runtime\Parser\AbstractParser;
|
||||
use Propel\Runtime\Util\PropelDateTime;
|
||||
use Thelia\Model\Newsletter as ChildNewsletter;
|
||||
use Thelia\Model\NewsletterQuery as ChildNewsletterQuery;
|
||||
use Thelia\Model\Map\NewsletterTableMap;
|
||||
|
||||
@@ -78,24 +75,6 @@ abstract class Newsletter implements ActiveRecordInterface
|
||||
*/
|
||||
protected $lastname;
|
||||
|
||||
/**
|
||||
* The value for the locale field.
|
||||
* @var string
|
||||
*/
|
||||
protected $locale;
|
||||
|
||||
/**
|
||||
* The value for the created_at field.
|
||||
* @var string
|
||||
*/
|
||||
protected $created_at;
|
||||
|
||||
/**
|
||||
* The value for the updated_at field.
|
||||
* @var string
|
||||
*/
|
||||
protected $updated_at;
|
||||
|
||||
/**
|
||||
* Flag to prevent endless save loop, if this object is referenced
|
||||
* by another object which falls in this transaction.
|
||||
@@ -406,57 +385,6 @@ abstract class Newsletter implements ActiveRecordInterface
|
||||
return $this->lastname;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [locale] column value.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getLocale()
|
||||
{
|
||||
|
||||
return $this->locale;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [optionally formatted] temporal [created_at] column value.
|
||||
*
|
||||
*
|
||||
* @param string $format The date/time format string (either date()-style or strftime()-style).
|
||||
* If format is NULL, then the raw \DateTime object will be returned.
|
||||
*
|
||||
* @return mixed Formatted date/time value as string or \DateTime object (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00
|
||||
*
|
||||
* @throws PropelException - if unable to parse/validate the date/time value.
|
||||
*/
|
||||
public function getCreatedAt($format = NULL)
|
||||
{
|
||||
if ($format === null) {
|
||||
return $this->created_at;
|
||||
} else {
|
||||
return $this->created_at instanceof \DateTime ? $this->created_at->format($format) : null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the [optionally formatted] temporal [updated_at] column value.
|
||||
*
|
||||
*
|
||||
* @param string $format The date/time format string (either date()-style or strftime()-style).
|
||||
* If format is NULL, then the raw \DateTime object will be returned.
|
||||
*
|
||||
* @return mixed Formatted date/time value as string or \DateTime object (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00
|
||||
*
|
||||
* @throws PropelException - if unable to parse/validate the date/time value.
|
||||
*/
|
||||
public function getUpdatedAt($format = NULL)
|
||||
{
|
||||
if ($format === null) {
|
||||
return $this->updated_at;
|
||||
} else {
|
||||
return $this->updated_at instanceof \DateTime ? $this->updated_at->format($format) : null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of [id] column.
|
||||
*
|
||||
@@ -541,69 +469,6 @@ abstract class Newsletter implements ActiveRecordInterface
|
||||
return $this;
|
||||
} // setLastname()
|
||||
|
||||
/**
|
||||
* Set the value of [locale] column.
|
||||
*
|
||||
* @param string $v new value
|
||||
* @return \Thelia\Model\Newsletter The current object (for fluent API support)
|
||||
*/
|
||||
public function setLocale($v)
|
||||
{
|
||||
if ($v !== null) {
|
||||
$v = (string) $v;
|
||||
}
|
||||
|
||||
if ($this->locale !== $v) {
|
||||
$this->locale = $v;
|
||||
$this->modifiedColumns[] = NewsletterTableMap::LOCALE;
|
||||
}
|
||||
|
||||
|
||||
return $this;
|
||||
} // setLocale()
|
||||
|
||||
/**
|
||||
* Sets the value of [created_at] column to a normalized version of the date/time value specified.
|
||||
*
|
||||
* @param mixed $v string, integer (timestamp), or \DateTime value.
|
||||
* Empty strings are treated as NULL.
|
||||
* @return \Thelia\Model\Newsletter The current object (for fluent API support)
|
||||
*/
|
||||
public function setCreatedAt($v)
|
||||
{
|
||||
$dt = PropelDateTime::newInstance($v, null, '\DateTime');
|
||||
if ($this->created_at !== null || $dt !== null) {
|
||||
if ($dt !== $this->created_at) {
|
||||
$this->created_at = $dt;
|
||||
$this->modifiedColumns[] = NewsletterTableMap::CREATED_AT;
|
||||
}
|
||||
} // if either are not null
|
||||
|
||||
|
||||
return $this;
|
||||
} // setCreatedAt()
|
||||
|
||||
/**
|
||||
* Sets the value of [updated_at] column to a normalized version of the date/time value specified.
|
||||
*
|
||||
* @param mixed $v string, integer (timestamp), or \DateTime value.
|
||||
* Empty strings are treated as NULL.
|
||||
* @return \Thelia\Model\Newsletter The current object (for fluent API support)
|
||||
*/
|
||||
public function setUpdatedAt($v)
|
||||
{
|
||||
$dt = PropelDateTime::newInstance($v, null, '\DateTime');
|
||||
if ($this->updated_at !== null || $dt !== null) {
|
||||
if ($dt !== $this->updated_at) {
|
||||
$this->updated_at = $dt;
|
||||
$this->modifiedColumns[] = NewsletterTableMap::UPDATED_AT;
|
||||
}
|
||||
} // if either are not null
|
||||
|
||||
|
||||
return $this;
|
||||
} // setUpdatedAt()
|
||||
|
||||
/**
|
||||
* Indicates whether the columns in this object are only set to default values.
|
||||
*
|
||||
@@ -652,21 +517,6 @@ abstract class Newsletter implements ActiveRecordInterface
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : NewsletterTableMap::translateFieldName('Lastname', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->lastname = (null !== $col) ? (string) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : NewsletterTableMap::translateFieldName('Locale', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
$this->locale = (null !== $col) ? (string) $col : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : NewsletterTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
if ($col === '0000-00-00 00:00:00') {
|
||||
$col = null;
|
||||
}
|
||||
$this->created_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
|
||||
|
||||
$col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : NewsletterTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)];
|
||||
if ($col === '0000-00-00 00:00:00') {
|
||||
$col = null;
|
||||
}
|
||||
$this->updated_at = (null !== $col) ? PropelDateTime::newInstance($col, null, '\DateTime') : null;
|
||||
$this->resetModified();
|
||||
|
||||
$this->setNew(false);
|
||||
@@ -675,7 +525,7 @@ abstract class Newsletter implements ActiveRecordInterface
|
||||
$this->ensureConsistency();
|
||||
}
|
||||
|
||||
return $startcol + 7; // 7 = NewsletterTableMap::NUM_HYDRATE_COLUMNS.
|
||||
return $startcol + 4; // 4 = NewsletterTableMap::NUM_HYDRATE_COLUMNS.
|
||||
|
||||
} catch (Exception $e) {
|
||||
throw new PropelException("Error populating \Thelia\Model\Newsletter object", 0, $e);
|
||||
@@ -806,19 +656,8 @@ abstract class Newsletter implements ActiveRecordInterface
|
||||
$ret = $this->preSave($con);
|
||||
if ($isInsert) {
|
||||
$ret = $ret && $this->preInsert($con);
|
||||
// timestampable behavior
|
||||
if (!$this->isColumnModified(NewsletterTableMap::CREATED_AT)) {
|
||||
$this->setCreatedAt(time());
|
||||
}
|
||||
if (!$this->isColumnModified(NewsletterTableMap::UPDATED_AT)) {
|
||||
$this->setUpdatedAt(time());
|
||||
}
|
||||
} else {
|
||||
$ret = $ret && $this->preUpdate($con);
|
||||
// timestampable behavior
|
||||
if ($this->isModified() && !$this->isColumnModified(NewsletterTableMap::UPDATED_AT)) {
|
||||
$this->setUpdatedAt(time());
|
||||
}
|
||||
}
|
||||
if ($ret) {
|
||||
$affectedRows = $this->doSave($con);
|
||||
@@ -907,15 +746,6 @@ abstract class Newsletter implements ActiveRecordInterface
|
||||
if ($this->isColumnModified(NewsletterTableMap::LASTNAME)) {
|
||||
$modifiedColumns[':p' . $index++] = 'LASTNAME';
|
||||
}
|
||||
if ($this->isColumnModified(NewsletterTableMap::LOCALE)) {
|
||||
$modifiedColumns[':p' . $index++] = 'LOCALE';
|
||||
}
|
||||
if ($this->isColumnModified(NewsletterTableMap::CREATED_AT)) {
|
||||
$modifiedColumns[':p' . $index++] = 'CREATED_AT';
|
||||
}
|
||||
if ($this->isColumnModified(NewsletterTableMap::UPDATED_AT)) {
|
||||
$modifiedColumns[':p' . $index++] = 'UPDATED_AT';
|
||||
}
|
||||
|
||||
$sql = sprintf(
|
||||
'INSERT INTO newsletter (%s) VALUES (%s)',
|
||||
@@ -939,15 +769,6 @@ abstract class Newsletter implements ActiveRecordInterface
|
||||
case 'LASTNAME':
|
||||
$stmt->bindValue($identifier, $this->lastname, PDO::PARAM_STR);
|
||||
break;
|
||||
case 'LOCALE':
|
||||
$stmt->bindValue($identifier, $this->locale, PDO::PARAM_STR);
|
||||
break;
|
||||
case 'CREATED_AT':
|
||||
$stmt->bindValue($identifier, $this->created_at ? $this->created_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
|
||||
break;
|
||||
case 'UPDATED_AT':
|
||||
$stmt->bindValue($identifier, $this->updated_at ? $this->updated_at->format("Y-m-d H:i:s") : null, PDO::PARAM_STR);
|
||||
break;
|
||||
}
|
||||
}
|
||||
$stmt->execute();
|
||||
@@ -1022,15 +843,6 @@ abstract class Newsletter implements ActiveRecordInterface
|
||||
case 3:
|
||||
return $this->getLastname();
|
||||
break;
|
||||
case 4:
|
||||
return $this->getLocale();
|
||||
break;
|
||||
case 5:
|
||||
return $this->getCreatedAt();
|
||||
break;
|
||||
case 6:
|
||||
return $this->getUpdatedAt();
|
||||
break;
|
||||
default:
|
||||
return null;
|
||||
break;
|
||||
@@ -1063,9 +875,6 @@ abstract class Newsletter implements ActiveRecordInterface
|
||||
$keys[1] => $this->getEmail(),
|
||||
$keys[2] => $this->getFirstname(),
|
||||
$keys[3] => $this->getLastname(),
|
||||
$keys[4] => $this->getLocale(),
|
||||
$keys[5] => $this->getCreatedAt(),
|
||||
$keys[6] => $this->getUpdatedAt(),
|
||||
);
|
||||
$virtualColumns = $this->virtualColumns;
|
||||
foreach ($virtualColumns as $key => $virtualColumn) {
|
||||
@@ -1117,15 +926,6 @@ abstract class Newsletter implements ActiveRecordInterface
|
||||
case 3:
|
||||
$this->setLastname($value);
|
||||
break;
|
||||
case 4:
|
||||
$this->setLocale($value);
|
||||
break;
|
||||
case 5:
|
||||
$this->setCreatedAt($value);
|
||||
break;
|
||||
case 6:
|
||||
$this->setUpdatedAt($value);
|
||||
break;
|
||||
} // switch()
|
||||
}
|
||||
|
||||
@@ -1154,9 +954,6 @@ abstract class Newsletter implements ActiveRecordInterface
|
||||
if (array_key_exists($keys[1], $arr)) $this->setEmail($arr[$keys[1]]);
|
||||
if (array_key_exists($keys[2], $arr)) $this->setFirstname($arr[$keys[2]]);
|
||||
if (array_key_exists($keys[3], $arr)) $this->setLastname($arr[$keys[3]]);
|
||||
if (array_key_exists($keys[4], $arr)) $this->setLocale($arr[$keys[4]]);
|
||||
if (array_key_exists($keys[5], $arr)) $this->setCreatedAt($arr[$keys[5]]);
|
||||
if (array_key_exists($keys[6], $arr)) $this->setUpdatedAt($arr[$keys[6]]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1172,9 +969,6 @@ abstract class Newsletter implements ActiveRecordInterface
|
||||
if ($this->isColumnModified(NewsletterTableMap::EMAIL)) $criteria->add(NewsletterTableMap::EMAIL, $this->email);
|
||||
if ($this->isColumnModified(NewsletterTableMap::FIRSTNAME)) $criteria->add(NewsletterTableMap::FIRSTNAME, $this->firstname);
|
||||
if ($this->isColumnModified(NewsletterTableMap::LASTNAME)) $criteria->add(NewsletterTableMap::LASTNAME, $this->lastname);
|
||||
if ($this->isColumnModified(NewsletterTableMap::LOCALE)) $criteria->add(NewsletterTableMap::LOCALE, $this->locale);
|
||||
if ($this->isColumnModified(NewsletterTableMap::CREATED_AT)) $criteria->add(NewsletterTableMap::CREATED_AT, $this->created_at);
|
||||
if ($this->isColumnModified(NewsletterTableMap::UPDATED_AT)) $criteria->add(NewsletterTableMap::UPDATED_AT, $this->updated_at);
|
||||
|
||||
return $criteria;
|
||||
}
|
||||
@@ -1241,9 +1035,6 @@ abstract class Newsletter implements ActiveRecordInterface
|
||||
$copyObj->setEmail($this->getEmail());
|
||||
$copyObj->setFirstname($this->getFirstname());
|
||||
$copyObj->setLastname($this->getLastname());
|
||||
$copyObj->setLocale($this->getLocale());
|
||||
$copyObj->setCreatedAt($this->getCreatedAt());
|
||||
$copyObj->setUpdatedAt($this->getUpdatedAt());
|
||||
if ($makeNew) {
|
||||
$copyObj->setNew(true);
|
||||
$copyObj->setId(NULL); // this is a auto-increment column, so set to default value
|
||||
@@ -1281,9 +1072,6 @@ abstract class Newsletter implements ActiveRecordInterface
|
||||
$this->email = null;
|
||||
$this->firstname = null;
|
||||
$this->lastname = null;
|
||||
$this->locale = null;
|
||||
$this->created_at = null;
|
||||
$this->updated_at = null;
|
||||
$this->alreadyInSave = false;
|
||||
$this->clearAllReferences();
|
||||
$this->resetModified();
|
||||
@@ -1317,20 +1105,6 @@ abstract class Newsletter implements ActiveRecordInterface
|
||||
return (string) $this->exportTo(NewsletterTableMap::DEFAULT_STRING_FORMAT);
|
||||
}
|
||||
|
||||
// timestampable behavior
|
||||
|
||||
/**
|
||||
* Mark the current object so that the update date doesn't get updated during next save
|
||||
*
|
||||
* @return ChildNewsletter The current object (for fluent API support)
|
||||
*/
|
||||
public function keepUpdateDateUnchanged()
|
||||
{
|
||||
$this->modifiedColumns[] = NewsletterTableMap::UPDATED_AT;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Code to be run before persisting the object
|
||||
* @param ConnectionInterface $con
|
||||
|
||||
@@ -22,17 +22,11 @@ use Thelia\Model\Map\NewsletterTableMap;
|
||||
* @method ChildNewsletterQuery orderByEmail($order = Criteria::ASC) Order by the email column
|
||||
* @method ChildNewsletterQuery orderByFirstname($order = Criteria::ASC) Order by the firstname column
|
||||
* @method ChildNewsletterQuery orderByLastname($order = Criteria::ASC) Order by the lastname column
|
||||
* @method ChildNewsletterQuery orderByLocale($order = Criteria::ASC) Order by the locale column
|
||||
* @method ChildNewsletterQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
|
||||
* @method ChildNewsletterQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
|
||||
*
|
||||
* @method ChildNewsletterQuery groupById() Group by the id column
|
||||
* @method ChildNewsletterQuery groupByEmail() Group by the email column
|
||||
* @method ChildNewsletterQuery groupByFirstname() Group by the firstname column
|
||||
* @method ChildNewsletterQuery groupByLastname() Group by the lastname column
|
||||
* @method ChildNewsletterQuery groupByLocale() Group by the locale column
|
||||
* @method ChildNewsletterQuery groupByCreatedAt() Group by the created_at column
|
||||
* @method ChildNewsletterQuery groupByUpdatedAt() Group by the updated_at column
|
||||
*
|
||||
* @method ChildNewsletterQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
|
||||
* @method ChildNewsletterQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
|
||||
@@ -45,17 +39,11 @@ use Thelia\Model\Map\NewsletterTableMap;
|
||||
* @method ChildNewsletter findOneByEmail(string $email) Return the first ChildNewsletter filtered by the email column
|
||||
* @method ChildNewsletter findOneByFirstname(string $firstname) Return the first ChildNewsletter filtered by the firstname column
|
||||
* @method ChildNewsletter findOneByLastname(string $lastname) Return the first ChildNewsletter filtered by the lastname column
|
||||
* @method ChildNewsletter findOneByLocale(string $locale) Return the first ChildNewsletter filtered by the locale column
|
||||
* @method ChildNewsletter findOneByCreatedAt(string $created_at) Return the first ChildNewsletter filtered by the created_at column
|
||||
* @method ChildNewsletter findOneByUpdatedAt(string $updated_at) Return the first ChildNewsletter filtered by the updated_at column
|
||||
*
|
||||
* @method array findById(int $id) Return ChildNewsletter objects filtered by the id column
|
||||
* @method array findByEmail(string $email) Return ChildNewsletter objects filtered by the email column
|
||||
* @method array findByFirstname(string $firstname) Return ChildNewsletter objects filtered by the firstname column
|
||||
* @method array findByLastname(string $lastname) Return ChildNewsletter objects filtered by the lastname column
|
||||
* @method array findByLocale(string $locale) Return ChildNewsletter objects filtered by the locale column
|
||||
* @method array findByCreatedAt(string $created_at) Return ChildNewsletter objects filtered by the created_at column
|
||||
* @method array findByUpdatedAt(string $updated_at) Return ChildNewsletter objects filtered by the updated_at column
|
||||
*
|
||||
*/
|
||||
abstract class NewsletterQuery extends ModelCriteria
|
||||
@@ -144,7 +132,7 @@ abstract class NewsletterQuery extends ModelCriteria
|
||||
*/
|
||||
protected function findPkSimple($key, $con)
|
||||
{
|
||||
$sql = 'SELECT ID, EMAIL, FIRSTNAME, LASTNAME, LOCALE, CREATED_AT, UPDATED_AT FROM newsletter WHERE ID = :p0';
|
||||
$sql = 'SELECT ID, EMAIL, FIRSTNAME, LASTNAME FROM newsletter WHERE ID = :p0';
|
||||
try {
|
||||
$stmt = $con->prepare($sql);
|
||||
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
|
||||
@@ -361,121 +349,6 @@ abstract class NewsletterQuery extends ModelCriteria
|
||||
return $this->addUsingAlias(NewsletterTableMap::LASTNAME, $lastname, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the locale column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByLocale('fooValue'); // WHERE locale = 'fooValue'
|
||||
* $query->filterByLocale('%fooValue%'); // WHERE locale LIKE '%fooValue%'
|
||||
* </code>
|
||||
*
|
||||
* @param string $locale 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 ChildNewsletterQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByLocale($locale = null, $comparison = null)
|
||||
{
|
||||
if (null === $comparison) {
|
||||
if (is_array($locale)) {
|
||||
$comparison = Criteria::IN;
|
||||
} elseif (preg_match('/[\%\*]/', $locale)) {
|
||||
$locale = str_replace('*', '%', $locale);
|
||||
$comparison = Criteria::LIKE;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(NewsletterTableMap::LOCALE, $locale, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the created_at column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByCreatedAt('2011-03-14'); // WHERE created_at = '2011-03-14'
|
||||
* $query->filterByCreatedAt('now'); // WHERE created_at = '2011-03-14'
|
||||
* $query->filterByCreatedAt(array('max' => 'yesterday')); // WHERE created_at > '2011-03-13'
|
||||
* </code>
|
||||
*
|
||||
* @param mixed $createdAt The value to use as filter.
|
||||
* Values can be integers (unix timestamps), DateTime objects, or strings.
|
||||
* Empty strings are treated as NULL.
|
||||
* 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 ChildNewsletterQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByCreatedAt($createdAt = null, $comparison = null)
|
||||
{
|
||||
if (is_array($createdAt)) {
|
||||
$useMinMax = false;
|
||||
if (isset($createdAt['min'])) {
|
||||
$this->addUsingAlias(NewsletterTableMap::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($createdAt['max'])) {
|
||||
$this->addUsingAlias(NewsletterTableMap::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(NewsletterTableMap::CREATED_AT, $createdAt, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the query on the updated_at column
|
||||
*
|
||||
* Example usage:
|
||||
* <code>
|
||||
* $query->filterByUpdatedAt('2011-03-14'); // WHERE updated_at = '2011-03-14'
|
||||
* $query->filterByUpdatedAt('now'); // WHERE updated_at = '2011-03-14'
|
||||
* $query->filterByUpdatedAt(array('max' => 'yesterday')); // WHERE updated_at > '2011-03-13'
|
||||
* </code>
|
||||
*
|
||||
* @param mixed $updatedAt The value to use as filter.
|
||||
* Values can be integers (unix timestamps), DateTime objects, or strings.
|
||||
* Empty strings are treated as NULL.
|
||||
* 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 ChildNewsletterQuery The current query, for fluid interface
|
||||
*/
|
||||
public function filterByUpdatedAt($updatedAt = null, $comparison = null)
|
||||
{
|
||||
if (is_array($updatedAt)) {
|
||||
$useMinMax = false;
|
||||
if (isset($updatedAt['min'])) {
|
||||
$this->addUsingAlias(NewsletterTableMap::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if (isset($updatedAt['max'])) {
|
||||
$this->addUsingAlias(NewsletterTableMap::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
|
||||
$useMinMax = true;
|
||||
}
|
||||
if ($useMinMax) {
|
||||
return $this;
|
||||
}
|
||||
if (null === $comparison) {
|
||||
$comparison = Criteria::IN;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->addUsingAlias(NewsletterTableMap::UPDATED_AT, $updatedAt, $comparison);
|
||||
}
|
||||
|
||||
/**
|
||||
* Exclude object from result
|
||||
*
|
||||
@@ -567,70 +440,4 @@ abstract class NewsletterQuery extends ModelCriteria
|
||||
}
|
||||
}
|
||||
|
||||
// timestampable behavior
|
||||
|
||||
/**
|
||||
* Filter by the latest updated
|
||||
*
|
||||
* @param int $nbDays Maximum age of the latest update in days
|
||||
*
|
||||
* @return ChildNewsletterQuery The current query, for fluid interface
|
||||
*/
|
||||
public function recentlyUpdated($nbDays = 7)
|
||||
{
|
||||
return $this->addUsingAlias(NewsletterTableMap::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter by the latest created
|
||||
*
|
||||
* @param int $nbDays Maximum age of in days
|
||||
*
|
||||
* @return ChildNewsletterQuery The current query, for fluid interface
|
||||
*/
|
||||
public function recentlyCreated($nbDays = 7)
|
||||
{
|
||||
return $this->addUsingAlias(NewsletterTableMap::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Order by update date desc
|
||||
*
|
||||
* @return ChildNewsletterQuery The current query, for fluid interface
|
||||
*/
|
||||
public function lastUpdatedFirst()
|
||||
{
|
||||
return $this->addDescendingOrderByColumn(NewsletterTableMap::UPDATED_AT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Order by update date asc
|
||||
*
|
||||
* @return ChildNewsletterQuery The current query, for fluid interface
|
||||
*/
|
||||
public function firstUpdatedFirst()
|
||||
{
|
||||
return $this->addAscendingOrderByColumn(NewsletterTableMap::UPDATED_AT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Order by create date desc
|
||||
*
|
||||
* @return ChildNewsletterQuery The current query, for fluid interface
|
||||
*/
|
||||
public function lastCreatedFirst()
|
||||
{
|
||||
return $this->addDescendingOrderByColumn(NewsletterTableMap::CREATED_AT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Order by create date asc
|
||||
*
|
||||
* @return ChildNewsletterQuery The current query, for fluid interface
|
||||
*/
|
||||
public function firstCreatedFirst()
|
||||
{
|
||||
return $this->addAscendingOrderByColumn(NewsletterTableMap::CREATED_AT);
|
||||
}
|
||||
|
||||
} // NewsletterQuery
|
||||
|
||||
@@ -57,7 +57,7 @@ class NewsletterTableMap extends TableMap
|
||||
/**
|
||||
* The total number of columns
|
||||
*/
|
||||
const NUM_COLUMNS = 7;
|
||||
const NUM_COLUMNS = 4;
|
||||
|
||||
/**
|
||||
* The number of lazy-loaded columns
|
||||
@@ -67,7 +67,7 @@ class NewsletterTableMap extends TableMap
|
||||
/**
|
||||
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
|
||||
*/
|
||||
const NUM_HYDRATE_COLUMNS = 7;
|
||||
const NUM_HYDRATE_COLUMNS = 4;
|
||||
|
||||
/**
|
||||
* the column name for the ID field
|
||||
@@ -89,21 +89,6 @@ class NewsletterTableMap extends TableMap
|
||||
*/
|
||||
const LASTNAME = 'newsletter.LASTNAME';
|
||||
|
||||
/**
|
||||
* the column name for the LOCALE field
|
||||
*/
|
||||
const LOCALE = 'newsletter.LOCALE';
|
||||
|
||||
/**
|
||||
* the column name for the CREATED_AT field
|
||||
*/
|
||||
const CREATED_AT = 'newsletter.CREATED_AT';
|
||||
|
||||
/**
|
||||
* the column name for the UPDATED_AT field
|
||||
*/
|
||||
const UPDATED_AT = 'newsletter.UPDATED_AT';
|
||||
|
||||
/**
|
||||
* The default string format for model objects of the related table
|
||||
*/
|
||||
@@ -116,12 +101,12 @@ class NewsletterTableMap extends TableMap
|
||||
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
||||
*/
|
||||
protected static $fieldNames = array (
|
||||
self::TYPE_PHPNAME => array('Id', 'Email', 'Firstname', 'Lastname', 'Locale', 'CreatedAt', 'UpdatedAt', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id', 'email', 'firstname', 'lastname', 'locale', 'createdAt', 'updatedAt', ),
|
||||
self::TYPE_COLNAME => array(NewsletterTableMap::ID, NewsletterTableMap::EMAIL, NewsletterTableMap::FIRSTNAME, NewsletterTableMap::LASTNAME, NewsletterTableMap::LOCALE, NewsletterTableMap::CREATED_AT, NewsletterTableMap::UPDATED_AT, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID', 'EMAIL', 'FIRSTNAME', 'LASTNAME', 'LOCALE', 'CREATED_AT', 'UPDATED_AT', ),
|
||||
self::TYPE_FIELDNAME => array('id', 'email', 'firstname', 'lastname', 'locale', 'created_at', 'updated_at', ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, )
|
||||
self::TYPE_PHPNAME => array('Id', 'Email', 'Firstname', 'Lastname', ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id', 'email', 'firstname', 'lastname', ),
|
||||
self::TYPE_COLNAME => array(NewsletterTableMap::ID, NewsletterTableMap::EMAIL, NewsletterTableMap::FIRSTNAME, NewsletterTableMap::LASTNAME, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID', 'EMAIL', 'FIRSTNAME', 'LASTNAME', ),
|
||||
self::TYPE_FIELDNAME => array('id', 'email', 'firstname', 'lastname', ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, )
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -131,12 +116,12 @@ class NewsletterTableMap extends TableMap
|
||||
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
|
||||
*/
|
||||
protected static $fieldKeys = array (
|
||||
self::TYPE_PHPNAME => array('Id' => 0, 'Email' => 1, 'Firstname' => 2, 'Lastname' => 3, 'Locale' => 4, 'CreatedAt' => 5, 'UpdatedAt' => 6, ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'email' => 1, 'firstname' => 2, 'lastname' => 3, 'locale' => 4, 'createdAt' => 5, 'updatedAt' => 6, ),
|
||||
self::TYPE_COLNAME => array(NewsletterTableMap::ID => 0, NewsletterTableMap::EMAIL => 1, NewsletterTableMap::FIRSTNAME => 2, NewsletterTableMap::LASTNAME => 3, NewsletterTableMap::LOCALE => 4, NewsletterTableMap::CREATED_AT => 5, NewsletterTableMap::UPDATED_AT => 6, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID' => 0, 'EMAIL' => 1, 'FIRSTNAME' => 2, 'LASTNAME' => 3, 'LOCALE' => 4, 'CREATED_AT' => 5, 'UPDATED_AT' => 6, ),
|
||||
self::TYPE_FIELDNAME => array('id' => 0, 'email' => 1, 'firstname' => 2, 'lastname' => 3, 'locale' => 4, 'created_at' => 5, 'updated_at' => 6, ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, 6, )
|
||||
self::TYPE_PHPNAME => array('Id' => 0, 'Email' => 1, 'Firstname' => 2, 'Lastname' => 3, ),
|
||||
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'email' => 1, 'firstname' => 2, 'lastname' => 3, ),
|
||||
self::TYPE_COLNAME => array(NewsletterTableMap::ID => 0, NewsletterTableMap::EMAIL => 1, NewsletterTableMap::FIRSTNAME => 2, NewsletterTableMap::LASTNAME => 3, ),
|
||||
self::TYPE_RAW_COLNAME => array('ID' => 0, 'EMAIL' => 1, 'FIRSTNAME' => 2, 'LASTNAME' => 3, ),
|
||||
self::TYPE_FIELDNAME => array('id' => 0, 'email' => 1, 'firstname' => 2, 'lastname' => 3, ),
|
||||
self::TYPE_NUM => array(0, 1, 2, 3, )
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -159,9 +144,6 @@ class NewsletterTableMap extends TableMap
|
||||
$this->addColumn('EMAIL', 'Email', 'VARCHAR', true, 255, null);
|
||||
$this->addColumn('FIRSTNAME', 'Firstname', 'VARCHAR', false, 255, null);
|
||||
$this->addColumn('LASTNAME', 'Lastname', 'VARCHAR', false, 255, null);
|
||||
$this->addColumn('LOCALE', 'Locale', 'VARCHAR', false, 45, null);
|
||||
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
|
||||
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
|
||||
} // initialize()
|
||||
|
||||
/**
|
||||
@@ -171,19 +153,6 @@ class NewsletterTableMap extends TableMap
|
||||
{
|
||||
} // buildRelations()
|
||||
|
||||
/**
|
||||
*
|
||||
* Gets the list of behaviors registered for this table
|
||||
*
|
||||
* @return array Associative array (name => parameters) of behaviors
|
||||
*/
|
||||
public function getBehaviors()
|
||||
{
|
||||
return array(
|
||||
'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', ),
|
||||
);
|
||||
} // getBehaviors()
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
@@ -326,17 +295,11 @@ class NewsletterTableMap extends TableMap
|
||||
$criteria->addSelectColumn(NewsletterTableMap::EMAIL);
|
||||
$criteria->addSelectColumn(NewsletterTableMap::FIRSTNAME);
|
||||
$criteria->addSelectColumn(NewsletterTableMap::LASTNAME);
|
||||
$criteria->addSelectColumn(NewsletterTableMap::LOCALE);
|
||||
$criteria->addSelectColumn(NewsletterTableMap::CREATED_AT);
|
||||
$criteria->addSelectColumn(NewsletterTableMap::UPDATED_AT);
|
||||
} else {
|
||||
$criteria->addSelectColumn($alias . '.ID');
|
||||
$criteria->addSelectColumn($alias . '.EMAIL');
|
||||
$criteria->addSelectColumn($alias . '.FIRSTNAME');
|
||||
$criteria->addSelectColumn($alias . '.LASTNAME');
|
||||
$criteria->addSelectColumn($alias . '.LOCALE');
|
||||
$criteria->addSelectColumn($alias . '.CREATED_AT');
|
||||
$criteria->addSelectColumn($alias . '.UPDATED_AT');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user