/**
  * @param string $productId
  * @param int $quantity (can be negative)
  * @param string $inventoryLocationId
  * @param int $transactionTypeId
  */
 public function __construct($productId, $quantity, $inventoryLocationId, $transactionTypeId)
 {
     $this->productId = Uuid::fromString($productId);
     $this->quantity = (int) $quantity;
     $this->inventoryLocationId = Uuid::fromString($inventoryLocationId);
     $this->transactionTypeId = (int) $transactionTypeId;
 }
 /**
  * @param string[] $tagIds
  */
 private function setTagIds(array $tagIds)
 {
     $this->tagIds = [];
     foreach ($tagIds as $tagId) {
         $this->tagIds[] = Uuid::fromString($tagId);
     }
 }
Beispiel #3
0
 public function setId(UuidInterface $uuid = null)
 {
     if ($uuid === null) {
         $uuid = Uuid::uuid4();
     }
     $this->id = $uuid;
 }
 /**
  * @param string[] $productIds
  */
 private function setProductIds(array $productIds)
 {
     $this->productIds = [];
     foreach ($productIds as $productId) {
         $this->productIds[] = Uuid::fromString($productId);
     }
 }
 /**
  * @param string $orderId
  * @param OrderItemQtyDTO $orderItemQtyDTO
  * @param string $comment
  * @param int $carrier ShipmentTracker::$carrier
  * @param string $trackingCode
  */
 public function __construct($orderId, OrderItemQtyDTO $orderItemQtyDTO, $comment, $carrier, $trackingCode)
 {
     $this->orderId = Uuid::fromString($orderId);
     $this->orderItemQtyDTO = $orderItemQtyDTO;
     $this->comment = (string) $comment;
     $this->carrier = (int) $carrier;
     $this->trackingCode = (string) $trackingCode;
 }
