dont show bid to carriers if closed
This commit is contained in:
parent
1910581053
commit
d9581cf991
3 changed files with 22 additions and 3 deletions
|
|
@ -15,12 +15,15 @@ class GetBidForCarrier
|
|||
/**
|
||||
* @throws InvalidArgumentException
|
||||
*/
|
||||
public function execute(GetBidForCarrierRequest $dto): Bid
|
||||
public function execute(GetBidForCarrierRequest $dto): ?Bid
|
||||
{
|
||||
$bid = $this->bidRepo->find($dto->id);
|
||||
if ($bid === null) {
|
||||
throw new InvalidArgumentException('Bid not found!');
|
||||
}
|
||||
if ($bid->isClosed() === true) {
|
||||
return null;
|
||||
}
|
||||
if ($bid->getWasOpened() === false) {
|
||||
$bid->setWasOpened(true);
|
||||
$this->bidRepo->save($bid);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue