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
|
* @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();
|
$tableMap = $this->getTableMap();
|
||||||
$relationMap = $tableMap->getRelation('Template');
|
$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
|
* @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
|
return $this
|
||||||
->joinTemplate($relationAlias, $joinType)
|
->joinTemplate($relationAlias, $joinType)
|
||||||
|
|||||||
@@ -864,9 +864,10 @@ abstract class Template implements ActiveRecordInterface
|
|||||||
|
|
||||||
if ($this->productsScheduledForDeletion !== null) {
|
if ($this->productsScheduledForDeletion !== null) {
|
||||||
if (!$this->productsScheduledForDeletion->isEmpty()) {
|
if (!$this->productsScheduledForDeletion->isEmpty()) {
|
||||||
\Thelia\Model\ProductQuery::create()
|
foreach ($this->productsScheduledForDeletion as $product) {
|
||||||
->filterByPrimaryKeys($this->productsScheduledForDeletion->getPrimaryKeys(false))
|
// need to save related object because we set the relation to null
|
||||||
->delete($con);
|
$product->save($con);
|
||||||
|
}
|
||||||
$this->productsScheduledForDeletion = null;
|
$this->productsScheduledForDeletion = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1553,7 +1554,7 @@ abstract class Template implements ActiveRecordInterface
|
|||||||
$this->productsScheduledForDeletion = clone $this->collProducts;
|
$this->productsScheduledForDeletion = clone $this->collProducts;
|
||||||
$this->productsScheduledForDeletion->clear();
|
$this->productsScheduledForDeletion->clear();
|
||||||
}
|
}
|
||||||
$this->productsScheduledForDeletion[]= clone $product;
|
$this->productsScheduledForDeletion[]= $product;
|
||||||
$product->setTemplate(null);
|
$product->setTemplate(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -395,7 +395,7 @@ abstract class TemplateQuery extends ModelCriteria
|
|||||||
*
|
*
|
||||||
* @return ChildTemplateQuery The current query, for fluid interface
|
* @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();
|
$tableMap = $this->getTableMap();
|
||||||
$relationMap = $tableMap->getRelation('Product');
|
$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
|
* @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
|
return $this
|
||||||
->joinProduct($relationAlias, $joinType)
|
->joinProduct($relationAlias, $joinType)
|
||||||
|
|||||||
@@ -69,8 +69,6 @@ class Category extends BaseCategory
|
|||||||
{
|
{
|
||||||
$this->setPosition($this->getNextPosition());
|
$this->setPosition($this->getNextPosition());
|
||||||
|
|
||||||
$this->generateRewrittenUrl($this->getLocale());
|
|
||||||
|
|
||||||
$this->dispatchEvent(TheliaEvents::BEFORE_CREATECATEGORY, new CategoryEvent($this));
|
$this->dispatchEvent(TheliaEvents::BEFORE_CREATECATEGORY, new CategoryEvent($this));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -81,6 +79,7 @@ class Category extends BaseCategory
|
|||||||
*/
|
*/
|
||||||
public function postInsert(ConnectionInterface $con = null)
|
public function postInsert(ConnectionInterface $con = null)
|
||||||
{
|
{
|
||||||
|
//$this->generateRewrittenUrl($this->getLocale());
|
||||||
$this->dispatchEvent(TheliaEvents::AFTER_CREATECATEGORY, new CategoryEvent($this));
|
$this->dispatchEvent(TheliaEvents::AFTER_CREATECATEGORY, new CategoryEvent($this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,8 +37,11 @@ class Content extends BaseContent
|
|||||||
{
|
{
|
||||||
$this->setPosition($this->getNextPosition());
|
$this->setPosition($this->getNextPosition());
|
||||||
|
|
||||||
$this->generateRewrittenUrl($this->getLocale());
|
|
||||||
|
|
||||||
return true;
|
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->setPosition($this->getNextPosition());
|
||||||
|
|
||||||
$this->generateRewrittenUrl($this->getLocale());
|
|
||||||
|
|
||||||
return true;
|
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('REF', 'Ref', 'VARCHAR', true, 255, null);
|
||||||
$this->addColumn('VISIBLE', 'Visible', 'TINYINT', true, null, 0);
|
$this->addColumn('VISIBLE', 'Visible', 'TINYINT', true, null, 0);
|
||||||
$this->addColumn('POSITION', 'Position', 'INTEGER', true, null, null);
|
$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('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
|
||||||
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
|
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
|
||||||
$this->addColumn('VERSION', 'Version', 'INTEGER', false, null, 0);
|
$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('REF', 'Ref', 'VARCHAR', true, 255, null);
|
||||||
$this->addColumn('VISIBLE', 'Visible', 'TINYINT', true, null, 0);
|
$this->addColumn('VISIBLE', 'Visible', 'TINYINT', true, null, 0);
|
||||||
$this->addColumn('POSITION', 'Position', 'INTEGER', true, null, null);
|
$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('CREATED_AT', 'CreatedAt', 'TIMESTAMP', false, null, null);
|
||||||
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
|
$this->addColumn('UPDATED_AT', 'UpdatedAt', 'TIMESTAMP', false, null, null);
|
||||||
$this->addPrimaryKey('VERSION', 'Version', 'INTEGER', true, null, 0);
|
$this->addPrimaryKey('VERSION', 'Version', 'INTEGER', true, null, 0);
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ class Product extends BaseProduct
|
|||||||
{
|
{
|
||||||
$this->setPosition($this->getNextPosition());
|
$this->setPosition($this->getNextPosition());
|
||||||
|
|
||||||
$this->generateRewrittenUrl($this->getLocale());
|
|
||||||
|
|
||||||
$this->dispatchEvent(TheliaEvents::BEFORE_CREATEPRODUCT, new ProductEvent($this));
|
$this->dispatchEvent(TheliaEvents::BEFORE_CREATEPRODUCT, new ProductEvent($this));
|
||||||
|
|
||||||
@@ -119,6 +119,7 @@ class Product extends BaseProduct
|
|||||||
*/
|
*/
|
||||||
public function postInsert(ConnectionInterface $con = null)
|
public function postInsert(ConnectionInterface $con = null)
|
||||||
{
|
{
|
||||||
|
//$this->generateRewrittenUrl($this->getLocale());
|
||||||
$this->dispatchEvent(TheliaEvents::AFTER_CREATEPRODUCT, new ProductEvent($this));
|
$this->dispatchEvent(TheliaEvents::AFTER_CREATEPRODUCT, new ProductEvent($this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ CREATE TABLE `product`
|
|||||||
`ref` VARCHAR(255) NOT NULL,
|
`ref` VARCHAR(255) NOT NULL,
|
||||||
`visible` TINYINT DEFAULT 0 NOT NULL,
|
`visible` TINYINT DEFAULT 0 NOT NULL,
|
||||||
`position` INTEGER NOT NULL,
|
`position` INTEGER NOT NULL,
|
||||||
`template_id` INTEGER NOT NULL,
|
`template_id` INTEGER,
|
||||||
`created_at` DATETIME,
|
`created_at` DATETIME,
|
||||||
`updated_at` DATETIME,
|
`updated_at` DATETIME,
|
||||||
`version` INTEGER DEFAULT 0,
|
`version` INTEGER DEFAULT 0,
|
||||||
@@ -2167,7 +2167,7 @@ CREATE TABLE `product_version`
|
|||||||
`ref` VARCHAR(255) NOT NULL,
|
`ref` VARCHAR(255) NOT NULL,
|
||||||
`visible` TINYINT DEFAULT 0 NOT NULL,
|
`visible` TINYINT DEFAULT 0 NOT NULL,
|
||||||
`position` INTEGER NOT NULL,
|
`position` INTEGER NOT NULL,
|
||||||
`template_id` INTEGER NOT NULL,
|
`template_id` INTEGER,
|
||||||
`created_at` DATETIME,
|
`created_at` DATETIME,
|
||||||
`updated_at` DATETIME,
|
`updated_at` DATETIME,
|
||||||
`version` INTEGER DEFAULT 0 NOT NULL,
|
`version` INTEGER DEFAULT 0 NOT NULL,
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user