Browse Source

Processus de commandes

feature/export_comptable
Fab 4 years ago
parent
commit
2d2e3f84c0
3 changed files with 31 additions and 11 deletions
  1. +15
    -0
      ShopBundle/Model/OrderShop.php
  2. +16
    -0
      ShopBundle/Model/OrderStatusHistory.php
  3. +0
    -11
      ShopBundle/Services/OrderUtils.php

+ 15
- 0
ShopBundle/Model/OrderShop.php View File

@@ -4,6 +4,7 @@ namespace Lc\ShopBundle\Model;

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Gedmo\Mapping\Annotation as Gedmo;
use Doctrine\ORM\Mapping as ORM;
use Lc\ShopBundle\Context\DocumentInterface;
use Lc\ShopBundle\Context\FilterMerchantInterface;
@@ -95,6 +96,20 @@ abstract class OrderShop extends AbstractEntity implements FilterMerchantInterfa
*/
protected $documents;

/**
* @Gedmo\Blameable(on="create")
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\UserInterface")
* @ORM\JoinColumn(nullable=true)
*/
protected $createdBy;

/**
* @Gedmo\Blameable(on="update")
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\UserInterface")
* @ORM\JoinColumn(nullable=true)
*/
protected $updatedBy;

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

+ 16
- 0
ShopBundle/Model/OrderStatusHistory.php View File

@@ -3,6 +3,8 @@
namespace Lc\ShopBundle\Model;

use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;


/**
* @ORM\MappedSuperclass()
@@ -26,6 +28,20 @@ abstract class OrderStatusHistory extends AbstractEntity
*/
protected $origin;

/**
* @Gedmo\Blameable(on="create")
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\UserInterface")
* @ORM\JoinColumn(nullable=true)
*/
protected $createdBy;

/**
* @Gedmo\Blameable(on="update")
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\UserInterface")
* @ORM\JoinColumn(nullable=true)
*/
protected $updatedBy;

public function getOrderShop(): ?OrderShop
{
return $this->orderShop;

+ 0
- 11
ShopBundle/Services/OrderUtils.php View File

@@ -121,17 +121,6 @@ class OrderUtils

$orderShop = $this->setOrderStatus('cart', $orderShop);

if ($this->security->getUser()) {
$orderShop->setCreatedBy($this->security->getUser());
$orderShop->setUpdatedBy($this->security->getUser());
} else {
// createdBy doit pouvoir être NULL pour OrderShop, en attendant qu'on en discute, j'assigne ça au premier de la base
$userRepository = $this->em->getRepository($this->em->getClassMetadata(UserInterface::class)->getName());
$user = $userRepository->find(1);
$orderShop->setCreatedBy($user);
$orderShop->setUpdatedBy($user);
}

$this->em->persist($orderShop);
$this->em->flush();


Loading…
Cancel
Save