Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
InvoiceOrder.php
Go to the documentation of this file.
1 <?php
7 
17 
23 {
27  private $invoiceValidator;
28 
32  private $orderValidator;
33 
37  private $validatorResultMerger;
38 
45  public function __construct(
46  InvoiceValidatorInterface $invoiceValidator,
47  OrderValidatorInterface $orderValidator,
48  ValidatorResultMerger $validatorResultMerger
49  ) {
50  $this->invoiceValidator = $invoiceValidator;
51  $this->orderValidator = $orderValidator;
52  $this->validatorResultMerger = $validatorResultMerger;
53  }
54 
58  public function validate(
61  $capture = false,
62  array $items = [],
63  $notify = false,
64  $appendComment = false,
65  InvoiceCommentCreationInterface $comment = null,
67  ) {
68  return $this->validatorResultMerger->merge(
69  $this->invoiceValidator->validate(
70  $invoice,
71  [InvoiceQuantityValidator::class]
72  ),
73  $this->orderValidator->validate(
74  $order,
75  [CanInvoice::class]
76  )
77  );
78  }
79 }
$order
Definition: order.php:55
__construct(InvoiceValidatorInterface $invoiceValidator, OrderValidatorInterface $orderValidator, ValidatorResultMerger $validatorResultMerger)
$invoice
validate(OrderInterface $order, InvoiceInterface $invoice, $capture=false, array $items=[], $notify=false, $appendComment=false, InvoiceCommentCreationInterface $comment=null, InvoiceCreationArgumentsInterface $arguments=null)
$arguments
$items