Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Enum usage example
<?php
declare(strict_types = 1);
class ClientAppStatusEnum extends \Tuscanicz\Enum
{
public const STATUS_LOCKED = 0;
public const STATUS_ACTIVE = 1;
public const STATUS_TEMPORARY_DISABLED = 2;
}
class User
{
/**
* @Enum(class=ClientAppStatusEnum::class)
* @ORM\Column(type="string_enum")
* @var ClientAppStatusEnum
*/
private $status;
public function setStatus(ClientAppStatusEnum $status): void
{
$this->status = $status;
}
}
$user = new \App\Entity\User(...);
$user->setStatus(ClientAppStatusEnum::get(ClientAppStatusEnum::STATUS_ACTIVE));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment