-
Notifications
You must be signed in to change notification settings - Fork 0
/
doc.php
51 lines (39 loc) · 972 Bytes
/
doc.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
declare(strict_types=1);
class PetEnum extends \Gusarov112\Enum\Enum
{
const CAT = 'CAT';
const DOG = 'DOG';
}
class PetType extends \Gusarov112\PhpEnumDoctrine\DBAL\EnumType
{
public function getEnumClassName(): string
{
return PetEnum::class;
}
public function getName()
{
return 'pet_type';
}
}
use Doctrine\ORM\Mapping as ORM;
class PetEntity {
/**
* @var PetEnum
* @ORM\Column(type="pet_type")
*/
private $type;
public function getType(): PetEnum
{
return $this->type;
}
public function setType(PetEnum $type): self
{
$this->type = $type;
return $this;
}
}
\Doctrine\DBAL\Types\Type::addType('pet_type', PetType::class);
$eventManager = new \Doctrine\Common\EventManager();
$eventManager->addEventSubscriber(new \Gusarov112\PhpEnumDoctrine\EventListener\EnumUpdaterSubscriber());
#!/bin/bash ./vendor/bin/doctrine migrations:diff