File size: 1,024 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 | <?php
declare(strict_types=1);
namespace Billing\Application\Commands;
use Billing\Application\CommandHandlers\CreateSubscriptionCommandHandler;
use Billing\Domain\Entities\PlanEntity;
use Billing\Domain\ValueObjects\TrialPeriodDays;
use Shared\Domain\ValueObjects\Id;
use Shared\Infrastructure\CommandBus\Attributes\Handler;
use Workspace\Domain\Entities\WorkspaceEntity;
#[Handler(CreateSubscriptionCommandHandler::class)]
class CreateSubscriptionCommand
{
public Id|WorkspaceEntity $workspace;
public Id|PlanEntity $plan;
public ?TrialPeriodDays $trialPeriodDays = null;
public function __construct(
Id|WorkspaceEntity|string $workspace,
Id|PlanEntity|string $plan
) {
$this->workspace = is_string($workspace)
? new Id($workspace) : $workspace;
$this->plan = is_string($plan)
? new Id($plan) : $plan;
}
public function setTrialPeriodDays(int $days): void
{
$this->trialPeriodDays = new TrialPeriodDays($days);
}
}
|