public function __construct(InventoryLocation $inventoryLocation = null, InventoryTransactionType $type = null) { if ($type === null) { $type = InventoryTransactionType::move(); } $this->setId(); $this->setCreated(); $this->inventoryLocation = $inventoryLocation; $this->type = $type; }
public function testGetters() { $this->assertSame('Move', InventoryTransactionType::move()->getName()); $this->assertSame('Hold', InventoryTransactionType::hold()->getName()); $this->assertSame('New Products', InventoryTransactionType::newProducts()->getName()); $this->assertSame('Shipped', InventoryTransactionType::shipped()->getName()); $this->assertSame('Returned', InventoryTransactionType::returned()->getName()); $this->assertSame('Promotion', InventoryTransactionType::promotion()->getName()); $this->assertSame('Damaged', InventoryTransactionType::damaged()->getName()); $this->assertSame('Shrinkage', InventoryTransactionType::shrinkage()->getName()); }
/** * @param Product $product * @param int $quantity * @param UuidInterface $sourceLocationId * @param UuidInterface $destinationLocationId * @throws EntityNotFoundException * @throws EntityValidatorException */ public function moveProduct(Product $product, $quantity, UuidInterface $sourceLocationId, UuidInterface $destinationLocationId) { $sourceLocation = $this->inventoryLocationRepository->findOneById($sourceLocationId); $destinationLocation = $this->inventoryLocationRepository->findOneById($destinationLocationId); $this->transferProduct($product, $quantity, 'Move ' . ngettext('item', 'items', $quantity), $sourceLocation, $destinationLocation, InventoryTransactionType::move()); }