From 55f58c9c5e8c523b7547c5d8199f0efef6941b93 Mon Sep 17 00:00:00 2001 From: Jeremy Date: Wed, 11 Feb 2015 21:06:32 +0100 Subject: Update UserConfig schema --- src/Wallabag/CoreBundle/Entity/Config.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/Wallabag/CoreBundle/Entity/Config.php') diff --git a/src/Wallabag/CoreBundle/Entity/Config.php b/src/Wallabag/CoreBundle/Entity/Config.php index 045ca308..14977d32 100644 --- a/src/Wallabag/CoreBundle/Entity/Config.php +++ b/src/Wallabag/CoreBundle/Entity/Config.php @@ -3,6 +3,7 @@ namespace Wallabag\CoreBundle\Entity; use Doctrine\ORM\Mapping as ORM; +use Symfony\Component\Validator\Constraints as Assert; /** * Config @@ -15,16 +16,17 @@ class Config /** * @var integer * - * @ORM\Column(name="id", type="integer", nullable=false) + * @ORM\Column(name="id", type="integer") * @ORM\Id - * @ORM\GeneratedValue(strategy="IDENTITY") + * @ORM\GeneratedValue(strategy="AUTO") */ private $id; /** * @var string * - * @ORM\Column(name="name", type="string", nullable=true) + * @Assert\NotBlank() + * @ORM\Column(name="name", type="string", nullable=false) */ private $name; -- cgit v1.2.3 From 4d85d7e9ba676bd5ac3428976ce9227f460eb542 Mon Sep 17 00:00:00 2001 From: Jeremy Date: Mon, 16 Feb 2015 21:28:49 +0100 Subject: Implement simple config --- src/Wallabag/CoreBundle/Entity/Config.php | 107 +++++++++++++++++++++++++----- 1 file changed, 89 insertions(+), 18 deletions(-) (limited to 'src/Wallabag/CoreBundle/Entity/Config.php') diff --git a/src/Wallabag/CoreBundle/Entity/Config.php b/src/Wallabag/CoreBundle/Entity/Config.php index 14977d32..7b4464a1 100644 --- a/src/Wallabag/CoreBundle/Entity/Config.php +++ b/src/Wallabag/CoreBundle/Entity/Config.php @@ -8,6 +8,7 @@ use Symfony\Component\Validator\Constraints as Assert; /** * Config * + * @ORM\Entity(repositoryClass="Wallabag\CoreBundle\Repository\ConfigRepository") * @ORM\Table(name="config") * @ORM\Entity */ @@ -26,16 +27,40 @@ class Config * @var string * * @Assert\NotBlank() - * @ORM\Column(name="name", type="string", nullable=false) + * @ORM\Column(name="theme", type="string", nullable=false) */ - private $name; + private $theme; /** * @var string * - * @ORM\Column(name="value", type="blob", nullable=true) + * @Assert\NotBlank() + * @ORM\Column(name="items_per_page", type="integer", nullable=false) + */ + private $items_per_page; + + /** + * @var string + * + * @Assert\NotBlank() + * @ORM\Column(name="language", type="string", nullable=false) */ - private $value; + private $language; + + /** + * @ORM\ManyToOne(targetEntity="User", inversedBy="config") + */ + private $user; + + /* + * @param User $user + */ + public function __construct(User $user) + { + $this->user = $user; + $this->items_per_page = 12; + $this->language = 'en_US'; + } /** * Get id @@ -48,48 +73,94 @@ class Config } /** - * Set name + * Set theme * - * @param string $name + * @param string $theme * @return Config */ - public function setName($name) + public function setTheme($theme) { - $this->name = $name; + $this->theme = $theme; return $this; } /** - * Get name + * Get theme * * @return string */ - public function getName() + public function getTheme() { - return $this->name; + return $this->theme; } /** - * Set value + * Set items_per_page * - * @param string $value + * @param integer $itemsPerPage * @return Config */ - public function setValue($value) + public function setItemsPerPage($itemsPerPage) { - $this->value = $value; + $this->items_per_page = $itemsPerPage; return $this; } /** - * Get value + * Get items_per_page + * + * @return integer + */ + public function getItemsPerPage() + { + return $this->items_per_page; + } + + /** + * Set language + * + * @param string $language + * @return Config + */ + public function setLanguage($language) + { + $this->language = $language; + + return $this; + } + + /** + * Get language * * @return string */ - public function getValue() + public function getLanguage() + { + return $this->language; + } + + /** + * Set user + * + * @param \Wallabag\CoreBundle\Entity\User $user + * @return Config + */ + public function setUser(\Wallabag\CoreBundle\Entity\User $user = null) + { + $this->user = $user; + + return $this; + } + + /** + * Get user + * + * @return \Wallabag\CoreBundle\Entity\User + */ + public function getUser() { - return $this->value; + return $this->user; } } -- cgit v1.2.3