ソースを参照

Configuration easy_admin & ajout producteur/ catégories de porduits / produit family

reduction
Fab 4年前
コミット
4820806e9b
3個のファイルの変更18行の追加7行の削除
  1. +11
    -6
      ShopBundle/Controller/Admin/AdminController.php
  2. +6
    -0
      ShopBundle/Model/ProductCategory.php
  3. +1
    -1
      ShopBundle/Model/ProductFamily.php

+ 11
- 6
ShopBundle/Controller/Admin/AdminController.php ファイルの表示

@@ -8,22 +8,27 @@ use Symfony\Component\Security\Core\Security;
class AdminController extends EasyAdminController
{

protected $security ;
protected $security;

public function __construct(Security $security)
{
$this->security = $security ;
$this->security = $security;
}

public function updateEntity($entity)
{
$this->setUpdated($entity) ;
$this->setUpdated($entity);
parent::updateEntity($entity);
}

public function persistEntity($entity)
{

if (method_exists($entity, 'setMerchant')) {
$entity->setMerchant($this->security->getUser()->getMerchant());

}

if (method_exists($entity, 'setCreatedAt')) {
$entity->setCreatedAt(new \DateTime());
}
@@ -37,14 +42,14 @@ class AdminController extends EasyAdminController
$entity->getAddress()->setCreatedBy($this->security->getUser());
}

$this->setUpdated($entity) ;
$this->setUpdated($entity);

if (method_exists($entity, 'setPosition')) {
$entity->setPosition(0) ;
$entity->setPosition(0);
}

if (method_exists($entity, 'setStatus')) {
$entity->setStatus(1) ;
$entity->setStatus(1);
}

parent::persistEntity($entity);

+ 6
- 0
ShopBundle/Model/ProductCategory.php ファイルの表示

@@ -21,6 +21,12 @@ abstract class ProductCategory extends AbstractDocumentEntity
*/
protected $productCategories;

public function __toString()
{
// TODO: Implement __toString() method.
return $this->getTitle();
}

public function __construct()
{
$this->productCategories = new ArrayCollection();

+ 1
- 1
ShopBundle/Model/ProductFamily.php ファイルの表示

@@ -24,7 +24,7 @@ abstract class ProductFamily extends AbstractDocumentEntity

/**
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\TaxRateInterface")
* @ORM\JoinColumn(nullable=false)
* @ORM\JoinColumn(nullable=true)
*/
protected $taxRate;


読み込み中…
キャンセル
保存