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