Added brand storage in product table
This commit is contained in:
@@ -99,6 +99,7 @@ class Product extends BaseAction implements EventSubscriberInterface
|
|||||||
->setChapo($event->getChapo())
|
->setChapo($event->getChapo())
|
||||||
->setPostscriptum($event->getPostscriptum())
|
->setPostscriptum($event->getPostscriptum())
|
||||||
->setVisible($event->getVisible() ? 1 : 0)
|
->setVisible($event->getVisible() ? 1 : 0)
|
||||||
|
->setBrandId($event->getBrandId() <= 0 ? null : $event->getBrandId())
|
||||||
|
|
||||||
->save()
|
->save()
|
||||||
;
|
;
|
||||||
|
|||||||
@@ -164,6 +164,7 @@ class ProductController extends AbstractSeoCrudController
|
|||||||
->setPostscriptum($formData['postscriptum'])
|
->setPostscriptum($formData['postscriptum'])
|
||||||
->setVisible($formData['visible'])
|
->setVisible($formData['visible'])
|
||||||
->setDefaultCategory($formData['default_category'])
|
->setDefaultCategory($formData['default_category'])
|
||||||
|
->setBrandId($formData['brand_id'])
|
||||||
;
|
;
|
||||||
|
|
||||||
// Create and dispatch the change event
|
// Create and dispatch the change event
|
||||||
@@ -213,6 +214,10 @@ class ProductController extends AbstractSeoCrudController
|
|||||||
$array[$key][] = $value;
|
$array[$key][] = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Product $object
|
||||||
|
* @return ProductModificationForm
|
||||||
|
*/
|
||||||
protected function hydrateObjectForm($object)
|
protected function hydrateObjectForm($object)
|
||||||
{
|
{
|
||||||
// Find product's sale elements
|
// Find product's sale elements
|
||||||
@@ -320,7 +325,8 @@ class ProductController extends AbstractSeoCrudController
|
|||||||
'description' => $object->getDescription(),
|
'description' => $object->getDescription(),
|
||||||
'postscriptum' => $object->getPostscriptum(),
|
'postscriptum' => $object->getPostscriptum(),
|
||||||
'visible' => $object->getVisible(),
|
'visible' => $object->getVisible(),
|
||||||
'default_category' => $object->getDefaultCategoryId()
|
'default_category' => $object->getDefaultCategoryId(),
|
||||||
|
'brand_id' => $object->getBrandId()
|
||||||
);
|
);
|
||||||
|
|
||||||
// Setup the object form
|
// Setup the object form
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ class ProductUpdateEvent extends ProductCreateEvent
|
|||||||
protected $chapo;
|
protected $chapo;
|
||||||
protected $description;
|
protected $description;
|
||||||
protected $postscriptum;
|
protected $postscriptum;
|
||||||
|
protected $brand_id;
|
||||||
|
|
||||||
|
|
||||||
public function __construct($product_id)
|
public function __construct($product_id)
|
||||||
{
|
{
|
||||||
@@ -72,4 +74,22 @@ class ProductUpdateEvent extends ProductCreateEvent
|
|||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int $brand_id
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function setBrandId($brand_id)
|
||||||
|
{
|
||||||
|
$this->brand_id = $brand_id;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function getBrandId()
|
||||||
|
{
|
||||||
|
return $this->brand_id;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ use Thelia\Core\Event\Product\ProductSetTemplateEvent;
|
|||||||
use Thelia\Core\Event\Product\ProductToggleVisibilityEvent;
|
use Thelia\Core\Event\Product\ProductToggleVisibilityEvent;
|
||||||
use Thelia\Core\Event\Product\ProductUpdateEvent;
|
use Thelia\Core\Event\Product\ProductUpdateEvent;
|
||||||
use Thelia\Model\AccessoryQuery;
|
use Thelia\Model\AccessoryQuery;
|
||||||
|
use Thelia\Model\BrandQuery;
|
||||||
use Thelia\Model\CategoryQuery;
|
use Thelia\Model\CategoryQuery;
|
||||||
use Thelia\Model\ContentQuery;
|
use Thelia\Model\ContentQuery;
|
||||||
use Thelia\Model\CurrencyQuery;
|
use Thelia\Model\CurrencyQuery;
|
||||||
@@ -115,6 +116,7 @@ class ProductTest extends TestCaseWithURLToolSetup
|
|||||||
{
|
{
|
||||||
$event = new ProductUpdateEvent($product->getId());
|
$event = new ProductUpdateEvent($product->getId());
|
||||||
$defaultCategory = CategoryQuery::create()->select('id')->addAscendingOrderByColumn('RAND()')->findOne();
|
$defaultCategory = CategoryQuery::create()->select('id')->addAscendingOrderByColumn('RAND()')->findOne();
|
||||||
|
$brandId = BrandQuery::create()->findOne()->getId();
|
||||||
$event
|
$event
|
||||||
->setLocale('fr_FR')
|
->setLocale('fr_FR')
|
||||||
->setTitle('test MAJ titre en français')
|
->setTitle('test MAJ titre en français')
|
||||||
@@ -123,6 +125,7 @@ class ProductTest extends TestCaseWithURLToolSetup
|
|||||||
->setPostscriptum('test postscriptum fr')
|
->setPostscriptum('test postscriptum fr')
|
||||||
->setVisible(1)
|
->setVisible(1)
|
||||||
->setDefaultCategory($defaultCategory)
|
->setDefaultCategory($defaultCategory)
|
||||||
|
->setBrandId($brandId)
|
||||||
->setDispatcher($this->getDispatcher());
|
->setDispatcher($this->getDispatcher());
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user