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



use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection; use Doctrine\Common\Collections\Collection;
use Gedmo\Mapping\Annotation as Gedmo;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Lc\ShopBundle\Context\DocumentInterface; use Lc\ShopBundle\Context\DocumentInterface;
use Lc\ShopBundle\Context\FilterMerchantInterface; use Lc\ShopBundle\Context\FilterMerchantInterface;
*/ */
protected $documents; 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() public function __construct()
{ {
$this->orderStatusHistories = new ArrayCollection(); $this->orderStatusHistories = new ArrayCollection();

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

namespace Lc\ShopBundle\Model; namespace Lc\ShopBundle\Model;


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



/** /**
* @ORM\MappedSuperclass() * @ORM\MappedSuperclass()
*/ */
protected $origin; 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 public function getOrderShop(): ?OrderShop
{ {
return $this->orderShop; return $this->orderShop;

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



$orderShop = $this->setOrderStatus('cart', $orderShop); $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->persist($orderShop);
$this->em->flush(); $this->em->flush();



Loading…
Cancel
Save