PHP code example of gollumsf / doctrine-enum

1. Go to this page and download the library: Download gollumsf/doctrine-enum 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/ */

    

gollumsf / doctrine-enum example snippets


namespace App\Doctrine;

use GollumSF\Doctrine\EnumType;
use App\Entity\MyType;

class MyTypeEnum extends EnumType {
	
	public function getEnum(): string {
		return MyType::class;
	}
}

namespace App\Entity;

use GollumSF\Enum\Enum;
use Doctrine\ORM\Mapping as ORM;

class MyType extends Enum {
	const VALUE1 = 'VALUE1';
	const VALUE2 = 'VALUE2';
	const VALUE3 = 'VALUE3';
}

/**
 * @ORM\Entity()
 */
class Entity {
	
	/**
	 * @ORM\Column(type="enum_my_type")
	 * @var int
	 */
	private $enum;
	
	/////////
	// ... //
	/////////
	
}