Beispiel #6
0
 public function testHamcrestMatcher()
 {
     $uuid1 = Uuid::fromString(self::UUID4_STRING);
     $uuid2 = Uuid::fromString(self::UUID1_STRING);
     MatcherAssert::assertThat($uuid1, $uuid1);
     $this->setExpectedException(AssertionError::class, 'Expected: "' . self::UUID1_STRING . '"' . PHP_EOL . '     but: was "' . self::UUID4_STRING . '"');
     MatcherAssert::assertThat($uuid1, $uuid2);
 }
 /**
  * @param string $name
  * @param string $description
  * @param int $sortOrder
  * @param int $textOptionTypeId
  */
 public function __construct($name, $description, $sortOrder, $textOptionTypeId)
 {
     $this->textOptionId = Uuid::uuid4();
     $this->name = (string) $name;
     $this->description = (string) $description;
     $this->sortOrder = (int) $sortOrder;
     $this->textOptionType = TextOptionType::createById($textOptionTypeId);
 }
 /**
  * @param string $orderId
  * @param OrderItemQtyDTO $orderItemQtyDTO
  * @param string $comment
  * @param string $shipmentExternalId
  * @param string $rateExternalId
  */
 public function __construct($orderId, OrderItemQtyDTO $orderItemQtyDTO, $comment, $shipmentExternalId, $rateExternalId)
 {
     $this->orderId = Uuid::fromString($orderId);
     $this->orderItemQtyDTO = $orderItemQtyDTO;
     $this->comment = (string) $comment;
     $this->shipmentExternalId = (string) $shipmentExternalId;
     $this->rateExternalId = (string) $rateExternalId;
 }
 public function __construct(RepositoryFactory $repositoryFactory, CartCalculatorInterface $cartCalculator, EventDispatcherInterface $eventDispatcher, PaymentGatewayInterface $paymentGateway, ShipmentGatewayInterface $shipmentGateway, FileManagerInterface $fileManager)
 {
     $this->repositoryFactory = $repositoryFactory;
     $this->cartCalculator = $cartCalculator;
     $this->eventDispatcher = $eventDispatcher;
     $this->paymentGateway = $paymentGateway;
     $this->shipmentGateway = $shipmentGateway;
     $this->fileManager = $fileManager;
     $this->holdLocationId = Uuid::uuid4();
 }
 /**
  * @param int $promotionTypeId
  * @param int $value
  * @param bool $reducesTaxSubtotal
  * @param int $maxRedemptions
  * @param DateTime $startDate
  * @param DateTime $endDate
  * @param string $productId
  * @param int $quantity
  * @param bool $flagApplyCatalogPromotions
  */
 public function __construct($promotionTypeId, $value, $reducesTaxSubtotal, $maxRedemptions, $startDate, $endDate, $productId, $quantity, $flagApplyCatalogPromotions)
 {
     $this->productQuantityDiscountId = Uuid::uuid4();
     $this->promotionTypeId = $promotionTypeId;
     $this->value = $value;
     $this->reducesTaxSubtotal = $reducesTaxSubtotal;
     $this->productId = Uuid::fromString($productId);
     $this->quantity = $quantity;
     $this->flagApplyCatalogPromotions = $flagApplyCatalogPromotions;
 }
 /**
  * @param string $cartId
  * @param string $userIdS
  * @param string $ip4
  * @param CreditCardDTO $creditCardDTO
  * @param OrderAddressDTO $shippingAddressDTO
  * @param OrderAddressDTO $billingAddressDTO
  */
 public function __construct($cartId, $userIdS, $ip4, CreditCardDTO $creditCardDTO, OrderAddressDTO $shippingAddressDTO, OrderAddressDTO $billingAddressDTO)
 {
     $this->orderId = Uuid::uuid4();
     $this->cartId = Uuid::fromString($cartId);
     $this->userId = Uuid::fromString($userIdS);
     $this->ip4 = (string) $ip4;
     $this->creditCardDTO = $creditCardDTO;
     $this->shippingAddressDTO = $shippingAddressDTO;
     $this->billingAddressDTO = $billingAddressDTO;
 }
 /**
  * @param string $remoteIp4
  * @param string|null $userId
  * @param string|null $sessionId
  */
 public function __construct($remoteIp4, $userId = null, $sessionId = null)
 {
     $this->cartId = Uuid::uuid4();
     $this->remoteIp4 = (string) $remoteIp4;
     if ($userId !== null) {
         $this->userId = Uuid::fromString($userId);
     }
     if ($sessionId !== null) {
         $this->sessionId = (string) $sessionId;
     }
 }
 /**
  * @param string $name
  * @param int $promotionTypeId
  * @param int $value
  * @param bool $reducesTaxSubtotal
  * @param int $maxRedemptions
  * @param DateTime $startDate
  * @param DateTime $endDate
  * @param string|null $tagId
  */
 public function __construct($name, $promotionTypeId, $value, $reducesTaxSubtotal, $maxRedemptions, $startDate, $endDate, $tagId = null)
 {
     $this->catalogPromotionId = Uuid::uuid4();
     $this->name = $name;
     $this->promotionTypeId = $promotionTypeId;
     $this->value = $value;
     $this->reducesTaxSubtotal = $reducesTaxSubtotal;
     $this->maxRedemptions = $maxRedemptions;
     $this->startDate = $startDate;
     $this->endDate = $endDate;
     if ($tagId !== null) {
         $this->tagId = Uuid::fromString($tagId);
     }
 }
 /**
  * @param string $fileExtension
  * @param string $basePath
  * @param int $imageType
  * @param string $mimeType
  * @param int $width
  * @param int $height
  * @param string|null $uriPrefix
  */
 public function __construct($fileExtension, $basePath, $imageType, $mimeType, $width, $height, $uriPrefix = null)
 {
     $this->id = Uuid::uuid4();
     $this->baseFileName = $this->id->getHex();
     $this->subPath = $this->buildSubPath();
     $this->fileExtension = (string) $fileExtension;
     $this->basePath = (string) $basePath;
     $this->imageType = (int) $imageType;
     $this->mimeType = (string) $mimeType;
     $this->width = (int) $width;
     $this->height = (int) $height;
     if ($uriPrefix !== null) {
         $this->uriPrefix = (string) $uriPrefix;
     }
 }
 /**
  * @param $params
  * @return array
  */
 private function getSafeParamValues($params)
 {
     $safeValues = [];
     foreach (array_values($params) as $value) {
         if (is_array($value)) {
             $safeValues[] = $this->getSafeParamValues($value);
         } else {
             if ($this->isBinary($value)) {
                 $value = Uuid::fromBytes($value)->toString();
             }
             $safeValues[] = $value;
         }
     }
     return $safeValues;
 }
 /**
  * {@inheritdoc}
  */
 public function convertToDatabaseValue($value, AbstractPlatform $platform)
 {
     if (empty($value)) {
         return null;
     }
     if ($value instanceof Uuid) {
         return $value->getBytes();
     }
     try {
         $uuid = Uuid::fromString($value);
     } catch (InvalidArgumentException $e) {
         throw ConversionException::conversionFailed($value, self::NAME);
     }
     return $uuid->getBytes();
 }
 /**
  * CreateCouponCommand constructor.
  * @param string $code
  * @param bool $flagFreeShipping
  * @param int $minOrderValue
  * @param int $maxOrderValue
  * @param bool $canCombineWithOtherCoupons
  * @param string $name
  * @param int $promotionTypeId
  * @param int $value
  * @param bool $reducesTaxSubtotal
  * @param int $maxRedemptions
  * @param DateTime $startDate
  * @param DateTime $endDate
  */
 public function __construct($code, $flagFreeShipping, $minOrderValue, $maxOrderValue, $canCombineWithOtherCoupons, $name, $promotionTypeId, $value, $reducesTaxSubtotal, $maxRedemptions, $startDate, $endDate)
 {
     $this->couponId = Uuid::uuid4();
     $this->code = $code;
     $this->flagFreeShipping = $flagFreeShipping;
     $this->minOrderValue = $minOrderValue;
     $this->maxOrderValue = $maxOrderValue;
     $this->canCombineWithOtherCoupons = $canCombineWithOtherCoupons;
     $this->name = $name;
     $this->promotionTypeId = $promotionTypeId;
     $this->value = $value;
     $this->reducesTaxSubtotal = $reducesTaxSubtotal;
     $this->maxRedemptions = $maxRedemptions;
     $this->startDate = $startDate;
     $this->endDate = $endDate;
 }
 /**
  * @param Product $product
  * @param int $quantity
  * @return UuidInterface
  * @throws EntityNotFoundException
  */
 public function findInventoryIdForProductAndQuantity(Product $product, $quantity)
 {
     $locationsAvailableQuantity = [];
     foreach ($this->findAllByProduct($product) as $inventoryTransaction) {
         // TODO: Test for null from $inventoryTransaction->getInventoryLocation()
         $inventoryLocationId = $inventoryTransaction->getInventoryLocation()->getId()->toString();
         if (!isset($locationsAvailableQuantity[$inventoryLocationId])) {
             $locationsAvailableQuantity[$inventoryLocationId] = 0;
         }
         $locationsAvailableQuantity[$inventoryLocationId] += $inventoryTransaction->getQuantity();
     }
     asort($locationsAvailableQuantity);
     foreach ($locationsAvailableQuantity as $inventoryLocationId => $availableQuantity) {
         if ($quantity <= $availableQuantity) {
             return Uuid::fromString($inventoryLocationId);
         }
     }
     throw $this->getEntityNotFoundException();
 }
