소스 검색

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;


Loading…
취소
저장