Преглед на файлове

Refactoring DocumentUtils

feature/export_comptable
Guillaume преди 4 години
родител
ревизия
9a1ab0a80b
променени са 4 файла, в които са добавени 18 реда и са изтрити 5 реда
  1. +8
    -0
      ShopBundle/Context/DocumentUtilsInterface.php
  2. +2
    -0
      ShopBundle/Model/Document.php
  3. +5
    -3
      ShopBundle/Services/DocumentUtils.php
  4. +3
    -2
      ShopBundle/Services/UtilsManager.php

+ 8
- 0
ShopBundle/Context/DocumentUtilsInterface.php Целия файл

@@ -0,0 +1,8 @@
<?php

namespace Lc\ShopBundle\Context ;

interface DocumentUtilsInterface
{

}

+ 2
- 0
ShopBundle/Model/Document.php Целия файл

@@ -73,9 +73,11 @@ abstract class Document extends AbstractDocumentEntity implements FilterMerchant

/**
* @ORM\ManyToMany(targetEntity="Lc\ShopBundle\Context\OrderShopInterface", mappedBy="documents")
* @ORM\JoinColumn(nullable=true)
*/
protected $orderShops;


/**
* @ORM\OneToOne(targetEntity="Lc\ShopBundle\Context\OrderRefundInterface", mappedBy="document", cascade={"persist", "remove"})
*/

+ 5
- 3
ShopBundle/Services/DocumentUtils.php Целия файл

@@ -67,12 +67,14 @@ class DocumentUtils
if(isset($params['merchant'])) {
$document->setMerchant($params['merchant']) ;
}
else {
elseif(isset($params['order_shops'])) {
$document->setMerchant($params['order_shops'][0]->getMerchant()) ;
}

foreach($params['order_shops'] as $orderShop) {
$document->addOrderShop($orderShop) ;
if(isset($params['order_shops'])) {
foreach ($params['order_shops'] as $orderShop) {
$document->addOrderShop($orderShop);
}
}

$document->setType($params['type']) ;

+ 3
- 2
ShopBundle/Services/UtilsManager.php Целия файл

@@ -3,6 +3,7 @@
namespace Lc\ShopBundle\Services ;

use Lc\ShopBundle\Context\DeliveryUtilsInterface;
use Lc\ShopBundle\Context\DocumentUtilsInterface;
use Lc\ShopBundle\Context\MerchantUtilsInterface;
use Lc\ShopBundle\Context\OrderUtilsInterface;
use Lc\ShopBundle\Context\PriceUtilsInterface;
@@ -35,7 +36,7 @@ class UtilsManager
PriceUtilsInterface $priceUtils,
DeliveryUtilsInterface $deliveryUtils,
CreditUtils $creditUtils,
DocumentUtils $documentUtils,
DocumentUtilsInterface $documentUtils,
MailUtils $mailUtils,
TicketUtils $ticketUtils,
PointLocationUtils $pointLocationUtils,
@@ -97,7 +98,7 @@ class UtilsManager
return $this->creditUtils ;
}

public function getDocumentUtils(): DocumentUtils
public function getDocumentUtils(): DocumentUtilsInterface
{
return $this->documentUtils ;
}

Loading…
Отказ
Запис