Pārlūkot izejas kodu

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

reduction
Fab pirms 4 gadiem
vecāks
revīzija
4820806e9b
3 mainītis faili ar 18 papildinājumiem un 7 dzēšanām
  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 Parādīt failu

@@ -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 Parādīt failu

@@ -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 Parādīt failu

@@ -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;


Notiek ielāde…
Atcelt
Saglabāt