Beispiel #19
0
 public function getId()
 {
     return Uuid::uuid4();
 }
 /**
  * @param string $tagId
  * @param PaginationDTO $paginationDTO
  */
 public function __construct($tagId, PaginationDTO $paginationDTO)
 {
     $this->tagId = Uuid::fromString($tagId);
     $this->paginationDTO = $paginationDTO;
 }
 /**
  * @param string $cartId
  */
 public function __construct($cartId)
 {
     $this->cartId = Uuid::fromString($cartId);
 }
 public function __construct(UserDTO $userDTO)
 {
     $this->userId = Uuid::uuid4();
     $this->userDTO = $userDTO;
 }
 /**
  * @param string $attachmentId
  */
 public function __construct($attachmentId)
 {
     $this->attachmentId = Uuid::fromString($attachmentId);
 }
 /**
  * @param string $tagId
  * @param string $imageId
  */
 public function __construct($tagId, $imageId)
 {
     $this->tagId = Uuid::fromString($tagId);
     $this->imageId = Uuid::fromString($imageId);
 }
 /**
  * @param string $productId
  * @param string $tagId
  */
 public function __construct($productId, $tagId)
 {
     $this->productId = Uuid::fromString($productId);
     $this->tagId = Uuid::fromString($tagId);
 }
 /**
  * @param string $tagId
  * @param string $optionId
  */
 public function __construct($tagId, $optionId)
 {
     $this->tagId = Uuid::fromString($tagId);
     $this->optionId = Uuid::fromString($optionId);
 }
 /**
  * @param string $id
  */
 public function __construct($id)
 {
     $this->id = Uuid::fromString($id);
 }
 /**
  * @param string $orderId
  * @param int $orderStatusTypeId
  */
 public function __construct($orderId, $orderStatusTypeId)
 {
     $this->orderId = Uuid::fromString($orderId);
     $this->orderStatusTypeId = (int) $orderStatusTypeId;
 }
 /**
  * @param string $orderId
  */
 public function __construct($orderId)
 {
     $this->orderId = Uuid::fromString($orderId);
 }
 /**
  * @param string $cartId
  * @param int $quantity
  */
 public function __construct($cartId, $quantity)
 {
     $this->cartId = Uuid::fromString($cartId);
     $this->quantity = (int) $quantity;
 }