ekapusta/doctrine-custom-types-bundle

Add custom types like MySQL's enum

1.4.0 2021-03-29 05:38 UTC

This package is auto-updated.

Last update: 2021-09-29 06:38:27 UTC


README

Build Status

Add custom types like MySQL's enum.

To add new type

  1. Add it to Ekapusta\DoctrineCustomTypesBundle\DBAL\Types
  2. Register it at Ekapusta\DoctrineCustomTypesBundle\DBAL\TypeRegistry

MySQL ENUM type

To use it in annotations, pass values through options:

/**
 * @var string
 *
 * @ORM\Column(name="sex", type="enum", options={
 *     "values": {"yes", "no", "maybe"},
 *     "default": "yes"
 * })
 */
private $sex;

PostgreSQL CUBE type

Supports both points and point's sets. Also all cube's functions added. See https://www.postgresql.org/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;