vasildakov / postcode-doctrine
UK Postcode Doctrine Type
1.0.4
2016-10-07 01:54 UTC
Requires
- php: >=5.4
- doctrine/orm: ^2.5
- vasildakov/postcode: ^1.1
Requires (Dev)
- phpunit/php-code-coverage: ~3
- phpunit/phpunit: ^4.7|^5.0
- satooshi/php-coveralls: ~1.0
- squizlabs/php_codesniffer: ~2.3
Suggests
This package is not auto-updated.
Last update: 2024-12-21 21:14:17 UTC
README
Doctrine UK Postcode Type
Installation
The preferred method of installation is via Packagist and Composer. Run
the following command to install the package and add it as a requirement to
your project's composer.json
:
composer require vasildakov/postcode-doctrine
Configuration
To configure Doctrine to use vasildakov/postcode as a field type, you'll need to set up the following in your bootstrap:
\Doctrine\DBAL\Types\Type::addType('postcode', 'VasilDakov\Postcode\Doctrine\PostcodeType');
Then, in your models, you may annotate properties by setting the @Column
type to postcode
.
/** * @Entity * @Table(name="address") */ class Address { /** * @var \VasilDakov\Postcode\Postcode * @Column(type="postcode") */ protected $postcode; public function getPostcode() { return $this->postcode; } }
Copyright and License
The vasildakov/postcode-doctrine library is copyright © Vasil Dakov and licensed for use under the MIT License (MIT). Please see [LICENSE][] for more information.