PHP code example of jungle-bay / doctrine-enum-type
1. Go to this page and download the library: Download jungle-bay/doctrine-enum-type 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/ */
jungle-bay / doctrine-enum-type example snippets
namespace Acme\Types;
use Doctrine\DBAL\Types\EnumType;
class SexType extends EnumType {
const NAME = 'sex_type';
const MAN_VALUE = 'MAN';
const WOMAN_VALUE = 'WOMAN';
protected function getValue() {
return array(
self::MAN_VALUE,
self::WOMAN_VALUE
);
}
public function getName() {
return self::NAME;
}
}
namespace Acme\Entities;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity()
*
* @ORM\Table(
* name = "users"
* )
*/
class User {
/**
* @ORM\Column(
* type = "sex_type"
* )
*/
private $sex;
}