Skip to content

Files

Latest commit

2f467fe · Apr 4, 2017

History

History
This branch is 522 commits behind DesignPatternsPHP/DesignPatternsPHP:main.

EAV

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Mar 8, 2017
Aug 21, 2015
Sep 22, 2016
Sep 22, 2016
Apr 4, 2017
Sep 22, 2016

The Entity–attribute–value (EAV) pattern in order to implement EAV model with PHP.

Purpose

The Entity–attribute–value (EAV) model is a data model to describe entities where the number of attributes (properties, parameters) that can be used to describe them is potentially vast, but the number that will actually apply to a given entity is relatively modest.

UML Diagram

EAV UML Diagram

Code

You can also find this code on GitHub

Entity.php

.. literalinclude:: Entity.php
    :language: php
    :linenos:

Attribute.php

.. literalinclude:: Attribute.php
   :language: php
   :linenos:

Value.php

.. literalinclude:: Value.php
    :language: php
    :linenos:

Test

Tests/EAVTest.php

.. literalinclude:: Tests/EntityTest.php
   :language: php
   :linenos: