Skip to content

Commit

Permalink
#469 enum p1
Browse files Browse the repository at this point in the history
 #469 enum p2

 #469 enum p3

 #469 enum p4

 #469 enum p5

 #469 enum p6

 #469 enum p7

 #469 enum p8

 #469 enum p9

 #469 enum p10
  • Loading branch information
eventhorizonpl committed Jan 27, 2022
1 parent 915e4da commit 112e682
Show file tree
Hide file tree
Showing 83 changed files with 278 additions and 533 deletions.
14 changes: 5 additions & 9 deletions src/Entity/AccountOperation.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class AccountOperation
#[Assert\NotBlank(groups: ['system'])]
#[Assert\Type('string', groups: ['system'])]
#[ORM\Column(length: 8, type: Types::STRING)]
private string $type;
private AccountOperationTypeEnum $type;

public function __construct()
{
Expand Down Expand Up @@ -129,16 +129,16 @@ public function setSmsNotifications(int $smsNotifications): self
return $this;
}

public function getType(): ?string
public function getType(): ?AccountOperationTypeEnum
{
return $this->type;
}

public static function getTypeFormChoices(): array
{
return [
AccountOperationTypeEnum::DEPOSIT => AccountOperationTypeEnum::DEPOSIT,
AccountOperationTypeEnum::WITHDRAW => AccountOperationTypeEnum::WITHDRAW,
AccountOperationTypeEnum::DEPOSIT->value => AccountOperationTypeEnum::DEPOSIT->value,
AccountOperationTypeEnum::WITHDRAW->value => AccountOperationTypeEnum::WITHDRAW->value,
];
}

Expand All @@ -147,12 +147,8 @@ public static function getTypeValidationChoices(): array
return array_keys(self::getTypeFormChoices());
}

public function setType(string $type): self
public function setType(AccountOperationTypeEnum $type): self
{
if (!(\in_array($type, self::getTypeValidationChoices(), true))) {
throw new InvalidArgumentException('Invalid type');
}

$this->type = $type;

return $this;
Expand Down
22 changes: 9 additions & 13 deletions src/Entity/Achievement.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ class Achievement
#[Assert\Choice(callback: 'getTypeValidationChoices', groups: ['form', 'system'])]
#[Assert\Length(groups: ['form', 'system'], max: 24)]
#[Assert\NotBlank(groups: ['form', 'system'])]
#[Assert\Type('string', groups: ['form', 'system'])]
#[ORM\Column(length: 24, type: Types::STRING)]
private ?string $type;
#[Assert\Type('AchievementTypeEnum', groups: ['form', 'system'])]
#[ORM\Column(enumType: AchievementTypeEnum::class, length: 24, type: Types::STRING)]
private ?AchievementTypeEnum $type;

public function __construct()
{
Expand Down Expand Up @@ -120,18 +120,18 @@ public function setRequirement(?int $requirement): self
return $this;
}

public function getType(): ?string
public function getType(): ?AchievementTypeEnum
{
return $this->type;
}

public static function getTypeFormChoices(): array
{
return [
AchievementTypeEnum::COMPLETED_ROUTINE => AchievementTypeEnum::COMPLETED_ROUTINE,
AchievementTypeEnum::COMPLETED_GOAL => AchievementTypeEnum::COMPLETED_GOAL,
AchievementTypeEnum::COMPLETED_PROJECT => AchievementTypeEnum::COMPLETED_PROJECT,
AchievementTypeEnum::CREATED_NOTE => AchievementTypeEnum::CREATED_NOTE,
AchievementTypeEnum::COMPLETED_ROUTINE->value => AchievementTypeEnum::COMPLETED_ROUTINE->value,
AchievementTypeEnum::COMPLETED_GOAL->value => AchievementTypeEnum::COMPLETED_GOAL->value,
AchievementTypeEnum::COMPLETED_PROJECT->value => AchievementTypeEnum::COMPLETED_PROJECT->value,
AchievementTypeEnum::CREATED_NOTE->value => AchievementTypeEnum::CREATED_NOTE->value,
];
}

Expand All @@ -140,12 +140,8 @@ public static function getTypeValidationChoices(): array
return array_keys(self::getTypeFormChoices());
}

