From f0e6d9368234c8f8af7453fa5f5f055b6f4152a7 Mon Sep 17 00:00:00 2001 From: Franck Allimant Date: Wed, 9 Nov 2022 17:46:01 +0100 Subject: [PATCH] Fix invalid model files (for pre-2.4 Thelias) --- Config/module.xml | 4 +- Model/Base/Selection.php | 105 ++++++++++++++++++++--- Model/Base/SelectionContainer.php | 105 ++++++++++++++++++++--- Model/Base/SelectionContainerQuery.php | 35 +++++++- Model/Base/SelectionQuery.php | 35 +++++++- Model/Map/SelectionContainerTableMap.php | 38 ++++---- Model/Map/SelectionTableMap.php | 38 ++++---- 7 files changed, 298 insertions(+), 62 deletions(-) diff --git a/Config/module.xml b/Config/module.xml index 6c731c3..e7b59f3 100644 --- a/Config/module.xml +++ b/Config/module.xml @@ -13,7 +13,7 @@ en_US fr_FR - 1.1.19 + 1.1.20 Maxime BRUCHET @@ -27,6 +27,6 @@ classic - 2.3.4 + 2.3.0 other diff --git a/Model/Base/Selection.php b/Model/Base/Selection.php index 9a16b1b..af40ede 100644 --- a/Model/Base/Selection.php +++ b/Model/Base/Selection.php @@ -73,10 +73,17 @@ abstract class Selection implements ActiveRecordInterface /** * The value for the visible field. + * Note: this column has a database default value of: 0 * @var int */ protected $visible; + /** + * The value for the code field. + * @var string + */ + protected $code; + /** * The value for the position field. * @var int @@ -177,11 +184,24 @@ abstract class Selection implements ActiveRecordInterface */ protected $selectionI18nsScheduledForDeletion = null; + /** + * Applies default values to this object. + * This method should be called from the object's constructor (or + * equivalent initialization method). + * @see __construct() + */ + public function applyDefaultValues() + { + $this->visible = 0; + } + /** * Initializes internal state of Selection\Model\Base\Selection object. + * @see applyDefaults() */ public function __construct() { + $this->applyDefaultValues(); } /** @@ -457,6 +477,17 @@ public function getVisible() return $this->visible; } + /** + * Get the [code] column value. + * + * @return string + */ + public function getCode() + { + + return $this->code; + } + /** * Get the [position] column value. * @@ -550,6 +581,27 @@ public function setVisible($v) return $this; } // setVisible() + /** + * Set the value of [code] column. + * + * @param string $v new value + * @return \Selection\Model\Selection The current object (for fluent API support) + */ + public function setCode($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->code !== $v) { + $this->code = $v; + $this->modifiedColumns[SelectionTableMap::CODE] = true; + } + + + return $this; + } // setCode() + /** * Set the value of [position] column. * @@ -623,6 +675,10 @@ public function setUpdatedAt($v) */ public function hasOnlyDefaultValues() { + if ($this->visible !== 0) { + return false; + } + // otherwise, everything was equal, so return TRUE return true; } // hasOnlyDefaultValues() @@ -656,16 +712,19 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : SelectionTableMap::translateFieldName('Visible', TableMap::TYPE_PHPNAME, $indexType)]; $this->visible = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : SelectionTableMap::translateFieldName('Position', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : SelectionTableMap::translateFieldName('Code', TableMap::TYPE_PHPNAME, $indexType)]; + $this->code = (null !== $col) ? (string) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : SelectionTableMap::translateFieldName('Position', TableMap::TYPE_PHPNAME, $indexType)]; $this->position = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : SelectionTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : SelectionTableMap::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 : SelectionTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : SelectionTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; if ($col === '0000-00-00 00:00:00') { $col = null; } @@ -678,7 +737,7 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta $this->ensureConsistency(); } - return $startcol + 5; // 5 = SelectionTableMap::NUM_HYDRATE_COLUMNS. + return $startcol + 6; // 6 = SelectionTableMap::NUM_HYDRATE_COLUMNS. } catch (Exception $e) { throw new PropelException("Error populating \Selection\Model\Selection object", 0, $e); @@ -999,6 +1058,9 @@ protected function doInsert(ConnectionInterface $con) if ($this->isColumnModified(SelectionTableMap::VISIBLE)) { $modifiedColumns[':p' . $index++] = 'VISIBLE'; } + if ($this->isColumnModified(SelectionTableMap::CODE)) { + $modifiedColumns[':p' . $index++] = 'CODE'; + } if ($this->isColumnModified(SelectionTableMap::POSITION)) { $modifiedColumns[':p' . $index++] = 'POSITION'; } @@ -1025,6 +1087,9 @@ protected function doInsert(ConnectionInterface $con) case 'VISIBLE': $stmt->bindValue($identifier, $this->visible, PDO::PARAM_INT); break; + case 'CODE': + $stmt->bindValue($identifier, $this->code, PDO::PARAM_STR); + break; case 'POSITION': $stmt->bindValue($identifier, $this->position, PDO::PARAM_INT); break; @@ -1103,12 +1168,15 @@ public function getByPosition($pos) return $this->getVisible(); break; case 2: - return $this->getPosition(); + return $this->getCode(); break; case 3: - return $this->getCreatedAt(); + return $this->getPosition(); break; case 4: + return $this->getCreatedAt(); + break; + case 5: return $this->getUpdatedAt(); break; default: @@ -1142,9 +1210,10 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum $result = array( $keys[0] => $this->getId(), $keys[1] => $this->getVisible(), - $keys[2] => $this->getPosition(), - $keys[3] => $this->getCreatedAt(), - $keys[4] => $this->getUpdatedAt(), + $keys[2] => $this->getCode(), + $keys[3] => $this->getPosition(), + $keys[4] => $this->getCreatedAt(), + $keys[5] => $this->getUpdatedAt(), ); $virtualColumns = $this->virtualColumns; foreach ($virtualColumns as $key => $virtualColumn) { @@ -1208,12 +1277,15 @@ public function setByPosition($pos, $value) $this->setVisible($value); break; case 2: - $this->setPosition($value); + $this->setCode($value); break; case 3: - $this->setCreatedAt($value); + $this->setPosition($value); break; case 4: + $this->setCreatedAt($value); + break; + case 5: $this->setUpdatedAt($value); break; } // switch() @@ -1242,9 +1314,10 @@ public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); if (array_key_exists($keys[1], $arr)) $this->setVisible($arr[$keys[1]]); - if (array_key_exists($keys[2], $arr)) $this->setPosition($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]]); + if (array_key_exists($keys[2], $arr)) $this->setCode($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setPosition($arr[$keys[3]]); + if (array_key_exists($keys[4], $arr)) $this->setCreatedAt($arr[$keys[4]]); + if (array_key_exists($keys[5], $arr)) $this->setUpdatedAt($arr[$keys[5]]); } /** @@ -1258,6 +1331,7 @@ public function buildCriteria() if ($this->isColumnModified(SelectionTableMap::ID)) $criteria->add(SelectionTableMap::ID, $this->id); if ($this->isColumnModified(SelectionTableMap::VISIBLE)) $criteria->add(SelectionTableMap::VISIBLE, $this->visible); + if ($this->isColumnModified(SelectionTableMap::CODE)) $criteria->add(SelectionTableMap::CODE, $this->code); if ($this->isColumnModified(SelectionTableMap::POSITION)) $criteria->add(SelectionTableMap::POSITION, $this->position); if ($this->isColumnModified(SelectionTableMap::CREATED_AT)) $criteria->add(SelectionTableMap::CREATED_AT, $this->created_at); if ($this->isColumnModified(SelectionTableMap::UPDATED_AT)) $criteria->add(SelectionTableMap::UPDATED_AT, $this->updated_at); @@ -1325,6 +1399,7 @@ public function isPrimaryKeyNull() public function copyInto($copyObj, $deepCopy = false, $makeNew = true) { $copyObj->setVisible($this->getVisible()); + $copyObj->setCode($this->getCode()); $copyObj->setPosition($this->getPosition()); $copyObj->setCreatedAt($this->getCreatedAt()); $copyObj->setUpdatedAt($this->getUpdatedAt()); @@ -2607,11 +2682,13 @@ public function clear() { $this->id = null; $this->visible = null; + $this->code = null; $this->position = null; $this->created_at = null; $this->updated_at = null; $this->alreadyInSave = false; $this->clearAllReferences(); + $this->applyDefaultValues(); $this->resetModified(); $this->setNew(true); $this->setDeleted(false); diff --git a/Model/Base/SelectionContainer.php b/Model/Base/SelectionContainer.php index ffd3e35..3dc236c 100644 --- a/Model/Base/SelectionContainer.php +++ b/Model/Base/SelectionContainer.php @@ -69,10 +69,17 @@ abstract class SelectionContainer implements ActiveRecordInterface /** * The value for the visible field. + * Note: this column has a database default value of: 0 * @var int */ protected $visible; + /** + * The value for the code field. + * @var string + */ + protected $code; + /** * The value for the position field. * @var int @@ -149,11 +156,24 @@ abstract class SelectionContainer implements ActiveRecordInterface */ protected $selectionContainerI18nsScheduledForDeletion = null; + /** + * Applies default values to this object. + * This method should be called from the object's constructor (or + * equivalent initialization method). + * @see __construct() + */ + public function applyDefaultValues() + { + $this->visible = 0; + } + /** * Initializes internal state of Selection\Model\Base\SelectionContainer object. + * @see applyDefaults() */ public function __construct() { + $this->applyDefaultValues(); } /** @@ -429,6 +449,17 @@ public function getVisible() return $this->visible; } + /** + * Get the [code] column value. + * + * @return string + */ + public function getCode() + { + + return $this->code; + } + /** * Get the [position] column value. * @@ -522,6 +553,27 @@ public function setVisible($v) return $this; } // setVisible() + /** + * Set the value of [code] column. + * + * @param string $v new value + * @return \Selection\Model\SelectionContainer The current object (for fluent API support) + */ + public function setCode($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->code !== $v) { + $this->code = $v; + $this->modifiedColumns[SelectionContainerTableMap::CODE] = true; + } + + + return $this; + } // setCode() + /** * Set the value of [position] column. * @@ -595,6 +647,10 @@ public function setUpdatedAt($v) */ public function hasOnlyDefaultValues() { + if ($this->visible !== 0) { + return false; + } + // otherwise, everything was equal, so return TRUE return true; } // hasOnlyDefaultValues() @@ -628,16 +684,19 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta $col = $row[TableMap::TYPE_NUM == $indexType ? 1 + $startcol : SelectionContainerTableMap::translateFieldName('Visible', TableMap::TYPE_PHPNAME, $indexType)]; $this->visible = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : SelectionContainerTableMap::translateFieldName('Position', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 2 + $startcol : SelectionContainerTableMap::translateFieldName('Code', TableMap::TYPE_PHPNAME, $indexType)]; + $this->code = (null !== $col) ? (string) $col : null; + + $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : SelectionContainerTableMap::translateFieldName('Position', TableMap::TYPE_PHPNAME, $indexType)]; $this->position = (null !== $col) ? (int) $col : null; - $col = $row[TableMap::TYPE_NUM == $indexType ? 3 + $startcol : SelectionContainerTableMap::translateFieldName('CreatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 4 + $startcol : SelectionContainerTableMap::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 : SelectionContainerTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; + $col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : SelectionContainerTableMap::translateFieldName('UpdatedAt', TableMap::TYPE_PHPNAME, $indexType)]; if ($col === '0000-00-00 00:00:00') { $col = null; } @@ -650,7 +709,7 @@ public function hydrate($row, $startcol = 0, $rehydrate = false, $indexType = Ta $this->ensureConsistency(); } - return $startcol + 5; // 5 = SelectionContainerTableMap::NUM_HYDRATE_COLUMNS. + return $startcol + 6; // 6 = SelectionContainerTableMap::NUM_HYDRATE_COLUMNS. } catch (Exception $e) { throw new PropelException("Error populating \Selection\Model\SelectionContainer object", 0, $e); @@ -930,6 +989,9 @@ protected function doInsert(ConnectionInterface $con) if ($this->isColumnModified(SelectionContainerTableMap::VISIBLE)) { $modifiedColumns[':p' . $index++] = 'VISIBLE'; } + if ($this->isColumnModified(SelectionContainerTableMap::CODE)) { + $modifiedColumns[':p' . $index++] = 'CODE'; + } if ($this->isColumnModified(SelectionContainerTableMap::POSITION)) { $modifiedColumns[':p' . $index++] = 'POSITION'; } @@ -956,6 +1018,9 @@ protected function doInsert(ConnectionInterface $con) case 'VISIBLE': $stmt->bindValue($identifier, $this->visible, PDO::PARAM_INT); break; + case 'CODE': + $stmt->bindValue($identifier, $this->code, PDO::PARAM_STR); + break; case 'POSITION': $stmt->bindValue($identifier, $this->position, PDO::PARAM_INT); break; @@ -1036,12 +1101,15 @@ public function getByPosition($pos) return $this->getVisible(); break; case 2: - return $this->getPosition(); + return $this->getCode(); break; case 3: - return $this->getCreatedAt(); + return $this->getPosition(); break; case 4: + return $this->getCreatedAt(); + break; + case 5: return $this->getUpdatedAt(); break; default: @@ -1075,9 +1143,10 @@ public function toArray($keyType = TableMap::TYPE_PHPNAME, $includeLazyLoadColum $result = array( $keys[0] => $this->getId(), $keys[1] => $this->getVisible(), - $keys[2] => $this->getPosition(), - $keys[3] => $this->getCreatedAt(), - $keys[4] => $this->getUpdatedAt(), + $keys[2] => $this->getCode(), + $keys[3] => $this->getPosition(), + $keys[4] => $this->getCreatedAt(), + $keys[5] => $this->getUpdatedAt(), ); $virtualColumns = $this->virtualColumns; foreach ($virtualColumns as $key => $virtualColumn) { @@ -1135,12 +1204,15 @@ public function setByPosition($pos, $value) $this->setVisible($value); break; case 2: - $this->setPosition($value); + $this->setCode($value); break; case 3: - $this->setCreatedAt($value); + $this->setPosition($value); break; case 4: + $this->setCreatedAt($value); + break; + case 5: $this->setUpdatedAt($value); break; } // switch() @@ -1169,9 +1241,10 @@ public function fromArray($arr, $keyType = TableMap::TYPE_PHPNAME) if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]); if (array_key_exists($keys[1], $arr)) $this->setVisible($arr[$keys[1]]); - if (array_key_exists($keys[2], $arr)) $this->setPosition($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]]); + if (array_key_exists($keys[2], $arr)) $this->setCode($arr[$keys[2]]); + if (array_key_exists($keys[3], $arr)) $this->setPosition($arr[$keys[3]]); + if (array_key_exists($keys[4], $arr)) $this->setCreatedAt($arr[$keys[4]]); + if (array_key_exists($keys[5], $arr)) $this->setUpdatedAt($arr[$keys[5]]); } /** @@ -1185,6 +1258,7 @@ public function buildCriteria() if ($this->isColumnModified(SelectionContainerTableMap::ID)) $criteria->add(SelectionContainerTableMap::ID, $this->id); if ($this->isColumnModified(SelectionContainerTableMap::VISIBLE)) $criteria->add(SelectionContainerTableMap::VISIBLE, $this->visible); + if ($this->isColumnModified(SelectionContainerTableMap::CODE)) $criteria->add(SelectionContainerTableMap::CODE, $this->code); if ($this->isColumnModified(SelectionContainerTableMap::POSITION)) $criteria->add(SelectionContainerTableMap::POSITION, $this->position); if ($this->isColumnModified(SelectionContainerTableMap::CREATED_AT)) $criteria->add(SelectionContainerTableMap::CREATED_AT, $this->created_at); if ($this->isColumnModified(SelectionContainerTableMap::UPDATED_AT)) $criteria->add(SelectionContainerTableMap::UPDATED_AT, $this->updated_at); @@ -1252,6 +1326,7 @@ public function isPrimaryKeyNull() public function copyInto($copyObj, $deepCopy = false, $makeNew = true) { $copyObj->setVisible($this->getVisible()); + $copyObj->setCode($this->getCode()); $copyObj->setPosition($this->getPosition()); $copyObj->setCreatedAt($this->getCreatedAt()); $copyObj->setUpdatedAt($this->getUpdatedAt()); @@ -2024,11 +2099,13 @@ public function clear() { $this->id = null; $this->visible = null; + $this->code = null; $this->position = null; $this->created_at = null; $this->updated_at = null; $this->alreadyInSave = false; $this->clearAllReferences(); + $this->applyDefaultValues(); $this->resetModified(); $this->setNew(true); $this->setDeleted(false); diff --git a/Model/Base/SelectionContainerQuery.php b/Model/Base/SelectionContainerQuery.php index d0920df..3e3473b 100644 --- a/Model/Base/SelectionContainerQuery.php +++ b/Model/Base/SelectionContainerQuery.php @@ -24,12 +24,14 @@ * * @method ChildSelectionContainerQuery orderById($order = Criteria::ASC) Order by the id column * @method ChildSelectionContainerQuery orderByVisible($order = Criteria::ASC) Order by the visible column + * @method ChildSelectionContainerQuery orderByCode($order = Criteria::ASC) Order by the code column * @method ChildSelectionContainerQuery orderByPosition($order = Criteria::ASC) Order by the position column * @method ChildSelectionContainerQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column * @method ChildSelectionContainerQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column * * @method ChildSelectionContainerQuery groupById() Group by the id column * @method ChildSelectionContainerQuery groupByVisible() Group by the visible column + * @method ChildSelectionContainerQuery groupByCode() Group by the code column * @method ChildSelectionContainerQuery groupByPosition() Group by the position column * @method ChildSelectionContainerQuery groupByCreatedAt() Group by the created_at column * @method ChildSelectionContainerQuery groupByUpdatedAt() Group by the updated_at column @@ -55,12 +57,14 @@ * * @method ChildSelectionContainer findOneById(int $id) Return the first ChildSelectionContainer filtered by the id column * @method ChildSelectionContainer findOneByVisible(int $visible) Return the first ChildSelectionContainer filtered by the visible column + * @method ChildSelectionContainer findOneByCode(string $code) Return the first ChildSelectionContainer filtered by the code column * @method ChildSelectionContainer findOneByPosition(int $position) Return the first ChildSelectionContainer filtered by the position column * @method ChildSelectionContainer findOneByCreatedAt(string $created_at) Return the first ChildSelectionContainer filtered by the created_at column * @method ChildSelectionContainer findOneByUpdatedAt(string $updated_at) Return the first ChildSelectionContainer filtered by the updated_at column * * @method array findById(int $id) Return ChildSelectionContainer objects filtered by the id column * @method array findByVisible(int $visible) Return ChildSelectionContainer objects filtered by the visible column + * @method array findByCode(string $code) Return ChildSelectionContainer objects filtered by the code column * @method array findByPosition(int $position) Return ChildSelectionContainer objects filtered by the position column * @method array findByCreatedAt(string $created_at) Return ChildSelectionContainer objects filtered by the created_at column * @method array findByUpdatedAt(string $updated_at) Return ChildSelectionContainer objects filtered by the updated_at column @@ -152,7 +156,7 @@ public function findPk($key, $con = null) */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, VISIBLE, POSITION, CREATED_AT, UPDATED_AT FROM selection_container WHERE ID = :p0'; + $sql = 'SELECT ID, VISIBLE, CODE, POSITION, CREATED_AT, UPDATED_AT FROM selection_container WHERE ID = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); @@ -323,6 +327,35 @@ public function filterByVisible($visible = null, $comparison = null) return $this->addUsingAlias(SelectionContainerTableMap::VISIBLE, $visible, $comparison); } + /** + * Filter the query on the code column + * + * Example usage: + * + * $query->filterByCode('fooValue'); // WHERE code = 'fooValue' + * $query->filterByCode('%fooValue%'); // WHERE code LIKE '%fooValue%' + * + * + * @param string $code 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 ChildSelectionContainerQuery The current query, for fluid interface + */ + public function filterByCode($code = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($code)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $code)) { + $code = str_replace('*', '%', $code); + $comparison = Criteria::LIKE; + } + } + + return $this->addUsingAlias(SelectionContainerTableMap::CODE, $code, $comparison); + } + /** * Filter the query on the position column * diff --git a/Model/Base/SelectionQuery.php b/Model/Base/SelectionQuery.php index 69062e6..c301461 100644 --- a/Model/Base/SelectionQuery.php +++ b/Model/Base/SelectionQuery.php @@ -24,12 +24,14 @@ * * @method ChildSelectionQuery orderById($order = Criteria::ASC) Order by the id column * @method ChildSelectionQuery orderByVisible($order = Criteria::ASC) Order by the visible column + * @method ChildSelectionQuery orderByCode($order = Criteria::ASC) Order by the code column * @method ChildSelectionQuery orderByPosition($order = Criteria::ASC) Order by the position column * @method ChildSelectionQuery orderByCreatedAt($order = Criteria::ASC) Order by the created_at column * @method ChildSelectionQuery orderByUpdatedAt($order = Criteria::ASC) Order by the updated_at column * * @method ChildSelectionQuery groupById() Group by the id column * @method ChildSelectionQuery groupByVisible() Group by the visible column + * @method ChildSelectionQuery groupByCode() Group by the code column * @method ChildSelectionQuery groupByPosition() Group by the position column * @method ChildSelectionQuery groupByCreatedAt() Group by the created_at column * @method ChildSelectionQuery groupByUpdatedAt() Group by the updated_at column @@ -63,12 +65,14 @@ * * @method ChildSelection findOneById(int $id) Return the first ChildSelection filtered by the id column * @method ChildSelection findOneByVisible(int $visible) Return the first ChildSelection filtered by the visible column + * @method ChildSelection findOneByCode(string $code) Return the first ChildSelection filtered by the code column * @method ChildSelection findOneByPosition(int $position) Return the first ChildSelection filtered by the position column * @method ChildSelection findOneByCreatedAt(string $created_at) Return the first ChildSelection filtered by the created_at column * @method ChildSelection findOneByUpdatedAt(string $updated_at) Return the first ChildSelection filtered by the updated_at column * * @method array findById(int $id) Return ChildSelection objects filtered by the id column * @method array findByVisible(int $visible) Return ChildSelection objects filtered by the visible column + * @method array findByCode(string $code) Return ChildSelection objects filtered by the code column * @method array findByPosition(int $position) Return ChildSelection objects filtered by the position column * @method array findByCreatedAt(string $created_at) Return ChildSelection objects filtered by the created_at column * @method array findByUpdatedAt(string $updated_at) Return ChildSelection objects filtered by the updated_at column @@ -160,7 +164,7 @@ public function findPk($key, $con = null) */ protected function findPkSimple($key, $con) { - $sql = 'SELECT ID, VISIBLE, POSITION, CREATED_AT, UPDATED_AT FROM selection WHERE ID = :p0'; + $sql = 'SELECT ID, VISIBLE, CODE, POSITION, CREATED_AT, UPDATED_AT FROM selection WHERE ID = :p0'; try { $stmt = $con->prepare($sql); $stmt->bindValue(':p0', $key, PDO::PARAM_INT); @@ -331,6 +335,35 @@ public function filterByVisible($visible = null, $comparison = null) return $this->addUsingAlias(SelectionTableMap::VISIBLE, $visible, $comparison); } + /** + * Filter the query on the code column + * + * Example usage: + * + * $query->filterByCode('fooValue'); // WHERE code = 'fooValue' + * $query->filterByCode('%fooValue%'); // WHERE code LIKE '%fooValue%' + * + * + * @param string $code 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 ChildSelectionQuery The current query, for fluid interface + */ + public function filterByCode($code = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($code)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $code)) { + $code = str_replace('*', '%', $code); + $comparison = Criteria::LIKE; + } + } + + return $this->addUsingAlias(SelectionTableMap::CODE, $code, $comparison); + } + /** * Filter the query on the position column * diff --git a/Model/Map/SelectionContainerTableMap.php b/Model/Map/SelectionContainerTableMap.php index 5b3d086..5e6e90a 100644 --- a/Model/Map/SelectionContainerTableMap.php +++ b/Model/Map/SelectionContainerTableMap.php @@ -58,7 +58,7 @@ class SelectionContainerTableMap extends TableMap /** * The total number of columns */ - const NUM_COLUMNS = 5; + const NUM_COLUMNS = 6; /** * The number of lazy-loaded columns @@ -68,7 +68,7 @@ class SelectionContainerTableMap extends TableMap /** * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */ - const NUM_HYDRATE_COLUMNS = 5; + const NUM_HYDRATE_COLUMNS = 6; /** * the column name for the ID field @@ -80,6 +80,11 @@ class SelectionContainerTableMap extends TableMap */ const VISIBLE = 'selection_container.VISIBLE'; + /** + * the column name for the CODE field + */ + const CODE = 'selection_container.CODE'; + /** * the column name for the POSITION field */ @@ -116,12 +121,12 @@ class SelectionContainerTableMap extends TableMap * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' */ protected static $fieldNames = array ( - self::TYPE_PHPNAME => array('Id', 'Visible', 'Position', 'CreatedAt', 'UpdatedAt', ), - self::TYPE_STUDLYPHPNAME => array('id', 'visible', 'position', 'createdAt', 'updatedAt', ), - self::TYPE_COLNAME => array(SelectionContainerTableMap::ID, SelectionContainerTableMap::VISIBLE, SelectionContainerTableMap::POSITION, SelectionContainerTableMap::CREATED_AT, SelectionContainerTableMap::UPDATED_AT, ), - self::TYPE_RAW_COLNAME => array('ID', 'VISIBLE', 'POSITION', 'CREATED_AT', 'UPDATED_AT', ), - self::TYPE_FIELDNAME => array('id', 'visible', 'position', 'created_at', 'updated_at', ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, ) + self::TYPE_PHPNAME => array('Id', 'Visible', 'Code', 'Position', 'CreatedAt', 'UpdatedAt', ), + self::TYPE_STUDLYPHPNAME => array('id', 'visible', 'code', 'position', 'createdAt', 'updatedAt', ), + self::TYPE_COLNAME => array(SelectionContainerTableMap::ID, SelectionContainerTableMap::VISIBLE, SelectionContainerTableMap::CODE, SelectionContainerTableMap::POSITION, SelectionContainerTableMap::CREATED_AT, SelectionContainerTableMap::UPDATED_AT, ), + self::TYPE_RAW_COLNAME => array('ID', 'VISIBLE', 'CODE', 'POSITION', 'CREATED_AT', 'UPDATED_AT', ), + self::TYPE_FIELDNAME => array('id', 'visible', 'code', 'position', 'created_at', 'updated_at', ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, ) ); /** @@ -131,12 +136,12 @@ class SelectionContainerTableMap extends TableMap * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 */ protected static $fieldKeys = array ( - self::TYPE_PHPNAME => array('Id' => 0, 'Visible' => 1, 'Position' => 2, 'CreatedAt' => 3, 'UpdatedAt' => 4, ), - self::TYPE_STUDLYPHPNAME => array('id' => 0, 'visible' => 1, 'position' => 2, 'createdAt' => 3, 'updatedAt' => 4, ), - self::TYPE_COLNAME => array(SelectionContainerTableMap::ID => 0, SelectionContainerTableMap::VISIBLE => 1, SelectionContainerTableMap::POSITION => 2, SelectionContainerTableMap::CREATED_AT => 3, SelectionContainerTableMap::UPDATED_AT => 4, ), - self::TYPE_RAW_COLNAME => array('ID' => 0, 'VISIBLE' => 1, 'POSITION' => 2, 'CREATED_AT' => 3, 'UPDATED_AT' => 4, ), - self::TYPE_FIELDNAME => array('id' => 0, 'visible' => 1, 'position' => 2, 'created_at' => 3, 'updated_at' => 4, ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, ) + self::TYPE_PHPNAME => array('Id' => 0, 'Visible' => 1, 'Code' => 2, 'Position' => 3, 'CreatedAt' => 4, 'UpdatedAt' => 5, ), + self::TYPE_STUDLYPHPNAME => array('id' => 0, 'visible' => 1, 'code' => 2, 'position' => 3, 'createdAt' => 4, 'updatedAt' => 5, ), + self::TYPE_COLNAME => array(SelectionContainerTableMap::ID => 0, SelectionContainerTableMap::VISIBLE => 1, SelectionContainerTableMap::CODE => 2, SelectionContainerTableMap::POSITION => 3, SelectionContainerTableMap::CREATED_AT => 4, SelectionContainerTableMap::UPDATED_AT => 5, ), + self::TYPE_RAW_COLNAME => array('ID' => 0, 'VISIBLE' => 1, 'CODE' => 2, 'POSITION' => 3, 'CREATED_AT' => 4, 'UPDATED_AT' => 5, ), + self::TYPE_FIELDNAME => array('id' => 0, 'visible' => 1, 'code' => 2, 'position' => 3, 'created_at' => 4, 'updated_at' => 5, ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, ) ); /** @@ -156,7 +161,8 @@ public function initialize() $this->setUseIdGenerator(true); // columns $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null); - $this->addColumn('VISIBLE', 'Visible', 'TINYINT', true, null, null); + $this->addColumn('VISIBLE', 'Visible', 'TINYINT', true, null, 0); + $this->addColumn('CODE', 'Code', 'VARCHAR', false, 255, null); $this->addColumn('POSITION', 'Position', 'INTEGER', false, null, null); $this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null); $this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null); @@ -337,12 +343,14 @@ public static function addSelectColumns(Criteria $criteria, $alias = null) if (null === $alias) { $criteria->addSelectColumn(SelectionContainerTableMap::ID); $criteria->addSelectColumn(SelectionContainerTableMap::VISIBLE); + $criteria->addSelectColumn(SelectionContainerTableMap::CODE); $criteria->addSelectColumn(SelectionContainerTableMap::POSITION); $criteria->addSelectColumn(SelectionContainerTableMap::CREATED_AT); $criteria->addSelectColumn(SelectionContainerTableMap::UPDATED_AT); } else { $criteria->addSelectColumn($alias . '.ID'); $criteria->addSelectColumn($alias . '.VISIBLE'); + $criteria->addSelectColumn($alias . '.CODE'); $criteria->addSelectColumn($alias . '.POSITION'); $criteria->addSelectColumn($alias . '.CREATED_AT'); $criteria->addSelectColumn($alias . '.UPDATED_AT'); diff --git a/Model/Map/SelectionTableMap.php b/Model/Map/SelectionTableMap.php index c3cb73f..8f5e73c 100644 --- a/Model/Map/SelectionTableMap.php +++ b/Model/Map/SelectionTableMap.php @@ -58,7 +58,7 @@ class SelectionTableMap extends TableMap /** * The total number of columns */ - const NUM_COLUMNS = 5; + const NUM_COLUMNS = 6; /** * The number of lazy-loaded columns @@ -68,7 +68,7 @@ class SelectionTableMap extends TableMap /** * The number of columns to hydrate (NUM_COLUMNS - NUM_LAZY_LOAD_COLUMNS) */ - const NUM_HYDRATE_COLUMNS = 5; + const NUM_HYDRATE_COLUMNS = 6; /** * the column name for the ID field @@ -80,6 +80,11 @@ class SelectionTableMap extends TableMap */ const VISIBLE = 'selection.VISIBLE'; + /** + * the column name for the CODE field + */ + const CODE = 'selection.CODE'; + /** * the column name for the POSITION field */ @@ -116,12 +121,12 @@ class SelectionTableMap extends TableMap * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' */ protected static $fieldNames = array ( - self::TYPE_PHPNAME => array('Id', 'Visible', 'Position', 'CreatedAt', 'UpdatedAt', ), - self::TYPE_STUDLYPHPNAME => array('id', 'visible', 'position', 'createdAt', 'updatedAt', ), - self::TYPE_COLNAME => array(SelectionTableMap::ID, SelectionTableMap::VISIBLE, SelectionTableMap::POSITION, SelectionTableMap::CREATED_AT, SelectionTableMap::UPDATED_AT, ), - self::TYPE_RAW_COLNAME => array('ID', 'VISIBLE', 'POSITION', 'CREATED_AT', 'UPDATED_AT', ), - self::TYPE_FIELDNAME => array('id', 'visible', 'position', 'created_at', 'updated_at', ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, ) + self::TYPE_PHPNAME => array('Id', 'Visible', 'Code', 'Position', 'CreatedAt', 'UpdatedAt', ), + self::TYPE_STUDLYPHPNAME => array('id', 'visible', 'code', 'position', 'createdAt', 'updatedAt', ), + self::TYPE_COLNAME => array(SelectionTableMap::ID, SelectionTableMap::VISIBLE, SelectionTableMap::CODE, SelectionTableMap::POSITION, SelectionTableMap::CREATED_AT, SelectionTableMap::UPDATED_AT, ), + self::TYPE_RAW_COLNAME => array('ID', 'VISIBLE', 'CODE', 'POSITION', 'CREATED_AT', 'UPDATED_AT', ), + self::TYPE_FIELDNAME => array('id', 'visible', 'code', 'position', 'created_at', 'updated_at', ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, ) ); /** @@ -131,12 +136,12 @@ class SelectionTableMap extends TableMap * e.g. self::$fieldKeys[self::TYPE_PHPNAME]['Id'] = 0 */ protected static $fieldKeys = array ( - self::TYPE_PHPNAME => array('Id' => 0, 'Visible' => 1, 'Position' => 2, 'CreatedAt' => 3, 'UpdatedAt' => 4, ), - self::TYPE_STUDLYPHPNAME => array('id' => 0, 'visible' => 1, 'position' => 2, 'createdAt' => 3, 'updatedAt' => 4, ), - self::TYPE_COLNAME => array(SelectionTableMap::ID => 0, SelectionTableMap::VISIBLE => 1, SelectionTableMap::POSITION => 2, SelectionTableMap::CREATED_AT => 3, SelectionTableMap::UPDATED_AT => 4, ), - self::TYPE_RAW_COLNAME => array('ID' => 0, 'VISIBLE' => 1, 'POSITION' => 2, 'CREATED_AT' => 3, 'UPDATED_AT' => 4, ), - self::TYPE_FIELDNAME => array('id' => 0, 'visible' => 1, 'position' => 2, 'created_at' => 3, 'updated_at' => 4, ), - self::TYPE_NUM => array(0, 1, 2, 3, 4, ) + self::TYPE_PHPNAME => array('Id' => 0, 'Visible' => 1, 'Code' => 2, 'Position' => 3, 'CreatedAt' => 4, 'UpdatedAt' => 5, ), + self::TYPE_STUDLYPHPNAME => array('id' => 0, 'visible' => 1, 'code' => 2, 'position' => 3, 'createdAt' => 4, 'updatedAt' => 5, ), + self::TYPE_COLNAME => array(SelectionTableMap::ID => 0, SelectionTableMap::VISIBLE => 1, SelectionTableMap::CODE => 2, SelectionTableMap::POSITION => 3, SelectionTableMap::CREATED_AT => 4, SelectionTableMap::UPDATED_AT => 5, ), + self::TYPE_RAW_COLNAME => array('ID' => 0, 'VISIBLE' => 1, 'CODE' => 2, 'POSITION' => 3, 'CREATED_AT' => 4, 'UPDATED_AT' => 5, ), + self::TYPE_FIELDNAME => array('id' => 0, 'visible' => 1, 'code' => 2, 'position' => 3, 'created_at' => 4, 'updated_at' => 5, ), + self::TYPE_NUM => array(0, 1, 2, 3, 4, 5, ) ); /** @@ -156,7 +161,8 @@ public function initialize() $this->setUseIdGenerator(true); // columns $this->addPrimaryKey('ID', 'Id', 'INTEGER', true, null, null); - $this->addColumn('VISIBLE', 'Visible', 'TINYINT', true, null, null); + $this->addColumn('VISIBLE', 'Visible', 'TINYINT', true, null, 0); + $this->addColumn('CODE', 'Code', 'VARCHAR', false, 255, null); $this->addColumn('POSITION', 'Position', 'INTEGER', false, null, null); $this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null); $this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null); @@ -341,12 +347,14 @@ public static function addSelectColumns(Criteria $criteria, $alias = null) if (null === $alias) { $criteria->addSelectColumn(SelectionTableMap::ID); $criteria->addSelectColumn(SelectionTableMap::VISIBLE); + $criteria->addSelectColumn(SelectionTableMap::CODE); $criteria->addSelectColumn(SelectionTableMap::POSITION); $criteria->addSelectColumn(SelectionTableMap::CREATED_AT); $criteria->addSelectColumn(SelectionTableMap::UPDATED_AT); } else { $criteria->addSelectColumn($alias . '.ID'); $criteria->addSelectColumn($alias . '.VISIBLE'); + $criteria->addSelectColumn($alias . '.CODE'); $criteria->addSelectColumn($alias . '.POSITION'); $criteria->addSelectColumn($alias . '.CREATED_AT'); $criteria->addSelectColumn($alias . '.UPDATED_AT');