ekapusta / doctrine-custom-types-bundle
添加自定义类型,例如MySQL的enum类型
1.4.1
2021-12-13 09:11 UTC
Requires
- php: ^5.5 || ^7.0
- doctrine/doctrine-bundle: ^1.6
- doctrine/orm: ^2.3
Requires (Dev)
- phpunit/phpunit: ^5 || ^6
- symfony/yaml: ^3 || ^4 || ^5
README
添加自定义类型,例如MySQL的enum类型。
要添加新类型
- 将其添加到
Ekapusta\DoctrineCustomTypesBundle\DBAL\Types
- 在
Ekapusta\DoctrineCustomTypesBundle\DBAL\TypeRegistry
中注册它
MySQL ENUM类型
要在注解中使用它,通过options
传递values
/**
* @var string
*
* @ORM\Column(name="sex", type="enum", options={
* "values": {"yes", "no", "maybe"},
* "default": "yes"
* })
*/
private $sex;
PostgreSQL CUBE类型
支持点和点的集合。还添加了所有cube函数。请参阅https://postgresql.ac.cn/docs/current/static/cube.html
/**
* @var Value\Point
*
* @ORM\Column(name="n_space_point", type="cube", options={
* "default": "(1, 2, 3)"
* })
*/
private $nSpacePoint;
/**
* @var Value\PointSet
*
* @ORM\Column(name="n_space_cube", type="cube", options={
* "default": "(1, 2), (3, 4)"
* })
*/
private $nSpaceCube;