Add new fields (meta_title, meta_description and meta_keyword) under I18N Product

This commit is contained in:
touffies
2013-11-28 12:00:07 +01:00
parent 2549369b45
commit a3beb4c6f4
7 changed files with 1656 additions and 1281 deletions

View File

@@ -5866,6 +5866,78 @@ abstract class Product implements ActiveRecordInterface
return $this;
}
/**
* Get the [meta_title] column value.
*
* @return string
*/
public function getMetaTitle()
{
return $this->getCurrentTranslation()->getMetaTitle();
}
/**
* Set the value of [meta_title] column.
*
* @param string $v new value
* @return \Thelia\Model\ProductI18n The current object (for fluent API support)
*/
public function setMetaTitle($v)
{ $this->getCurrentTranslation()->setMetaTitle($v);
return $this;
}
/**
* Get the [meta_description] column value.
*
* @return string
*/
public function getMetaDescription()
{
return $this->getCurrentTranslation()->getMetaDescription();
}
/**
* Set the value of [meta_description] column.
*
* @param string $v new value
* @return \Thelia\Model\ProductI18n The current object (for fluent API support)
*/
public function setMetaDescription($v)
{ $this->getCurrentTranslation()->setMetaDescription($v);
return $this;
}
/**
* Get the [meta_keyword] column value.
*
* @return string
*/
public function getMetaKeyword()
{
return $this->getCurrentTranslation()->getMetaKeyword();
}
/**
* Set the value of [meta_keyword] column.
*
* @param string $v new value
* @return \Thelia\Model\ProductI18n The current object (for fluent API support)
*/
public function setMetaKeyword($v)
{ $this->getCurrentTranslation()->setMetaKeyword($v);
return $this;
}
// versionable behavior
/**

View File

@@ -90,6 +90,24 @@ abstract class ProductI18n implements ActiveRecordInterface
*/
protected $postscriptum;
/**
* The value for the meta_title field.
* @var string
*/
protected $meta_title;
/**
* The value for the meta_description field.
* @var string
*/
protected $meta_description;
/**
* The value for the meta_keyword field.
* @var string
*/
protected $meta_keyword;
/**
* @var Product
*/
@@ -440,6 +458,39 @@ abstract class ProductI18n implements ActiveRecordInterface
return $this->postscriptum;
}
/**
* Get the [meta_title] column value.
*
* @return string
*/
public function getMetaTitle()
{
return $this->meta_title;
}
/**
* Get the [meta_description] column value.
*
* @return string
*/
public function getMetaDescription()
{
return $this->meta_description;
}
/**
* Get the [meta_keyword] column value.
*
* @return string
*/
public function getMetaKeyword()
{
return $this->meta_keyword;
}
/**
* Set the value of [id] column.
*
@@ -570,6 +621,69 @@ abstract class ProductI18n implements ActiveRecordInterface
return $this;
} // setPostscriptum()
/**
* Set the value of [meta_title] column.
*
* @param string $v new value
* @return \Thelia\Model\ProductI18n The current object (for fluent API support)
*/
public function setMetaTitle($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->meta_title !== $v) {
$this->meta_title = $v;
$this->modifiedColumns[] = ProductI18nTableMap::META_TITLE;
}
return $this;
} // setMetaTitle()
/**
* Set the value of [meta_description] column.
*
* @param string $v new value
* @return \Thelia\Model\ProductI18n The current object (for fluent API support)
*/
public function setMetaDescription($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->meta_description !== $v) {
$this->meta_description = $v;
$this->modifiedColumns[] = ProductI18nTableMap::META_DESCRIPTION;
}
return $this;
} // setMetaDescription()
/**
* Set the value of [meta_keyword] column.
*
* @param string $v new value
* @return \Thelia\Model\ProductI18n The current object (for fluent API support)
*/
public function setMetaKeyword($v)
{
if ($v !== null) {
$v = (string) $v;
}
if ($this->meta_keyword !== $v) {
$this->meta_keyword = $v;
$this->modifiedColumns[] = ProductI18nTableMap::META_KEYWORD;
}
return $this;
} // setMetaKeyword()
/**
* Indicates whether the columns in this object are only set to default values.
*
@@ -628,6 +742,15 @@ abstract class ProductI18n implements ActiveRecordInterface
$col = $row[TableMap::TYPE_NUM == $indexType ? 5 + $startcol : ProductI18nTableMap::translateFieldName('Postscriptum', TableMap::TYPE_PHPNAME, $indexType)];
$this->postscriptum = (null !== $col) ? (string) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 6 + $startcol : ProductI18nTableMap::translateFieldName('MetaTitle', TableMap::TYPE_PHPNAME, $indexType)];
$this->meta_title = (null !== $col) ? (string) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 7 + $startcol : ProductI18nTableMap::translateFieldName('MetaDescription', TableMap::TYPE_PHPNAME, $indexType)];
$this->meta_description = (null !== $col) ? (string) $col : null;
$col = $row[TableMap::TYPE_NUM == $indexType ? 8 + $startcol : ProductI18nTableMap::translateFieldName('MetaKeyword', TableMap::TYPE_PHPNAME, $indexType)];
$this->meta_keyword = (null !== $col) ? (string) $col : null;
$this->resetModified();
$this->setNew(false);
@@ -636,7 +759,7 @@ abstract class ProductI18n implements ActiveRecordInterface
$this->ensureConsistency();
}
return $startcol + 6; // 6 = ProductI18nTableMap::NUM_HYDRATE_COLUMNS.
return $startcol + 9; // 9 = ProductI18nTableMap::NUM_HYDRATE_COLUMNS.
} catch (Exception $e) {
throw new PropelException("Error populating \Thelia\Model\ProductI18n object", 0, $e);
@@ -875,6 +998,15 @@ abstract class ProductI18n implements ActiveRecordInterface
if ($this->isColumnModified(ProductI18nTableMap::POSTSCRIPTUM)) {
$modifiedColumns[':p' . $index++] = 'POSTSCRIPTUM';
}
if ($this->isColumnModified(ProductI18nTableMap::META_TITLE)) {
$modifiedColumns[':p' . $index++] = 'META_TITLE';
}
if ($this->isColumnModified(ProductI18nTableMap::META_DESCRIPTION)) {
$modifiedColumns[':p' . $index++] = 'META_DESCRIPTION';
}
if ($this->isColumnModified(ProductI18nTableMap::META_KEYWORD)) {
$modifiedColumns[':p' . $index++] = 'META_KEYWORD';
}
$sql = sprintf(
'INSERT INTO product_i18n (%s) VALUES (%s)',
@@ -904,6 +1036,15 @@ abstract class ProductI18n implements ActiveRecordInterface
case 'POSTSCRIPTUM':
$stmt->bindValue($identifier, $this->postscriptum, PDO::PARAM_STR);
break;
case 'META_TITLE':
$stmt->bindValue($identifier, $this->meta_title, PDO::PARAM_STR);
break;
case 'META_DESCRIPTION':
$stmt->bindValue($identifier, $this->meta_description, PDO::PARAM_STR);
break;
case 'META_KEYWORD':
$stmt->bindValue($identifier, $this->meta_keyword, PDO::PARAM_STR);
break;
}
}
$stmt->execute();
@@ -977,6 +1118,15 @@ abstract class ProductI18n implements ActiveRecordInterface
case 5:
return $this->getPostscriptum();
break;
case 6:
return $this->getMetaTitle();
break;
case 7:
return $this->getMetaDescription();
break;
case 8:
return $this->getMetaKeyword();
break;
default:
return null;
break;
@@ -1012,6 +1162,9 @@ abstract class ProductI18n implements ActiveRecordInterface
$keys[3] => $this->getDescription(),
$keys[4] => $this->getChapo(),
$keys[5] => $this->getPostscriptum(),
$keys[6] => $this->getMetaTitle(),
$keys[7] => $this->getMetaDescription(),
$keys[8] => $this->getMetaKeyword(),
);
$virtualColumns = $this->virtualColumns;
foreach ($virtualColumns as $key => $virtualColumn) {
@@ -1074,6 +1227,15 @@ abstract class ProductI18n implements ActiveRecordInterface
case 5:
$this->setPostscriptum($value);
break;
case 6:
$this->setMetaTitle($value);
break;
case 7:
$this->setMetaDescription($value);
break;
case 8:
$this->setMetaKeyword($value);
break;
} // switch()
}
@@ -1104,6 +1266,9 @@ abstract class ProductI18n implements ActiveRecordInterface
if (array_key_exists($keys[3], $arr)) $this->setDescription($arr[$keys[3]]);
if (array_key_exists($keys[4], $arr)) $this->setChapo($arr[$keys[4]]);
if (array_key_exists($keys[5], $arr)) $this->setPostscriptum($arr[$keys[5]]);
if (array_key_exists($keys[6], $arr)) $this->setMetaTitle($arr[$keys[6]]);
if (array_key_exists($keys[7], $arr)) $this->setMetaDescription($arr[$keys[7]]);
if (array_key_exists($keys[8], $arr)) $this->setMetaKeyword($arr[$keys[8]]);
}
/**
@@ -1121,6 +1286,9 @@ abstract class ProductI18n implements ActiveRecordInterface
if ($this->isColumnModified(ProductI18nTableMap::DESCRIPTION)) $criteria->add(ProductI18nTableMap::DESCRIPTION, $this->description);
if ($this->isColumnModified(ProductI18nTableMap::CHAPO)) $criteria->add(ProductI18nTableMap::CHAPO, $this->chapo);
if ($this->isColumnModified(ProductI18nTableMap::POSTSCRIPTUM)) $criteria->add(ProductI18nTableMap::POSTSCRIPTUM, $this->postscriptum);
if ($this->isColumnModified(ProductI18nTableMap::META_TITLE)) $criteria->add(ProductI18nTableMap::META_TITLE, $this->meta_title);
if ($this->isColumnModified(ProductI18nTableMap::META_DESCRIPTION)) $criteria->add(ProductI18nTableMap::META_DESCRIPTION, $this->meta_description);
if ($this->isColumnModified(ProductI18nTableMap::META_KEYWORD)) $criteria->add(ProductI18nTableMap::META_KEYWORD, $this->meta_keyword);
return $criteria;
}
@@ -1197,6 +1365,9 @@ abstract class ProductI18n implements ActiveRecordInterface
$copyObj->setDescription($this->getDescription());
$copyObj->setChapo($this->getChapo());
$copyObj->setPostscriptum($this->getPostscriptum());
$copyObj->setMetaTitle($this->getMetaTitle());
$copyObj->setMetaDescription($this->getMetaDescription());
$copyObj->setMetaKeyword($this->getMetaKeyword());
if ($makeNew) {
$copyObj->setNew(true);
}
@@ -1286,6 +1457,9 @@ abstract class ProductI18n implements ActiveRecordInterface
$this->description = null;
$this->chapo = null;
$this->postscriptum = null;
$this->meta_title = null;
$this->meta_description = null;
$this->meta_keyword = null;
$this->alreadyInSave = false;
$this->clearAllReferences();
$this->applyDefaultValues();

View File

@@ -27,6 +27,9 @@ use Thelia\Model\Map\ProductI18nTableMap;
* @method ChildProductI18nQuery orderByDescription($order = Criteria::ASC) Order by the description column
* @method ChildProductI18nQuery orderByChapo($order = Criteria::ASC) Order by the chapo column
* @method ChildProductI18nQuery orderByPostscriptum($order = Criteria::ASC) Order by the postscriptum column
* @method ChildProductI18nQuery orderByMetaTitle($order = Criteria::ASC) Order by the meta_title column
* @method ChildProductI18nQuery orderByMetaDescription($order = Criteria::ASC) Order by the meta_description column
* @method ChildProductI18nQuery orderByMetaKeyword($order = Criteria::ASC) Order by the meta_keyword column
*
* @method ChildProductI18nQuery groupById() Group by the id column
* @method ChildProductI18nQuery groupByLocale() Group by the locale column
@@ -34,6 +37,9 @@ use Thelia\Model\Map\ProductI18nTableMap;
* @method ChildProductI18nQuery groupByDescription() Group by the description column
* @method ChildProductI18nQuery groupByChapo() Group by the chapo column
* @method ChildProductI18nQuery groupByPostscriptum() Group by the postscriptum column
* @method ChildProductI18nQuery groupByMetaTitle() Group by the meta_title column
* @method ChildProductI18nQuery groupByMetaDescription() Group by the meta_description column
* @method ChildProductI18nQuery groupByMetaKeyword() Group by the meta_keyword column
*
* @method ChildProductI18nQuery leftJoin($relation) Adds a LEFT JOIN clause to the query
* @method ChildProductI18nQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query
@@ -52,6 +58,9 @@ use Thelia\Model\Map\ProductI18nTableMap;
* @method ChildProductI18n findOneByDescription(string $description) Return the first ChildProductI18n filtered by the description column
* @method ChildProductI18n findOneByChapo(string $chapo) Return the first ChildProductI18n filtered by the chapo column
* @method ChildProductI18n findOneByPostscriptum(string $postscriptum) Return the first ChildProductI18n filtered by the postscriptum column
* @method ChildProductI18n findOneByMetaTitle(string $meta_title) Return the first ChildProductI18n filtered by the meta_title column
* @method ChildProductI18n findOneByMetaDescription(string $meta_description) Return the first ChildProductI18n filtered by the meta_description column
* @method ChildProductI18n findOneByMetaKeyword(string $meta_keyword) Return the first ChildProductI18n filtered by the meta_keyword column
*
* @method array findById(int $id) Return ChildProductI18n objects filtered by the id column
* @method array findByLocale(string $locale) Return ChildProductI18n objects filtered by the locale column
@@ -59,6 +68,9 @@ use Thelia\Model\Map\ProductI18nTableMap;
* @method array findByDescription(string $description) Return ChildProductI18n objects filtered by the description column
* @method array findByChapo(string $chapo) Return ChildProductI18n objects filtered by the chapo column
* @method array findByPostscriptum(string $postscriptum) Return ChildProductI18n objects filtered by the postscriptum column
* @method array findByMetaTitle(string $meta_title) Return ChildProductI18n objects filtered by the meta_title column
* @method array findByMetaDescription(string $meta_description) Return ChildProductI18n objects filtered by the meta_description column
* @method array findByMetaKeyword(string $meta_keyword) Return ChildProductI18n objects filtered by the meta_keyword column
*
*/
abstract class ProductI18nQuery extends ModelCriteria
@@ -147,7 +159,7 @@ abstract class ProductI18nQuery extends ModelCriteria
*/
protected function findPkSimple($key, $con)
{
$sql = 'SELECT ID, LOCALE, TITLE, DESCRIPTION, CHAPO, POSTSCRIPTUM FROM product_i18n WHERE ID = :p0 AND LOCALE = :p1';
$sql = 'SELECT ID, LOCALE, TITLE, DESCRIPTION, CHAPO, POSTSCRIPTUM, META_TITLE, META_DESCRIPTION, META_KEYWORD FROM product_i18n WHERE ID = :p0 AND LOCALE = :p1';
try {
$stmt = $con->prepare($sql);
$stmt->bindValue(':p0', $key[0], PDO::PARAM_INT);
@@ -436,6 +448,93 @@ abstract class ProductI18nQuery extends ModelCriteria
return $this->addUsingAlias(ProductI18nTableMap::POSTSCRIPTUM, $postscriptum, $comparison);
}
/**
* Filter the query on the meta_title column
*
* Example usage:
* <code>
* $query->filterByMetaTitle('fooValue'); // WHERE meta_title = 'fooValue'
* $query->filterByMetaTitle('%fooValue%'); // WHERE meta_title LIKE '%fooValue%'
* </code>
*
* @param string $metaTitle 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 ChildProductI18nQuery The current query, for fluid interface
*/
public function filterByMetaTitle($metaTitle = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($metaTitle)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $metaTitle)) {
$metaTitle = str_replace('*', '%', $metaTitle);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(ProductI18nTableMap::META_TITLE, $metaTitle, $comparison);
}
/**
* Filter the query on the meta_description column
*
* Example usage:
* <code>
* $query->filterByMetaDescription('fooValue'); // WHERE meta_description = 'fooValue'
* $query->filterByMetaDescription('%fooValue%'); // WHERE meta_description LIKE '%fooValue%'
* </code>
*
* @param string $metaDescription 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 ChildProductI18nQuery The current query, for fluid interface
*/
public function filterByMetaDescription($metaDescription = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($metaDescription)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $metaDescription)) {
$metaDescription = str_replace('*', '%', $metaDescription);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(ProductI18nTableMap::META_DESCRIPTION, $metaDescription, $comparison);
}
/**
* Filter the query on the meta_keyword column
*
* Example usage:
* <code>
* $query->filterByMetaKeyword('fooValue'); // WHERE meta_keyword = 'fooValue'
* $query->filterByMetaKeyword('%fooValue%'); // WHERE meta_keyword LIKE '%fooValue%'
* </code>
*
* @param string $metaKeyword 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 ChildProductI18nQuery The current query, for fluid interface
*/
public function filterByMetaKeyword($metaKeyword = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($metaKeyword)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $metaKeyword)) {
$metaKeyword = str_replace('*', '%', $metaKeyword);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(ProductI18nTableMap::META_KEYWORD, $metaKeyword, $comparison);
}
/**
* Filter the query by a related \Thelia\Model\Product object
*