sergiors / taxonomy
Embedded Annotations with JSON
dev-master
2016-05-02 18:12 UTC
Requires
- php: ^5.5|^7.0
- doctrine/orm: ~2.5
Requires (Dev)
- ext-pdo_sqlite: ^1.0|^7.0
- fzaninotto/faker: ~1.5
- pdepend/pdepend: ~2.0
- phing/phing: ~2.10
- phploc/phploc: ~2.1
- phpmd/phpmd: ~2.2
- phpunit/phpunit: ~4.8
- pimple/pimple: ~1
- sebastian/phpcpd: ~2.0
- squizlabs/php_codesniffer: ~2.1
This package is not auto-updated.
Last update: 2024-12-21 19:52:51 UTC
README
Taxonomy is an easier way implements Value Object and persist them in JSON format. Like Doctrine Embeddables
Motivation
http://www.postgresql.org/docs/9.5/static/datatype-json.html
https://dev.mysql.com/doc/refman/5.7/en/json.html
Install
composer require sergiors/taxonomy "dev-master"
How to use
use Sergiors\Taxonomy\Configuration\Annotation as Taxonomy; class User { /** * @Taxonomy\Embedded( * class="Phone", * column=@Taxonomy\Column(name="phone_metadata") * ) */ private $phone; public function getPhone() { return $this->phone; } public function setPhone(Phone $phone) { $this->phone = $phone; } } /** * @Taxonomy\Embeddable */ class Phone { /** * @Taxonomy\Index */ private $number; /** * @Taxonomy\Index(name="actived") */ private $active; public function __construct() { $this->active = false; } public function getNumber() { return $this->number; } public function isActive() { return $this->active; } public function setNumber($number) { $this->number = preg_replace('/\D+/', '', $number); } }
License
MIT