Update UserConfig schema

This commit is contained in:
Jeremy 2015-02-11 21:06:32 +01:00
parent 2f6a596760
commit 55f58c9c5e
3 changed files with 36 additions and 36 deletions

View file

@ -136,18 +136,18 @@ class InstallCommand extends ContainerAwareCommand
$em->persist($user); $em->persist($user);
$pagerConfig = new UsersConfig(); $pagerConfig = new UsersConfig();
$pagerConfig->setUserId($user->getId()); $pagerConfig->setUser($user);
$pagerConfig->setName('pager'); $pagerConfig->setName('pager');
$pagerConfig->setValue(10); $pagerConfig->setValue(10);
$em->persist($pagerConfig); $em->persist($pagerConfig);
// $languageConfig = new LanguageConfig(); $languageConfig = new LanguageConfig();
// $languageConfig->setUserId($user->getId()); $languageConfig->setUser($user);
// $languageConfig->setName('language'); $languageConfig->setName('language');
// $languageConfig->setValue('en_EN.UTF8'); $languageConfig->setValue('en_EN');
// $em->persist($languageConfig); $em->persist($languageConfig);
$em->flush(); $em->flush();
} }

View file

@ -3,6 +3,7 @@
namespace Wallabag\CoreBundle\Entity; namespace Wallabag\CoreBundle\Entity;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
/** /**
* Config * Config
@ -15,16 +16,17 @@ class Config
/** /**
* @var integer * @var integer
* *
* @ORM\Column(name="id", type="integer", nullable=false) * @ORM\Column(name="id", type="integer")
* @ORM\Id * @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY") * @ORM\GeneratedValue(strategy="AUTO")
*/ */
private $id; private $id;
/** /**
* @var string * @var string
* *
* @ORM\Column(name="name", type="string", nullable=true) * @Assert\NotBlank()
* @ORM\Column(name="name", type="string", nullable=false)
*/ */
private $name; private $name;

View file

@ -22,11 +22,9 @@ class UsersConfig
private $id; private $id;
/** /**
* @var string * @ORM\ManyToOne(targetEntity="User", inversedBy="config")
*
* @ORM\Column(name="user_id", type="decimal", precision=10, scale=0, nullable=true)
*/ */
private $userId; private $user;
/** /**
* @var string * @var string
@ -52,29 +50,6 @@ class UsersConfig
return $this->id; return $this->id;
} }
/**
* Set userId
*
* @param string $userId
* @return UsersConfig
*/
public function setUserId($userId)
{
$this->userId = $userId;
return $this;
}
/**
* Get userId
*
* @return string
*/
public function getUserId()
{
return $this->userId;
}
/** /**
* Set name * Set name
* *
@ -120,4 +95,27 @@ class UsersConfig
{ {
return $this->value; return $this->value;
} }
/**
* Set user
*
* @param \Wallabag\CoreBundle\Entity\User $user
* @return UsersConfig
*/
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->user;
}
} }