* @copyright Since 2007 PrestaShop SA and Contributors * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) */ declare(strict_types=1); namespace PrestaShop\Module\PsxDesign\Entity; if (!defined('_PS_VERSION_')) { exit; } use Doctrine\ORM\Mapping as ORM; use PrestaShop\Module\PsxDesign\VO\Color\VariableType; /** * ./bin/console doctrine:schema:update --dump-sql * * Color * * @ORM\Table() * @ORM\Entity() */ class PsxdesignColor { /** * @var int * * @ORM\Id * @ORM\Column(name="id", type="integer", unique="true") * @ORM\GeneratedValue(strategy="AUTO") */ private $id; /** * @var string * * @ORM\Column(name="variable_name", type="string", length=255) */ private $variableName; /** * @var string * * @ORM\Column(type="string", length=64) * @ORM\Column(name="variable_type", type="string", columnDefinition="'css_selector', 'scss_variable', 'css_variable'") */ private $variableType; /** * @var string * * @ORM\Column(name="value", type="string", length=7) */ private $value; /** * @var PsxdesignColorsPalette * * @ORM\ManyToOne(targetEntity="PsxdesignColorsPalette") * @ORM\JoinColumn(name="id_palette", referencedColumnName="id") */ private $palette; /** * @return int */ public function getId(): int { return $this->id; } /** * @return string */ public function getVariableName(): string { return $this->variableName; } /** * @param string $variableName * * @return PsxdesignColor */ public function setVariableName(string $variableName): self { $this->variableName = $variableName; return $this; } /** * @return string */ public function getVariableType(): string { return $this->variableType; } /** * @param string $variableType * * @return PsxdesignColor */ public function setVariableType(string $variableType): self { $this->variableType = (new VariableType($variableType))->getType(); return $this; } /** * @return string */ public function getValue(): string { return $this->value; } /** * @param string $value * * @return PsxdesignColor */ public function setValue(string $value): self { $this->value = $value; return $this; } /** * @return PsxdesignColorsPalette */ public function getPalette(): PsxdesignColorsPalette { return $this->palette; } /** * @param PsxdesignColorsPalette $palette */ public function setPalette(PsxdesignColorsPalette $palette): void { $this->palette = $palette; } /** * Convert the color object to an associative array * * @return array */ public function toArray(): array { return [ 'id' => $this->getId(), 'variable_name' => $this->getVariableName(), 'variable_type' => $this->getVariableType(), 'value' => $this->getValue(), 'palette' => $this->getPalette(), ]; } }