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);
$pagerConfig = new UsersConfig();
$pagerConfig->setUserId($user->getId());
$pagerConfig->setUser($user);
$pagerConfig->setName('pager');
$pagerConfig->setValue(10);
$em->persist($pagerConfig);
// $languageConfig = new LanguageConfig();
// $languageConfig->setUserId($user->getId());
// $languageConfig->setName('language');
// $languageConfig->setValue('en_EN.UTF8');
$languageConfig = new LanguageConfig();
$languageConfig->setUser($user);
$languageConfig->setName('language');
$languageConfig->setValue('en_EN');
// $em->persist($languageConfig);
$em->persist($languageConfig);
$em->flush();
}

View file

@ -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;

View file

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