brazanation / document-doctrine-types
Library to provide Document as Doctrine Types
v0.1.0
2017-08-11 21:39 UTC
Requires
- php: ^5.6 || ^7.0
- brazanation/documents: ^0.7
- doctrine/dbal: ^2.5
Requires (Dev)
- codacy/coverage: ^1.0
- doctrine/dbal: ^2.5
- phpunit/phpunit: ^5.5
This package is auto-updated.
Last update: 2024-11-04 08:06:36 UTC
README
Installation
composer require brazanation/document-doctrine-types ^0.1
How to Use?
First of all, register the Document Types after Doctrine Connection.
// bootstrap.php // ... other code $connection = \Doctrine\DBAL\DriverManager::getConnection($conn, $config, new \Doctrine\Common\EventManager()); \Brazanation\Doctrine\TypeExtension::register($connection); // ... more code
Define the entity's property as the document
/** * @Entity @Table(name="persons") */ class Person { /** * @Id * @Column(type="cpf") * @var \Brazanation\Documents\Cpf */ private $cpf; public function __construct(\Brazanation\Documents\Cpf $cpf) { $this->cpf = $cpf; } public function getCpf() { return $this->cpf; } }