public function setType(?string $type): self
public function setType(?AchievementTypeEnum $type): self
{
if (!(\in_array($type, self::getTypeValidationChoices(), true))) {
throw new InvalidArgumentException('Invalid type');
}

$this->type = $type;

return $this;
Expand Down
14 changes: 5 additions & 9 deletions src/Entity/Answer.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class Answer
#[Assert\NotBlank(groups: ['form', 'system'])]
#[Assert\Type('string', groups: ['form', 'system'])]
#[ORM\Column(length: 24, type: Types::STRING)]
private string $type;
private AnswerTypeEnum $type;

public function __construct()
{
Expand Down Expand Up @@ -81,16 +81,16 @@ public function setQuestion(Question $question): self
return $this;
}

public function getType(): ?string
public function getType(): ?AnswerTypeEnum
{
return $this->type;
}

public static function getTypeFormChoices(): array
{
return [
AnswerTypeEnum::DEFINED => AnswerTypeEnum::DEFINED,
AnswerTypeEnum::OWN => AnswerTypeEnum::OWN,
AnswerTypeEnum::DEFINED->value => AnswerTypeEnum::DEFINED->value,
AnswerTypeEnum::OWN->value => AnswerTypeEnum::OWN->value,
];
}

Expand All @@ -99,12 +99,8 @@ public static function getTypeValidationChoices(): array
return array_keys(self::getTypeFormChoices());
}

public function setType(string $type): self
public function setType(AnswerTypeEnum $type): self
{
if (!(\in_array($type, self::getTypeValidationChoices(), true))) {
throw new InvalidArgumentException('Invalid type');
}

$this->type = $type;

return $this;
Expand Down
36 changes: 14 additions & 22 deletions src/Entity/Contact.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class Contact
#[Assert\NotBlank(groups: ['system'])]
#[Assert\Type('string', groups: ['system'])]
#[ORM\Column(length: 8, type: Types::STRING)]
private string $status;
private ContactStatusEnum $status;

#[Assert\Length(groups: ['form', 'system'], max: 255)]
#[Assert\NotBlank(groups: ['form', 'system'])]
Expand All @@ -59,7 +59,7 @@ class Contact
#[Assert\Type('string', groups: ['form', 'system'])]
#[Groups(['gdpr'])]
#[ORM\Column(length: 16, type: Types::STRING)]
private string $type;
private ContactTypeEnum $type;

public function __construct()
{
Expand Down Expand Up @@ -99,20 +99,20 @@ public function setContent(?string $content): self
return $this;
}

public function getStatus(): ?string
public function getStatus(): ?ContactStatusEnum
{
return $this->status;
}

public static function getStatusFormChoices(): array
{
return [
ContactStatusEnum::CLOSED => ContactStatusEnum::CLOSED,
ContactStatusEnum::ON_HOLD => ContactStatusEnum::ON_HOLD,
ContactStatusEnum::OPEN => ContactStatusEnum::OPEN,
ContactStatusEnum::PENDING => ContactStatusEnum::PENDING,
ContactStatusEnum::SOLVED => ContactStatusEnum::SOLVED,
ContactStatusEnum::SPAM => ContactStatusEnum::SPAM,
ContactStatusEnum::CLOSED->value => ContactStatusEnum::CLOSED->value,
ContactStatusEnum::ON_HOLD->value => ContactStatusEnum::ON_HOLD->value,
ContactStatusEnum::OPEN->value => ContactStatusEnum::OPEN->value,
ContactStatusEnum::PENDING->value => ContactStatusEnum::PENDING->value,
ContactStatusEnum::SOLVED->value => ContactStatusEnum::SOLVED->value,
ContactStatusEnum::SPAM->value => ContactStatusEnum::SPAM->value,
];
}

Expand All @@ -121,12 +121,8 @@ public static function getStatusValidationChoices(): array
return array_keys(self::getStatusFormChoices());
}

public function setStatus(string $status): self
public function setStatus(ContactStatusEnum $status): self
{
if (!(\in_array($status, self::getStatusValidationChoices(), true))) {
throw new InvalidArgumentException('Invalid status');
}

$this->status = $status;

return $this;
Expand All @@ -144,16 +140,16 @@ public function setTitle(?string $title): self
return $this;
}

public function getType(): ?string
public function getType(): ?ContactTypeEnum
{
return $this->type;
}

public static function getTypeFormChoices(): array
{
return [
ContactTypeEnum::FEATURE_IDEA => ContactTypeEnum::FEATURE_IDEA,
ContactTypeEnum::QUESTION => ContactTypeEnum::QUESTION,
ContactTypeEnum::FEATURE_IDEA->value => ContactTypeEnum::FEATURE_IDEA->value,
ContactTypeEnum::QUESTION->value => ContactTypeEnum::QUESTION->value,
];
}

Expand All @@ -162,12 +158,8 @@ public static function getTypeValidationChoices(): array
return array_keys(self::getTypeFormChoices());
}

