template is not mandatory in product table.
This commit is contained in:
@@ -857,7 +857,7 @@ abstract class ProductQuery extends ModelCriteria
|
||||
*
|
||||
* @return ChildProductQuery The current query, for fluid interface
|
||||
*/
|
||||
public function joinTemplate($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
public function joinTemplate($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
|
||||
{
|
||||
$tableMap = $this->getTableMap();
|
||||
$relationMap = $tableMap->getRelation('Template');
|
||||
@@ -892,7 +892,7 @@ abstract class ProductQuery extends ModelCriteria
|
||||
*
|
||||
* @return \Thelia\Model\TemplateQuery A secondary query class using the current class as primary query
|
||||
*/
|
||||
public function useTemplateQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
public function useTemplateQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
|
||||
{
|
||||
return $this
|
||||
->joinTemplate($relationAlias, $joinType)
|
||||
|
||||
@@ -864,9 +864,10 @@ abstract class Template implements ActiveRecordInterface
|
||||
|
||||
if ($this->productsScheduledForDeletion !== null) {
|
||||
if (!$this->productsScheduledForDeletion->isEmpty()) {
|
||||
\Thelia\Model\ProductQuery::create()
|
||||
->filterByPrimaryKeys($this->productsScheduledForDeletion->getPrimaryKeys(false))
|
||||
->delete($con);
|
||||
foreach ($this->productsScheduledForDeletion as $product) {
|
||||
// need to save related object because we set the relation to null
|
||||
$product->save($con);
|
||||
}
|
||||
$this->productsScheduledForDeletion = null;
|
||||
}
|
||||
}
|
||||
@@ -1553,7 +1554,7 @@ abstract class Template implements ActiveRecordInterface
|
||||
$this->productsScheduledForDeletion = clone $this->collProducts;
|
||||
$this->productsScheduledForDeletion->clear();
|
||||
}
|
||||
$this->productsScheduledForDeletion[]= clone $product;
|
||||
$this->productsScheduledForDeletion[]= $product;
|
||||
$product->setTemplate(null);
|
||||
}
|
||||
|
||||
|
||||
@@ -395,7 +395,7 @@ abstract class TemplateQuery extends ModelCriteria
|
||||
*
|
||||
* @return ChildTemplateQuery The current query, for fluid interface
|
||||
*/
|
||||
public function joinProduct($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
public function joinProduct($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
|
||||
{
|
||||
$tableMap = $this->getTableMap();
|
||||
$relationMap = $tableMap->getRelation('Product');
|
||||
@@ -430,7 +430,7 @@ abstract class TemplateQuery extends ModelCriteria
|
||||
*
|
||||
* @return \Thelia\Model\ProductQuery A secondary query class using the current class as primary query
|
||||
*/
|
||||
public function useProductQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
|
||||
public function useProductQuery($relationAlias = null, $joinType = Criteria::LEFT_JOIN)
|
||||
{
|
||||
return $this
|
||||
->joinProduct($relationAlias, $joinType)
|
||||
|
||||
@@ -69,8 +69,6 @@ class Category extends BaseCategory
|
||||
{
|
||||
$this->setPosition($this->getNextPosition());
|
||||
|
||||
$this->generateRewrittenUrl($this->getLocale());
|
||||
|
||||
$this->dispatchEvent(TheliaEvents::BEFORE_CREATECATEGORY, new CategoryEvent($this));
|
||||
|
||||
return true;
|
||||
@@ -81,6 +79,7 @@ class Category extends BaseCategory
|
||||
*/
|
||||
public function postInsert(ConnectionInterface $con = null)
|
||||
{
|
||||
//$this->generateRewrittenUrl($this->getLocale());
|
||||
$this->dispatchEvent(TheliaEvents::AFTER_CREATECATEGORY, new CategoryEvent($this));
|
||||
}
|
||||
|
||||
|
||||
@@ -37,8 +37,11 @@ class Content extends BaseContent
|
||||
{
|
||||
$this->setPosition($this->getNextPosition());
|
||||
|
||||
$this->generateRewrittenUrl($this->getLocale());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function postInsert(ConnectionInterface $con = null)
|
||||
{
|
||||
//$this->generateRewrittenUrl($this->getLocale());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,8 +67,12 @@ class Folder extends BaseFolder
|
||||
{
|
||||
$this->setPosition($this->getNextPosition());
|
||||
|
||||
$this->generateRewrittenUrl($this->getLocale());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function postInsert(ConnectionInterface $con = null)
|
||||
{
|
||||
//$this->generateRewrittenUrl($this->getLocale());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -189,7 +189,7 @@ class ProductTableMap extends TableMap
|
||||
$this->addColumn('REF', 'Ref', 'VARCHAR', true, 255, null);
|
||||
$this->addColumn('VISIBLE', 'Visible', 'TINYINT', true, null, 0);
|
||||
$this->addColumn('POSITION', 'Position', 'INTEGER', true, null, null);
|
||||
$this->addForeignKey('TEMPLATE_ID', 'TemplateId', 'INTEGER', 'template', 'ID', true, null, null);
|
||||
$this->addForeignKey('TEMPLATE_ID', 'TemplateId', 'INTEGER', 'template', 'ID', false, null, null);
|
||||
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
|
||||
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
|
||||
$this->addColumn('VERSION', 'Version', 'INTEGER', false, null, 0);
|
||||
|
||||
@@ -180,7 +180,7 @@ class ProductVersionTableMap extends TableMap
|
||||
$this->addColumn('REF', 'Ref', 'VARCHAR', true, 255, null);
|
||||
$this->addColumn('VISIBLE', 'Visible', 'TINYINT', true, null, 0);
|
||||
$this->addColumn('POSITION', 'Position', 'INTEGER', true, null, null);
|
||||
$this->addColumn('TEMPLATE_ID', 'TemplateId', 'INTEGER', true, null, null);
|
||||
$this->addColumn('TEMPLATE_ID', 'TemplateId', 'INTEGER', false, null, null);
|
||||
$this->addColumn('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
|
||||
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
|
||||
$this->addPrimaryKey('VERSION', 'Version', 'INTEGER', true, null, 0);
|
||||
|
||||
@@ -107,7 +107,7 @@ class Product extends BaseProduct
|
||||
{
|
||||
$this->setPosition($this->getNextPosition());
|
||||
|
||||
$this->generateRewrittenUrl($this->getLocale());
|
||||
|
||||
|
||||
$this->dispatchEvent(TheliaEvents::BEFORE_CREATEPRODUCT, new ProductEvent($this));
|
||||
|
||||
@@ -119,6 +119,7 @@ class Product extends BaseProduct
|
||||
*/
|
||||
public function postInsert(ConnectionInterface $con = null)
|
||||
{
|
||||
//$this->generateRewrittenUrl($this->getLocale());
|
||||
$this->dispatchEvent(TheliaEvents::AFTER_CREATEPRODUCT, new ProductEvent($this));
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ CREATE TABLE `product`
|
||||
`ref` VARCHAR(255) NOT NULL,
|
||||
`visible` TINYINT DEFAULT 0 NOT NULL,
|
||||
`position` INTEGER NOT NULL,
|
||||
`template_id` INTEGER NOT NULL,
|
||||
`template_id` INTEGER,
|
||||
`created_at` DATETIME,
|
||||
`updated_at` DATETIME,
|
||||
`version` INTEGER DEFAULT 0,
|
||||
@@ -2167,7 +2167,7 @@ CREATE TABLE `product_version`
|
||||
`ref` VARCHAR(255) NOT NULL,
|
||||
`visible` TINYINT DEFAULT 0 NOT NULL,
|
||||
`position` INTEGER NOT NULL,
|
||||
`template_id` INTEGER NOT NULL,
|
||||
`template_id` INTEGER,
|
||||
`created_at` DATETIME,
|
||||
`updated_at` DATETIME,
|
||||
`version` INTEGER DEFAULT 0 NOT NULL,
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
<column name="description" type="CLOB" />
|
||||
<column name="chapo" type="LONGVARCHAR" />
|
||||
<column name="postscriptum" type="LONGVARCHAR" />
|
||||
<column name="postscriptum" type="LONGVARCHAR" />
|
||||
<column name="template_id" type="INTEGER" />
|
||||
<foreign-key foreignTable="tax_rule" name="fk_product_tax_rule_id" onDelete="SET NULL" onUpdate="RESTRICT">
|
||||
<reference foreign="id" local="tax_rule_id" />
|
||||
</foreign-key>
|
||||
|
||||
Reference in New Issue
Block a user