Update MsgPHP user + EAV bundle to v0.2

This commit is contained in:
Roland Franssen
2018-03-07 11:51:15 +01:00
parent c10e3ccc67
commit f3bf569958
10 changed files with 74 additions and 36 deletions
@@ -0,0 +1,13 @@
<?php
use MsgPhp\Eav\Entity\{Attribute, AttributeValue};
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return function (ContainerConfigurator $container) {
$container->extension('msgphp_eav', [
'class_mapping' => [
Attribute::class => \App\Entity\Eav\Attribute::class,
AttributeValue::class => \App\Entity\Eav\AttributeValue::class,
],
]);
};
+9
View File
@@ -0,0 +1,9 @@
{
"bundles": {
"MsgPhp\\EavBundle\\MsgPhpEavBundle": ["all"]
},
"copy-from-recipe": {
"config/": "%CONFIG_DIR%/",
"src/": "%SRC_DIR%/"
}
}
@@ -0,0 +1,24 @@
<?php
namespace App\Entity\Eav;
use MsgPhp\Eav\AttributeIdInterface;
use MsgPhp\Eav\Entity\Attribute as BaseAttribute;
/**
* @final
*/
class Attribute extends BaseAttribute
{
private $id;
public function __construct(AttributeIdInterface $id)
{
$this->id = $id;
}
public function getId(): AttributeIdInterface
{
return $this->id;
}
}
@@ -0,0 +1,26 @@
<?php
namespace App\Entity\Eav;
use MsgPhp\Eav\AttributeValueIdInterface;
use MsgPhp\Eav\Entity\AttributeValue as BaseAttributeValue;
/**
* @final
*/
class AttributeValue extends BaseAttributeValue
{
private $id;
public function __construct(AttributeValueIdInterface $id, Attribute $attribute, $value)
{
parent::__construct($attribute, $value);
$this->id = $id;
}
public function getId(): AttributeValueIdInterface
{
return $this->id;
}
}