Skip to content

sergiors/taxonomy

master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Taxonomy

Build Status Code Coverage Scrutinizer Code Quality

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

About

DEPRECATED, See https://github.com/sergiors/mapping

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages