123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203 |
- <?php
- /*
- * This file is part of the Sylius package.
- *
- * (c) Paweł Jędrzejewski
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
- namespace Sylius\Component\Attribute\Model;
- use Sylius\Component\Translation\Model\AbstractTranslatable;
- /**
- * Model for object attributes.
- *
- * @author Paweł Jędrzejewski <pawel@sylius.org>
- * @author Gonzalo Vilaseca <gvilaseca@reiss.co.uk>
- */
- 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';
- }
- }
|