public function setType(string $type): self
public function setType(ContactTypeEnum $type): self
{
if (!(\in_array($type, self::getTypeValidationChoices(), true))) {
throw new InvalidArgumentException('Invalid type');
}

$this->type = $type;

return $this;
Expand Down
14 changes: 5 additions & 9 deletions src/Entity/Profile.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class Profile
#[Assert\Type('string')]
#[Groups(['gdpr'])]
#[ORM\Column(length: 8, nullable: true, type: Types::STRING)]
private ?string $theme;
private ?ProfileThemeEnum $theme;

#[Assert\Length(max: 36)]
#[Assert\Timezone]
Expand Down Expand Up @@ -291,16 +291,16 @@ public function setShowMotivationalMessages(bool $showMotivationalMessages): sel
return $this;
}

public function getTheme(): ?string
public function getTheme(): ?ProfileThemeEnum
{
return $this->theme;
}

public static function getThemeFormChoices(): array
{
return [
ProfileThemeEnum::DARK => ProfileThemeEnum::DARK,
ProfileThemeEnum::LIGHT => ProfileThemeEnum::LIGHT,
ProfileThemeEnum::DARK->value => ProfileThemeEnum::DARK->value,
ProfileThemeEnum::LIGHT->value => ProfileThemeEnum::LIGHT->value,
];
}

Expand All @@ -309,12 +309,8 @@ public static function getThemeValidationChoices(): array
return array_keys(self::getThemeFormChoices());
}

public function setTheme(?string $theme): self
public function setTheme(?ProfileThemeEnum $theme): self
{
if (!(\in_array($theme, self::getThemeValidationChoices(), true))) {
throw new InvalidArgumentException('Invalid theme');
}

$this->theme = $theme;

return $this;
Expand Down
16 changes: 6 additions & 10 deletions src/Entity/Promotion.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class Promotion
#[Assert\NotBlank(groups: ['form', 'system'])]
#[Assert\Type('string', groups: ['form', 'system'])]
#[ORM\Column(length: 24, type: Types::STRING)]
private string $type;
private PromotionTypeEnum $type;

public function __construct()
{
Expand Down Expand Up @@ -159,17 +159,17 @@ public function setSmsNotifications(int $smsNotifications): self
return $this;
}

public function getType(): ?string
public function getType(): ?PromotionTypeEnum
{
return $this->type;
}

public static function getTypeFormChoices(): array
{
return [
PromotionTypeEnum::EXISTING_ACCOUNT => PromotionTypeEnum::EXISTING_ACCOUNT,
PromotionTypeEnum::NEW_ACCOUNT => PromotionTypeEnum::NEW_ACCOUNT,
PromotionTypeEnum::SYSTEM => PromotionTypeEnum::SYSTEM,
PromotionTypeEnum::EXISTING_ACCOUNT->value => PromotionTypeEnum::EXISTING_ACCOUNT->value,
PromotionTypeEnum::NEW_ACCOUNT->value => PromotionTypeEnum::NEW_ACCOUNT->value,
PromotionTypeEnum::SYSTEM->value => PromotionTypeEnum::SYSTEM->value,
];
}

Expand All @@ -178,12 +178,8 @@ public static function getTypeValidationChoices(): array
return array_keys(self::getTypeFormChoices());
}

public function setType(string $type): self
public function setType(PromotionTypeEnum $type): self
{
if (!(\in_array($type, self::getTypeValidationChoices(), true))) {
throw new InvalidArgumentException('Invalid type');
}

$this->type = $type;

return $this;
Expand Down
14 changes: 5 additions & 9 deletions src/Entity/Question.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class Question
#[Assert\NotBlank(groups: ['form', 'system'])]
#[Assert\Type('string', groups: ['form', 'system'])]
#[ORM\Column(length: 24, type: Types::STRING)]
private string $type;
private QuestionTypeEnum $type;

public function __construct()
{
Expand Down Expand Up @@ -111,16 +111,16 @@ public function setTitle(?string $title): self
return $this;
}

public function getType(): ?string
public function getType(): ?QuestionTypeEnum
{
return $this->type;
}

public static function getTypeFormChoices(): array
{
return [
QuestionTypeEnum::MULTIPLE_ANSWER => QuestionTypeEnum::MULTIPLE_ANSWER,
QuestionTypeEnum::SINGLE_ANSWER => QuestionTypeEnum::SINGLE_ANSWER,
QuestionTypeEnum::MULTIPLE_ANSWER->value => QuestionTypeEnum::MULTIPLE_ANSWER->value,
QuestionTypeEnum::SINGLE_ANSWER->value => QuestionTypeEnum::SINGLE_ANSWER->value,
];
}

Expand All @@ -129,12 +129,8 @@ public static function getTypeValidationChoices(): array
return array_keys(self::getTypeFormChoices());
}

public function setType(string $type): self
public function setType(QuestionTypeEnum $type): self
{
if (!(\in_array($type, self::getTypeValidationChoices(), true))) {
throw new InvalidArgumentException('Invalid type');
}

$this->type = $type;

return $this;
Expand Down
Loading

0 comments on commit 112e682

Please sign in to comment.