-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #105 from rs2487/feature/variant-stock-query
Refactored product variant gateway and added handler to load stock of…
- Loading branch information
Showing
18 changed files
with
190 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
Model/Product/Handler/Query/LoadProductVariantStockQueryHandler.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of Sulu. | ||
* | ||
* (c) MASSIVE ART WebServices GmbH | ||
* | ||
* This source file is subject to the MIT license that is bundled | ||
* with this source code in the file LICENSE. | ||
*/ | ||
|
||
namespace Sulu\Bundle\SyliusConsumerBundle\Model\Product\Handler\Query; | ||
|
||
use Sulu\Bundle\SyliusConsumerBundle\Gateway\ProductVariantGatewayInterface; | ||
use Sulu\Bundle\SyliusConsumerBundle\Model\Product\Query\LoadProductVariantStockQuery; | ||
|
||
class LoadProductVariantStockQueryHandler | ||
{ | ||
/** | ||
* @var ProductVariantGatewayInterface | ||
*/ | ||
private $gateway; | ||
|
||
public function __construct(ProductVariantGatewayInterface $productVariantGateway) | ||
{ | ||
$this->gateway = $productVariantGateway; | ||
} | ||
|
||
public function __invoke(LoadProductVariantStockQuery $query): void | ||
{ | ||
$variantData = $this->gateway->findByCodeAndVariantCode( | ||
$query->getCode(), | ||
$query->getVariantCode() | ||
); | ||
|
||
$query->setOnHand($variantData['onHand']); | ||
$query->setOnHold($variantData['onHold']); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of Sulu. | ||
* | ||
* (c) MASSIVE ART WebServices GmbH | ||
* | ||
* This source file is subject to the MIT license that is bundled | ||
* with this source code in the file LICENSE. | ||
*/ | ||
|
||
namespace Sulu\Bundle\SyliusConsumerBundle\Model\Product\Query; | ||
|
||
class LoadProductVariantStockQuery | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
private $code; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
private $variantCode; | ||
|
||
/** | ||
* @var int|null | ||
*/ | ||
private $onHold; | ||
|
||
/** | ||
* @var int|null | ||
*/ | ||
private $onHand; | ||
|
||
public function __construct(string $code, string $variantCode) | ||
{ | ||
$this->code = $code; | ||
$this->variantCode = $variantCode; | ||
} | ||
|
||
public function getCode(): string | ||
{ | ||
return $this->code; | ||
} | ||
|
||
public function getVariantCode(): string | ||
{ | ||
return $this->variantCode; | ||
} | ||
|
||
public function getOnHold(): ?int | ||
{ | ||
return $this->onHold; | ||
} | ||
|
||
public function setOnHold(?int $onHold): self | ||
{ | ||
$this->onHold = $onHold; | ||
|
||
return $this; | ||
} | ||
|
||
public function getOnHand(): ?int | ||
{ | ||
return $this->onHand; | ||
} | ||
|
||
public function setOnHand(?int $onHand): self | ||
{ | ||
$this->onHand = $onHand; | ||
|
||
return $this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{% extends "SuluSyliusConsumerBundle:Email:master-email.html.twig" %} | ||
{% extends "@SuluSyliusConsumer/Email/master-email.html.twig" %} | ||
|
||
{% block content %} | ||
{% set confirmUrl = url('sulu_sylius.customer.verify', { token: token }) %} | ||
<a href="{{ confirmUrl }}">{{ confirmUrl }}</a> | ||
{% endblock %} | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.