PHP code example of zlikavac32 / php-enum-doctrine

1. Go to this page and download the library: Download zlikavac32/php-enum-doctrine library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

zlikavac32 / php-enum-doctrine example snippets


use Zlikavac32\DoctrineEnum\DBAL\Types\EnumType;

class YesNoEnumType extends EnumType 
{
    // ...
}

protected function enumClass(): string
{
    return \YesNoEnum::class;
}

public function getName(): string
{
    return 'enum_yes_no';
}

\Doctrine\DBAL\Types\Type::addType('enum_yes_no', \YesNoEnumType::class);

/**
 * @Column(type="enum_yes_no", nullable=true)
 * @var \YesNoEnum|null
 */
private $yesNo;

protected function columnLength(): int
{
    return 16;
}

composer