File size: 2,426 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 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | <?php
declare(strict_types=1);
namespace User\Application\Commands;
use Affiliate\Domain\ValueObjects\Code;
use Shared\Domain\ValueObjects\CityName;
use Shared\Domain\ValueObjects\CountryCode;
use Shared\Domain\ValueObjects\Ip;
use Shared\Infrastructure\CommandBus\Attributes\Handler;
use User\Application\CommandHandlers\CreateUserCommandHandler;
use User\Domain\ValueObjects\Email;
use User\Domain\ValueObjects\FirstName;
use User\Domain\ValueObjects\Language;
use User\Domain\ValueObjects\LastName;
use User\Domain\ValueObjects\Password;
use User\Domain\ValueObjects\Role;
use User\Domain\ValueObjects\Status;
#[Handler(CreateUserCommandHandler::class)]
class CreateUserCommand
{
public Email $email;
public FirstName $firstName;
public LastName $lastName;
public ?Password $password = null;
public ?Language $language = null;
public ?Ip $ip = null;
public ?CountryCode $countryCode = null;
public ?CityName $cityName = null;
public ?Role $role = null;
public ?Status $status = null;
public ?Code $refCode = null;
public function __construct(
string $email,
string $firstName,
string $lastName
) {
$this->email = new Email($email);
$this->firstName = new FirstName($firstName);
$this->lastName = new LastName($lastName);
}
public function setPassword(?string $password): self
{
$this->password = new Password($password);
return $this;
}
public function setLanguage(string $language): self
{
$this->language = new Language($language);
return $this;
}
public function setIp(?string $ip): self
{
$this->ip = new Ip($ip);
return $this;
}
public function setCountryCode(?string $countryCode): self
{
$this->countryCode = CountryCode::from($countryCode);
return $this;
}
public function setCityName(?string $cityName): self
{
$this->cityName = new CityName($cityName);
return $this;
}
public function setRole(int $role): self
{
$this->role = Role::from($role);
return $this;
}
public function setStatus(int $status): self
{
$this->status = Status::from($status);
return $this;
}
public function setRefCode(?string $refCode): self
{
$this->refCode = new Code($refCode);
return $this;
}
}
|