Last active
August 29, 2015 14:02
-
-
Save albe/77937e10cd2a86c12d09 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Db\Benchmark\Domain\Model\Eav; | |
/* * | |
* This script belongs to the TYPO3 Flow package "Db.Benchmark". * | |
* * | |
* */ | |
use Doctrine\Common\Collections; | |
use TYPO3\Flow\Annotations as Flow; | |
use Doctrine\ORM\Mapping as ORM; | |
/** | |
* An Entity which contains dynamic attributes via the EAV pattern. | |
* | |
* @ORM\MappedSuperclass | |
*/ | |
abstract class AbstractEntity { | |
/** | |
* @var \Doctrine\Common\Collections\Collection<EntityAttribute> | |
* @ORM\ManyToMany(orphanRemoval=true, cascade={"ALL"}, indexBy="name") | |
* @ORM\JoinTable(inverseJoinColumns={@ORM\JoinColumn(unique=true)}) | |
*/ | |
protected $additionalAttributes; | |
public function __construct() { | |
$this->additionalAttributes = new \Doctrine\Common\Collections\ArrayCollection(); | |
} | |
/** | |
* Magic setter and getter implementation for Eav Entity Attributes | |
* | |
* @param string $method | |
* @param array $arguments | |
* @throws \InvalidArgumentException | |
* @return mixed | |
*/ | |
public function __call($method, $arguments) { | |
... | |
} | |
} | |
?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Db\Benchmark\Domain\Model\Eav; | |
/* * | |
* This script belongs to the TYPO3 Flow package "Db.Benchmark". * | |
* * | |
* */ | |
use TYPO3\Flow\Annotations as Flow; | |
use Doctrine\ORM\Mapping as ORM; | |
/** | |
* An entity attribute that can contain dynamic datatype values | |
* | |
* TODO: This should be an abstract mapped superclass instead | |
* @Flow\Entity | |
*/ | |
class EntityAttribute { | |
/** | |
* The name | |
* @var string | |
* @ORM\Id | |
*/ | |
protected $name; | |
/** | |
* The type | |
* @var string | |
* @ORM\Column(length=16) | |
*/ | |
protected $type; | |
/** | |
* The value | |
* @var string | |
* @ORM\Column(type="text") | |
*/ | |
protected $value; | |
/** | |
* @param string $name | |
* @param mixed $value | |
* @param string $type | |
* @throws \InvalidArgumentException | |
*/ | |
public function __construct($name, $value, $type = NULL) { | |
.. | |
} | |
.. | |
} | |
?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Db\Benchmark\Domain\Model; | |
/* * | |
* This script belongs to the TYPO3 Flow package "Db.Benchmark". * | |
* * | |
* */ | |
use TYPO3\Flow\Annotations as Flow; | |
use Doctrine\ORM\Mapping as ORM; | |
/** | |
* @Flow\Entity | |
*/ | |
class EavEntity extends Eav\AbstractEntity { | |
.. some standard properties | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@flow\Proxy(false) all classes (no AOP/DI needed):
Entity 'Db\Benchmark\Domain\Model\Eav\AbstractEntity' has no method 'Flow_Aop_Proxy_fixMethodsAndAdvicesArrayForDoctrineProxies' to be registered as lifecycle callback.
-> FlowAnnotationDriver always registers fix* lifecycle callbacks even when entity is unproxied, which is not needed, as the fixes only deal with AOP/DI behaviour, which is not expected to work on unproxied classes.