Add timestampable behavior in import_export_type

modifié:         core/lib/Thelia/Model/Base/ImportExportType.php
	modifié:         core/lib/Thelia/Model/Base/ImportExportTypeQuery.php
	modifié:         core/lib/Thelia/Model/Map/ImportExportTypeTableMap.php
	modifié:         local/config/schema.xml
	modifié:         setup/thelia.sql
This commit is contained in:
Benjamin Perche
2014-07-09 16:01:16 +02:00
parent d1f5087d00
commit 5a6ede991b
5 changed files with 363 additions and 16 deletions

View File

@@ -2,6 +2,7 @@
namespace Thelia\Model\Base;
use \DateTime;
use \Exception;
use \PDO;
use Propel\Runtime\Propel;
@@ -15,6 +16,7 @@ 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\ImportExportCategory as ChildImportExportCategory;
use Thelia\Model\ImportExportCategoryQuery as ChildImportExportCategoryQuery;
use Thelia\Model\ImportExportType as ChildImportExportType;
@@ -75,6 +77,18 @@ abstract class ImportExportType implements ActiveRecordInterface
*/
protected $import_export_category_id;
/**
* The value for the created_at field.
* @var string
*/
protected $created_at;
/**
* The value for the updated_at field.
* @var string
*/
protected $updated_at;
/**
* @var ImportExportCategory
*/
@@ -405,6 +419,46 @@ abstract class ImportExportType implements ActiveRecordInterface
return $this->import_export_category_id;
}
/**
* 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.
*
@@ -472,6 +526,48 @@ abstract class ImportExportType implements ActiveRecordInterface
return $this;
} // setImportExportCategoryId()
/**
* 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\ImportExportType 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[ImportExportTypeTableMap::CREATED_AT] = true;
}
} // 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\ImportExportType 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[ImportExportTypeTableMap::UPDATED_AT] = true;
}
} // if either are not null
return $this;
} // setUpdatedAt()
/**
* Indicates whether the columns in this object are only set to default values.
*
@@ -517,6 +613,18 @@ abstract class ImportExportType implements ActiveRecordInterface
$col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : ImportExportTypeTableMap::translateFieldName('ImportExportCategoryId', TableMap::TYPE_PHPNAME, $indexType)];
$this->import_export_category_id = (null !== $col) ? (int) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : ImportExportTypeTableMap::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 ? 4 + $startcol : ImportExportTypeTableMap::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);
@@ -525,7 +633,7 @@ abstract class ImportExportType implements ActiveRecordInterface
$this->ensureConsistency();
}
return $startcol + 3; // 3 = ImportExportTypeTableMap::NUM_HYDRATE_COLUMNS.
return $startcol + 5; // 5 = ImportExportTypeTableMap::NUM_HYDRATE_COLUMNS.
} catch (Exception $e) {
throw new PropelException("Error populating \Thelia\Model\ImportExportType object", 0, $e);
@@ -662,8 +770,19 @@ abstract class ImportExportType implements ActiveRecordInterface
$ret = $this->preSave($con);
if ($isInsert) {
$ret = $ret && $this->preInsert($con);
// timestampable behavior
if (!$this->isColumnModified(ImportExportTypeTableMap::CREATED_AT)) {
$this->setCreatedAt(time());
}
if (!$this->isColumnModified(ImportExportTypeTableMap::UPDATED_AT)) {
$this->setUpdatedAt(time());
}
} else {
$ret = $ret && $this->preUpdate($con);
// timestampable behavior
if ($this->isModified() && !$this->isColumnModified(ImportExportTypeTableMap::UPDATED_AT)) {
$this->setUpdatedAt(time());
}
}
if ($ret) {
$affectedRows = $this->doSave($con);
@@ -778,6 +897,12 @@ abstract class ImportExportType implements ActiveRecordInterface
if ($this->isColumnModified(ImportExportTypeTableMap::IMPORT_EXPORT_CATEGORY_ID)) {
$modifiedColumns[':p' . $index++] = '`IMPORT_EXPORT_CATEGORY_ID`';
}
if ($this->isColumnModified(ImportExportTypeTableMap::CREATED_AT)) {
$modifiedColumns[':p' . $index++] = '`CREATED_AT`';
}
if ($this->isColumnModified(ImportExportTypeTableMap::UPDATED_AT)) {
$modifiedColumns[':p' . $index++] = '`UPDATED_AT`';
}
$sql = sprintf(
'INSERT INTO `import_export_type` (%s) VALUES (%s)',
@@ -798,6 +923,12 @@ abstract class ImportExportType implements ActiveRecordInterface
case '`IMPORT_EXPORT_CATEGORY_ID`':
$stmt->bindValue($identifier, $this->import_export_category_id, PDO::PARAM_INT);
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();
@@ -869,6 +1000,12 @@ abstract class ImportExportType implements ActiveRecordInterface
case 2:
return $this->getImportExportCategoryId();
break;
case 3:
return $this->getCreatedAt();
break;
case 4:
return $this->getUpdatedAt();
break;
default:
return null;
break;
@@ -901,6 +1038,8 @@ abstract class ImportExportType implements ActiveRecordInterface
$keys[0] => $this->getId(),
$keys[1] => $this->getUrlAction(),
$keys[2] => $this->getImportExportCategoryId(),
$keys[3] => $this->getCreatedAt(),
$keys[4] => $this->getUpdatedAt(),
);
$virtualColumns = $this->virtualColumns;
foreach ($virtualColumns as $key => $virtualColumn) {
@@ -957,6 +1096,12 @@ abstract class ImportExportType implements ActiveRecordInterface
case 2:
$this->setImportExportCategoryId($value);
break;
case 3:
$this->setCreatedAt($value);
break;
case 4:
$this->setUpdatedAt($value);
break;
} // switch()
}
@@ -984,6 +1129,8 @@ abstract class ImportExportType implements ActiveRecordInterface
if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
if (array_key_exists($keys[1], $arr)) $this->setUrlAction($arr[$keys[1]]);
if (array_key_exists($keys[2], $arr)) $this->setImportExportCategoryId($arr[$keys[2]]);
if (array_key_exists($keys[3], $arr)) $this->setCreatedAt($arr[$keys[3]]);
if (array_key_exists($keys[4], $arr)) $this->setUpdatedAt($arr[$keys[4]]);
}
/**
@@ -998,6 +1145,8 @@ abstract class ImportExportType implements ActiveRecordInterface
if ($this->isColumnModified(ImportExportTypeTableMap::ID)) $criteria->add(ImportExportTypeTableMap::ID, $this->id);
if ($this->isColumnModified(ImportExportTypeTableMap::URL_ACTION)) $criteria->add(ImportExportTypeTableMap::URL_ACTION, $this->url_action);
if ($this->isColumnModified(ImportExportTypeTableMap::IMPORT_EXPORT_CATEGORY_ID)) $criteria->add(ImportExportTypeTableMap::IMPORT_EXPORT_CATEGORY_ID, $this->import_export_category_id);
if ($this->isColumnModified(ImportExportTypeTableMap::CREATED_AT)) $criteria->add(ImportExportTypeTableMap::CREATED_AT, $this->created_at);
if ($this->isColumnModified(ImportExportTypeTableMap::UPDATED_AT)) $criteria->add(ImportExportTypeTableMap::UPDATED_AT, $this->updated_at);
return $criteria;
}
@@ -1063,6 +1212,8 @@ abstract class ImportExportType implements ActiveRecordInterface
{
$copyObj->setUrlAction($this->getUrlAction());
$copyObj->setImportExportCategoryId($this->getImportExportCategoryId());
$copyObj->setCreatedAt($this->getCreatedAt());
$copyObj->setUpdatedAt($this->getUpdatedAt());
if ($deepCopy) {
// important: temporarily setNew(false) because this affects the behavior of
@@ -1405,6 +1556,8 @@ abstract class ImportExportType implements ActiveRecordInterface
$this->id = null;
$this->url_action = null;
$this->import_export_category_id = null;
$this->created_at = null;
$this->updated_at = null;
$this->alreadyInSave = false;
$this->clearAllReferences();
$this->resetModified();
@@ -1596,6 +1749,20 @@ abstract class ImportExportType implements ActiveRecordInterface
return $this;
}
// timestampable behavior
/**
* Mark the current object so that the update date doesn't get updated during next save
*
* @return ChildImportExportType The current object (for fluent API support)
*/
public function keepUpdateDateUnchanged()
{
$this->modifiedColumns[ImportExportTypeTableMap::UPDATED_AT] = true;
return $this;
}
/**
* Code to be run before persisting the object
* @param ConnectionInterface $con

View File

@@ -25,10 +25,14 @@ use Thelia\Model\Map\ImportExportTypeTableMap;
* @method ChildImportExportTypeQuery orderById($order = Criteria::ASC) Order by the id column
* @method ChildImportExportTypeQuery orderByUrlAction($order = Criteria::ASC) Order by the url_action column
* @method ChildImportExportTypeQuery orderByImportExportCategoryId($order = Criteria::ASC) Order by the import_export_category_id column
* @method ChildImportExportTypeQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column
* @method ChildImportExportTypeQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column
*
* @method ChildImportExportTypeQuery groupById() Group by the id column
* @method ChildImportExportTypeQuery groupByUrlAction() Group by the url_action column
* @method ChildImportExportTypeQuery groupByImportExportCategoryId() Group by the import_export_category_id column
* @method ChildImportExportTypeQuery groupByCreatedAt() Group by the created_at column
* @method ChildImportExportTypeQuery groupByUpdatedAt() Group by the updated_at column
*
* @method ChildImportExportTypeQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ChildImportExportTypeQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
@@ -48,10 +52,14 @@ use Thelia\Model\Map\ImportExportTypeTableMap;
* @method ChildImportExportType findOneById(int $id) Return the first ChildImportExportType filtered by the id column
* @method ChildImportExportType findOneByUrlAction(string $url_action) Return the first ChildImportExportType filtered by the url_action column
* @method ChildImportExportType findOneByImportExportCategoryId(int $import_export_category_id) Return the first ChildImportExportType filtered by the import_export_category_id column
* @method ChildImportExportType findOneByCreatedAt(string $created_at) Return the first ChildImportExportType filtered by the created_at column
* @method ChildImportExportType findOneByUpdatedAt(string $updated_at) Return the first ChildImportExportType filtered by the updated_at column
*
* @method array findById(int $id) Return ChildImportExportType objects filtered by the id column
* @method array findByUrlAction(string $url_action) Return ChildImportExportType objects filtered by the url_action column
* @method array findByImportExportCategoryId(int $import_export_category_id) Return ChildImportExportType objects filtered by the import_export_category_id column
* @method array findByCreatedAt(string $created_at) Return ChildImportExportType objects filtered by the created_at column
* @method array findByUpdatedAt(string $updated_at) Return ChildImportExportType objects filtered by the updated_at column
*
*/
abstract class ImportExportTypeQuery extends ModelCriteria
@@ -140,7 +148,7 @@ abstract class ImportExportTypeQuery extends ModelCriteria
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT `ID`, `URL_ACTION`, `IMPORT_EXPORT_CATEGORY_ID` FROM `import_export_type` WHERE `ID` = :p0';
$sql = 'SELECT `ID`, `URL_ACTION`, `IMPORT_EXPORT_CATEGORY_ID`, `CREATED_AT`, `UPDATED_AT` FROM `import_export_type` WHERE `ID` = :p0';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key, PDO::PARAM_INT);
@@ -342,6 +350,92 @@ abstract class ImportExportTypeQuery extends ModelCriteria
return $this->addUsingAlias(ImportExportTypeTableMap::IMPORT_EXPORT_CATEGORY_ID, $importExportCategoryId, $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 ChildImportExportTypeQuery 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(ImportExportTypeTableMap::CREATED_AT, $createdAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($createdAt['max'])) {
$this->addUsingAlias(ImportExportTypeTableMap::CREATED_AT, $createdAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(ImportExportTypeTableMap::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 ChildImportExportTypeQuery 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(ImportExportTypeTableMap::UPDATED_AT, $updatedAt['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($updatedAt['max'])) {
$this->addUsingAlias(ImportExportTypeTableMap::UPDATED_AT, $updatedAt['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(ImportExportTypeTableMap::UPDATED_AT, $updatedAt, $comparison);
}
/**
* Filter the query by a related \Thelia\Model\ImportExportCategory object
*
@@ -638,4 +732,70 @@ abstract class ImportExportTypeQuery extends ModelCriteria
->useQuery($relationAlias ? $relationAlias : 'ImportExportTypeI18n', '\Thelia\Model\ImportExportTypeI18nQuery');
}
// timestampable behavior
/**
* Filter by the latest updated
*
* @param int $nbDays Maximum age of the latest update in days
*
* @return ChildImportExportTypeQuery The current query, for fluid interface
*/
public function recentlyUpdated($nbDays = 7)
{
return $this->addUsingAlias(ImportExportTypeTableMap::UPDATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
}
/**
* Filter by the latest created
*
* @param int $nbDays Maximum age of in days
*
* @return ChildImportExportTypeQuery The current query, for fluid interface
*/
public function recentlyCreated($nbDays = 7)
{
return $this->addUsingAlias(ImportExportTypeTableMap::CREATED_AT, time() - $nbDays * 24 * 60 * 60, Criteria::GREATER_EQUAL);
}
/**
* Order by update date desc
*
* @return ChildImportExportTypeQuery The current query, for fluid interface
*/
public function lastUpdatedFirst()
{
return $this->addDescendingOrderByColumn(ImportExportTypeTableMap::UPDATED_AT);
}
/**
* Order by update date asc
*
* @return ChildImportExportTypeQuery The current query, for fluid interface
*/
public function firstUpdatedFirst()
{
return $this->addAscendingOrderByColumn(ImportExportTypeTableMap::UPDATED_AT);
}
/**
* Order by create date desc
*
* @return ChildImportExportTypeQuery The current query, for fluid interface
*/
public function lastCreatedFirst()
{
return $this->addDescendingOrderByColumn(ImportExportTypeTableMap::CREATED_AT);
}
/**
* Order by create date asc
*
* @return ChildImportExportTypeQuery The current query, for fluid interface
*/
public function firstCreatedFirst()
{
return $this->addAscendingOrderByColumn(ImportExportTypeTableMap::CREATED_AT);
}
} // ImportExportTypeQuery

View File

@@ -58,7 +58,7 @@ class ImportExportTypeTableMap extends TableMap
/**
* The total number of columns
*/
const NUM_COLUMNS = 3;
const NUM_COLUMNS = 5;
/**
* The number of lazy-loaded columns
@@ -68,7 +68,7 @@ class ImportExportTypeTableMap extends TableMap
/**
* The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS)
*/
const NUM_HYDRATE_COLUMNS = 3;
const NUM_HYDRATE_COLUMNS = 5;
/**
* the column name for the ID field
@@ -85,6 +85,16 @@ class ImportExportTypeTableMap extends TableMap
*/
const IMPORT_EXPORT_CATEGORY_ID = 'import_export_type.IMPORT_EXPORT_CATEGORY_ID';
/**
* the column name for the CREATED_AT field
*/
const CREATED_AT = 'import_export_type.CREATED_AT';
/**
* the column name for the UPDATED_AT field
*/
const UPDATED_AT = 'import_export_type.UPDATED_AT';
/**
* The default string format for model objects of the related table
*/
@@ -106,12 +116,12 @@ class ImportExportTypeTableMap extends TableMap
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
protected static $fieldNames = array (
self::TYPE_PHPNAME => array('Id', 'UrlAction', 'ImportExportCategoryId', ),
self::TYPE_STUDLYPHPNAME => array('id', 'urlAction', 'importExportCategoryId', ),
self::TYPE_COLNAME => array(ImportExportTypeTableMap::ID, ImportExportTypeTableMap::URL_ACTION, ImportExportTypeTableMap::IMPORT_EXPORT_CATEGORY_ID, ),
self::TYPE_RAW_COLNAME => array('ID', 'URL_ACTION', 'IMPORT_EXPORT_CATEGORY_ID', ),
self::TYPE_FIELDNAME => array('id', 'url_action', 'import_export_category_id', ),
self::TYPE_NUM => array(0, 1, 2, )
self::TYPE_PHPNAME => array('Id', 'UrlAction', 'ImportExportCategoryId', 'CreatedAt', 'UpdatedAt', ),
self::TYPE_STUDLYPHPNAME => array('id', 'urlAction', 'importExportCategoryId', 'createdAt', 'updatedAt', ),
self::TYPE_COLNAME => array(ImportExportTypeTableMap::ID, ImportExportTypeTableMap::URL_ACTION, ImportExportTypeTableMap::IMPORT_EXPORT_CATEGORY_ID, ImportExportTypeTableMap::CREATED_AT, ImportExportTypeTableMap::UPDATED_AT, ),
self::TYPE_RAW_COLNAME => array('ID', 'URL_ACTION', 'IMPORT_EXPORT_CATEGORY_ID', 'CREATED_AT', 'UPDATED_AT', ),
self::TYPE_FIELDNAME => array('id', 'url_action', 'import_export_category_id', 'created_at', 'updated_at', ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, )
);
/**
@@ -121,12 +131,12 @@ class ImportExportTypeTableMap extends TableMap
* e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0
*/
protected static $fieldKeys = array (
self::TYPE_PHPNAME => array('Id' => 0, 'UrlAction' => 1, 'ImportExportCategoryId' => 2, ),
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'urlAction' => 1, 'importExportCategoryId' => 2, ),
self::TYPE_COLNAME => array(ImportExportTypeTableMap::ID => 0, ImportExportTypeTableMap::URL_ACTION => 1, ImportExportTypeTableMap::IMPORT_EXPORT_CATEGORY_ID => 2, ),
self::TYPE_RAW_COLNAME => array('ID' => 0, 'URL_ACTION' => 1, 'IMPORT_EXPORT_CATEGORY_ID' => 2, ),
self::TYPE_FIELDNAME => array('id' => 0, 'url_action' => 1, 'import_export_category_id' => 2, ),
self::TYPE_NUM => array(0, 1, 2, )
self::TYPE_PHPNAME => array('Id' => 0, 'UrlAction' => 1, 'ImportExportCategoryId' => 2, 'CreatedAt' => 3, 'UpdatedAt' => 4, ),
self::TYPE_STUDLYPHPNAME => array('id' => 0, 'urlAction' => 1, 'importExportCategoryId' => 2, 'createdAt' => 3, 'updatedAt' => 4, ),
self::TYPE_COLNAME => array(ImportExportTypeTableMap::ID => 0, ImportExportTypeTableMap::URL_ACTION => 1, ImportExportTypeTableMap::IMPORT_EXPORT_CATEGORY_ID => 2, ImportExportTypeTableMap::CREATED_AT => 3, ImportExportTypeTableMap::UPDATED_AT => 4, ),
self::TYPE_RAW_COLNAME => array('ID' => 0, 'URL_ACTION' => 1, 'IMPORT_EXPORT_CATEGORY_ID' => 2, 'CREATED_AT' => 3, 'UPDATED_AT' => 4, ),
self::TYPE_FIELDNAME => array('id' => 0, 'url_action' => 1, 'import_export_category_id' => 2, 'created_at' => 3, 'updated_at' => 4, ),
self::TYPE_NUM => array(0, 1, 2, 3, 4, )
);
/**
@@ -148,6 +158,8 @@ class ImportExportTypeTableMap extends TableMap
$this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null);
$this->addColumn('URL_ACTION', 'UrlAction', 'VARCHAR', true, 255, null);
$this->addForeignKey('IMPORT_EXPORT_CATEGORY_ID', 'ImportExportCategoryId', 'INTEGER', 'import_export_category', 'ID', true, null, null);
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
} // initialize()
/**
@@ -169,6 +181,7 @@ class ImportExportTypeTableMap extends TableMap
{
return array(
'i18n' => array('i18n_table' => '%TABLE%_i18n', 'i18n_phpname' => '%PHPNAME%I18n', 'i18n_columns' => 'title, description', 'locale_column' => 'locale', 'locale_length' => '5', 'default_locale' => '', 'locale_alias' => '', ),
'timestampable' => array('create_column' => 'created_at', 'update_column' => 'updated_at', ),
);
} // getBehaviors()
/**
@@ -322,10 +335,14 @@ class ImportExportTypeTableMap extends TableMap
$criteria->addSelectColumn(ImportExportTypeTableMap::ID);
$criteria->addSelectColumn(ImportExportTypeTableMap::URL_ACTION);
$criteria->addSelectColumn(ImportExportTypeTableMap::IMPORT_EXPORT_CATEGORY_ID);
$criteria->addSelectColumn(ImportExportTypeTableMap::CREATED_AT);
$criteria->addSelectColumn(ImportExportTypeTableMap::UPDATED_AT);
} else {
$criteria->addSelectColumn($alias . '.ID');
$criteria->addSelectColumn($alias . '.URL_ACTION');
$criteria->addSelectColumn($alias . '.IMPORT_EXPORT_CATEGORY_ID');
$criteria->addSelectColumn($alias . '.CREATED_AT');
$criteria->addSelectColumn($alias . '.UPDATED_AT');
}
}

View File

@@ -1536,5 +1536,6 @@
<behavior name="i18n">
<parameter name="i18n_columns" value="title, description" />
</behavior>
<behavior name="timestampable" />
</table>
</database>

View File

@@ -1899,6 +1899,8 @@ CREATE TABLE `import_export_type`
`id` INTEGER NOT NULL AUTO_INCREMENT,
`url_action` VARCHAR(255) NOT NULL,
`import_export_category_id` INTEGER NOT NULL,
`created_at` DATETIME,
`updated_at` DATETIME,
PRIMARY KEY (`id`),
INDEX `idx_import_export_type_import_export_category_id` (`import_export_category_id`),
CONSTRAINT `fk_import_export_type_import_export_category_id`