File size: 1,678 Bytes
cf14c12 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | <?php
declare(strict_types=1);
namespace Billing\Application\Commands;
use Billing\Application\CommandHandlers\CountOrderCommandHandler;
use Billing\Domain\Entities\PlanEntity;
use Billing\Domain\Entities\PlanSnapshotEntity;
use Billing\Domain\ValueObjects\BillingCycle;
use Billing\Domain\ValueObjects\OrderStatus;
use Shared\Domain\ValueObjects\Id;
use Shared\Infrastructure\CommandBus\Attributes\Handler;
use Workspace\Domain\Entities\WorkspaceEntity;
#[Handler(CountOrderCommandHandler::class)]
class CountOrdersCommand
{
public ?OrderStatus $status = null;
public null|Id|WorkspaceEntity $workspace = null;
public null|Id|PlanEntity $plan = null;
public null|Id|PlanSnapshotEntity $planSnapshot = null;
public ?BillingCycle $billingCycle = null;
public function setStatus(string $status): self
{
$this->status = OrderStatus::from($status);
return $this;
}
public function setWorkspace(string|Id|WorkspaceEntity $workspace): self
{
$this->workspace = is_string($workspace) ? new Id($workspace) : $workspace;
return $this;
}
public function setPlan(string|Id|PlanEntity $plan): self
{
$this->plan = is_string($plan) ? new Id($plan) : $plan;
return $this;
}
public function setPlanSnapshot(
string|Id|PlanSnapshotEntity $planSnapshot
): self {
$this->planSnapshot = is_string($planSnapshot)
? new Id($planSnapshot) : $planSnapshot;
return $this;
}
public function setBillingCycle(string $billingCycle): self
{
$this->billingCycle = BillingCycle::from($billingCycle);
return $this;
}
}
|