/**
  * @return array
  */
 public function validatorDataProvider()
 {
     $offer = new QuoteProductOffer();
     $offer->setQuantity(10);
     $moreOffer = new QuoteProductOffer();
     $moreOffer->setAllowIncrements(true);
     $moreOffer->setQuantity(10);
     return [[null, 'orob2b.sale.quoteproductoffer.configurable.offer.blank', QuoteProductToOrderType::FIELD_QUANTITY], [[], 'orob2b.sale.quoteproductoffer.configurable.offer.blank', QuoteProductToOrderType::FIELD_QUANTITY], [[QuoteProductToOrderType::FIELD_QUANTITY => 10], 'orob2b.sale.quoteproductoffer.configurable.offer.blank', QuoteProductToOrderType::FIELD_QUANTITY], [[QuoteProductToOrderType::FIELD_OFFER => new \stdClass(), QuoteProductToOrderType::FIELD_QUANTITY => 10], 'orob2b.sale.quoteproductoffer.configurable.offer.blank', QuoteProductToOrderType::FIELD_QUANTITY], [[QuoteProductToOrderType::FIELD_OFFER => $offer, QuoteProductToOrderType::FIELD_QUANTITY => $offer->getQuantity() - 5], 'orob2b.sale.quoteproductoffer.configurable.quantity.equal', QuoteProductToOrderType::FIELD_QUANTITY], [[QuoteProductToOrderType::FIELD_OFFER => $offer, QuoteProductToOrderType::FIELD_QUANTITY => $offer->getQuantity() + 5], 'orob2b.sale.quoteproductoffer.configurable.quantity.equal', QuoteProductToOrderType::FIELD_QUANTITY], [[QuoteProductToOrderType::FIELD_OFFER => $moreOffer, QuoteProductToOrderType::FIELD_QUANTITY => $moreOffer->getQuantity() - 5], 'orob2b.sale.quoteproductoffer.configurable.quantity.less', QuoteProductToOrderType::FIELD_QUANTITY], [[QuoteProductToOrderType::FIELD_OFFER => $moreOffer, QuoteProductToOrderType::FIELD_QUANTITY => $moreOffer->getQuantity() + 5], null, null], [[QuoteProductToOrderType::FIELD_OFFER => $moreOffer, QuoteProductToOrderType::FIELD_QUANTITY => $moreOffer->getQuantity()], null, null], [[QuoteProductToOrderType::FIELD_OFFER => $offer, QuoteProductToOrderType::FIELD_QUANTITY => $offer->getQuantity()], null, null]];
 }
 /**
  * @param QuoteProductOffer|null $offer
  * @return array
  */
 protected function createResponseData(QuoteProductOffer $offer = null)
 {
     if (!$offer) {
         return [];
     }
     $price = $offer->getPrice();
     if (!$price) {
         return [];
     }
     $formatter = $this->get('oro_locale.formatter.number');
     return ['id' => $offer->getId(), 'unit' => $offer->getProductUnitCode(), 'qty' => $offer->getQuantity(), 'price' => $formatter->formatCurrency($price->getValue(), $price->getCurrency())];
 }
 /**
  * @param QuoteProductOffer $quoteProductOffer
  * @param float|null $quantity
  * @return OrderLineItem
  */
 protected function createOrderLineItem(QuoteProductOffer $quoteProductOffer, $quantity = null)
 {
     $quoteProduct = $quoteProductOffer->getQuoteProduct();
     if ($quoteProduct->getProductReplacement()) {
         $product = $quoteProduct->getProductReplacement();
     } else {
         $product = $quoteProduct->getProduct();
     }
     $orderLineItem = new OrderLineItem();
     $orderLineItem->setProduct($product)->setProductUnit($quoteProductOffer->getProductUnit())->setQuantity($quantity ?: $quoteProductOffer->getQuantity())->setPriceType($quoteProductOffer->getPriceType())->setPrice($quoteProductOffer->getPrice())->setFromExternalSource(true);
     return $orderLineItem;
 }