* @author Gonzalo Vilaseca */ class Attribute extends AbstractTranslatable implements AttributeInterface { /** * Attribute id. * * @var mixed */ protected $id; /** * Type. * * @var string */ protected $type = AttributeTypes::TEXT; /** * Internal name. * * @var string */ protected $name; /** * Attribute configuration. * * @var array */ protected $configuration = array(); /** * Creation time. * * @var \DateTime */ protected $createdAt; /** * Last update time. * * @var \DateTime */ protected $updatedAt; public function __construct() { parent::__construct(); $this->createdAt = new \DateTime(); } /** * {@inheritdoc} */ public function __toString() { return $this->name; } /** * {@inheritdoc} */ public function getId() { return $this->id; } /** * {@inheritdoc} */ public function getName() { return $this->name; } /** * {@inheritdoc} */ public function setName($name) { $this->name = $name; return $this; } /** * {@inheritdoc} */ public function getPresentation() { return $this->translate()->getPresentation(); } /** * {@inheritdoc} */ public function setPresentation($presentation) { $this->translate()->setPresentation($presentation); return $this; } /** * {@inheritdoc} */ public function getType() { return $this->type; } /** * {@inheritdoc} */ public function setType($type) { $this->type = $type; return $this; } /** * {@inheritdoc} */ public function getConfiguration() { return $this->configuration; } /** * {@inheritdoc} */ public function setConfiguration(array $configuration) { $this->configuration = $configuration; return $this; } /** * {@inheritdoc} */ public function getCreatedAt() { return $this->createdAt; } /** * {@inheritdoc} */ public function setCreatedAt(\DateTime $createdAt) { $this->createdAt = $createdAt; return $this; } /** * {@inheritdoc} */ public function getUpdatedAt() { return $this->updatedAt; } /** * {@inheritdoc} */ public function setUpdatedAt(\DateTime $updatedAt) { $this->updatedAt = $updatedAt; return $this; } /** * {@inheritdoc} */ protected function getTranslationEntityClass() { return get_class().'Translation'; } }