<?phpnamespace Uniski\ConfigBundle\Entity;use Doctrine\ORM\Mapping as ORM;use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;/** * Configuration Entity * * @ORM\Entity * @ORM\Table("configuration") * @UniqueEntity(fields={"key"}, message="La clave debe ser Ășnica") */class Configuration{ /** * @var integer * * @ORM\Id * @ORM\Column(name="id", type="integer") * @ORM\GeneratedValue(strategy="IDENTITY") */ protected $id; /** * @var string * * @ORM\Column(type="string") */ protected $name; /** * @var string * * @ORM\Column(name="config_key", type="string") * Key for the indentification for the API and admin * configuration */ protected $key; /** * @var array * * @ORM\Column(type="json") */ protected $settings; function __construct($name = null, $key = null, $settings = null) { $this->name = $name; $this->key = $key; $this->settings = $settings; } /** * Get id * * @return integer */ public function getId() { return $this->id; } /** * Set name * * @param string $name * * @return Configuration */ public function setName($name) { $this->name = $name; return $this; } /** * Get name * * @return string */ public function getName() { return $this->name; } /** * Set settings * * @param array $settings * * @return Configuration */ public function setSettings($settings) { $this->settings = $settings; return $this; } /** * Get settings * * @return array */ public function getSettings($key = null) { if (!$this->settings) return null; if ($key && !empty($this->settings[$key])) return $this->settings[$key]; return $this->settings; } /** * Set key * * @param string $key * * @return Configuration */ public function setKey($key) { $this->key = $key; return $this; } /** * Get key * * @return string */ public function getKey() { return $this->key; }}