-
Notifications
You must be signed in to change notification settings - Fork 8
Implemented doctrine enums #339
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Signed-off-by: MarioRadu <[email protected]>
Signed-off-by: MarioRadu <[email protected]>
Signed-off-by: MarioRadu <[email protected]>
Signed-off-by: MarioRadu <[email protected]>
Signed-off-by: MarioRadu <[email protected]>
Signed-off-by: MarioRadu <[email protected]>
Signed-off-by: MarioRadu <[email protected]>
Signed-off-by: MarioRadu <[email protected]>
Signed-off-by: MarioRadu <[email protected]>
Signed-off-by: MarioRadu <[email protected]>
Signed-off-by: MarioRadu <[email protected]>
Signed-off-by: MarioRadu <[email protected]>
Signed-off-by: MarioRadu <[email protected]>
Signed-off-by: MarioRadu <[email protected]>
Signed-off-by: MarioRadu <[email protected]>
Signed-off-by: MarioRadu <[email protected]>
Signed-off-by: MarioRadu <[email protected]>
Signed-off-by: MarioRadu <[email protected]>
| } | ||
|
|
||
| if ($identityClass->$methodName() !== $option['value']) { | ||
| if ($identityClass->$methodName()->value !== $option['value']) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| if ($identityClass->$methodName()->value !== $option['value']) { | |
| if ($identityClass->$methodName() !== $option['value']) { |
We cannot force ->value on $methodName because this can be a getter on any property from the identity_class. We can still check status as long as we use the enum in the option value. See below example:
config/autoload/authentication.global.php:
'options' => [
'status' => [
'value' => \Admin\Admin\Enum\AdminStatusEnum::Active,
'message' => \Admin\App\Message::ADMIN_INACTIVE,
],
],| #[ORM\Column(name: 'password', type: 'string', length: 100)] | ||
| protected string $password; | ||
|
|
||
| #[ORM\Column( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#[ORM\Column(type: 'admin_status_enum', options: ['default' => AdminStatusEnum::Active])]| columnDefinition: "ENUM('yes', 'no')" | ||
| )] | ||
| protected ?string $isMobile = null; | ||
| #[ORM\Column(type: 'yes_no_enum', nullable: true, enumType: YesNoEnum::class)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| #[ORM\Column(type: 'yes_no_enum', nullable: true, enumType: YesNoEnum::class)] | |
| #[ORM\Column(type: 'yes_no_enum', nullable: true)] |
|
|
||
| #[ORM\Column(name: "loginStatus", type: "string", nullable: true, columnDefinition: "ENUM('success', 'fail')")] | ||
| protected ?string $loginStatus = null; | ||
| #[ORM\Column(type: 'success_failure_enum', nullable: true, enumType: SuccessFailureEnum::class)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| #[ORM\Column(type: 'success_failure_enum', nullable: true, enumType: SuccessFailureEnum::class)] | |
| #[ORM\Column(type: 'success_failure_enum', nullable: true)] |
| self::ROLE_ADMIN, | ||
| self::ROLE_SUPERUSER, | ||
| ]; | ||
| #[ORM\Column( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| #[ORM\Column( | |
| #[ORM\Column(type: 'admin_role_enum', options: ['default' => AdminRoleEnum::Admin])] |
| 'admins' => $result['rows'], | ||
| 'statuses' => Admin::STATUSES, | ||
| 'identifier' => Setting::IDENTIFIER_TABLE_ADMIN_LIST_SELECTED_COLUMNS, | ||
| 'statuses' => AdminStatusEnum::cases(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 'statuses' => AdminStatusEnum::cases(), |
No description provided.