Add Entity-Attribute-Value (EAV) pattern

This commit is contained in:
victor
2015-07-20 18:32:30 +03:00
parent dab22757a7
commit 1b068456c1
5 changed files with 286 additions and 0 deletions

52
More/EAV/Value.php Normal file
View File

@@ -0,0 +1,52 @@
<?php
namespace DesignPatterns\More\EAV;
/**
* Class Value
*/
class Value
{
/**
* @var Attribute
*/
private $attribute;
/**
* @var string
*/
private $name;
public function __construct(Attribute $attribute)
{
$attribute->addValue($this);
$this->attribute = $attribute;
}
/**
* @return Attribute
*/
public function getAttribute()
{
return $this->attribute;
}
/**
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* @param string $name
* @return $this
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
}