Componette

Componette

nepada

nepada / birth-number-doctrine v1.1.1

Czech birth number type for Doctrine.

download-cloud-line composer require nepada/birth-number-doctrine

Czech birth number Doctrine type

Build Status Coverage Status Downloads this Month Latest stable

Installation

Via Composer:

$ composer require nepada/birth-number-doctrine

Register the type in your bootstrap:

\Doctrine\DBAL\Types\Type::addType(
    \Nepada\BirthNumberDoctrine\BirthNumberType::NAME,
    \Nepada\BirthNumberDoctrine\BirthNumberType::class
);

In Nette with nettrine/dbal integration, you can register the types in your configuration:

dbal:
    connection:
        types:
            Nepada\BirthNumber\BirthNumber: Nepada\BirthNumberDoctrine\BirthNumberType

Usage

BirthNumberType maps database value to Birth number value object (see nepada/birth-number for further details) and back. The Birth number is stored as fixed string without the slash (e.g. 0001010009).

Example usage in the entity:

use Doctrine\ORM\Mapping as ORM;
use Nepada\BirthNumber\BirthNumber;

/**
 * @ORM\Entity
 */
class Person
{

    /** @ORM\Column(type=BirthNumber::class, nullable=false) */
    private BirthNumber $birthNumber;

    public function getBirthNumber(): BirthNumber
    {
        return $this->birthNumber;
    }

}

Example usage in query builder:

$result = $repository->createQueryBuilder('foo')
    ->select('foo')
    ->where('foo.birthNumber = :birthNumber')
     // the parameter value is automatically normalized to '0001010009'
    ->setParameter('birthNumber', '000101 / 0009', BirthNumberType::NAME)
    ->getQuery()
    ->getResult();
  • v1.1.1 1.1.1

    • PHP 8.2 compatibility
  • v1.1.0 1.1.0

    • PHP 8.1 compatibility.
    • Add support for doctrine/dbal 3.x.
  • v1.0.1 1.0.1

    • PHP 8.0 compatiblity.
  • v1.0.0 1.0.0

    • Initial release.
bar-chart-fill

Statistics

download-cloud-fill
1263
star-fill
2
bug-fill
0
flashlight-fill
8d
price-tag-2-line

Badges

guide-fill

Dependencies

php (>=7.4.0)
doctrine/dbal (^2.6@dev)
Componette Componette felix@nette.org