wallabag/src/Wallabag/CoreBundle/Entity/Config.php

269 lines
4.6 KiB
PHP
Raw Normal View History

2015-01-22 16:18:56 +00:00
<?php
namespace Wallabag\CoreBundle\Entity;
2015-01-22 16:18:56 +00:00
2015-10-11 20:22:24 +00:00
use Doctrine\Common\Collections\ArrayCollection;
2015-01-22 16:18:56 +00:00
use Doctrine\ORM\Mapping as ORM;
2015-02-11 20:06:32 +00:00
use Symfony\Component\Validator\Constraints as Assert;
2015-01-22 16:18:56 +00:00
/**
2015-05-30 11:52:26 +00:00
* Config.
2015-01-22 16:18:56 +00:00
*
2015-02-16 20:28:49 +00:00
* @ORM\Entity(repositoryClass="Wallabag\CoreBundle\Repository\ConfigRepository")
* @ORM\Table(name="`config`")
2015-01-22 16:18:56 +00:00
* @ORM\Entity
*/
class Config
{
/**
2015-05-30 11:52:26 +00:00
* @var int
2015-01-22 16:18:56 +00:00
*
2015-02-11 20:06:32 +00:00
* @ORM\Column(name="id", type="integer")
2015-01-22 16:18:56 +00:00
* @ORM\Id
2015-02-11 20:06:32 +00:00
* @ORM\GeneratedValue(strategy="AUTO")
2015-01-22 16:18:56 +00:00
*/
private $id;
/**
* @var string
*
2015-02-11 20:06:32 +00:00
* @Assert\NotBlank()
2015-02-16 20:28:49 +00:00
* @ORM\Column(name="theme", type="string", nullable=false)
2015-01-22 16:18:56 +00:00
*/
2015-02-16 20:28:49 +00:00
private $theme;
2015-01-22 16:18:56 +00:00
/**
2015-05-30 11:52:26 +00:00
* @var int
2015-01-22 16:18:56 +00:00
*
2015-02-16 20:28:49 +00:00
* @Assert\NotBlank()
2015-03-28 20:43:49 +00:00
* @Assert\Range(
* min = 1,
* max = 100000,
* maxMessage = "This will certainly kill the app"
* )
2015-02-16 20:28:49 +00:00
* @ORM\Column(name="items_per_page", type="integer", nullable=false)
*/
2015-03-28 13:27:45 +00:00
private $itemsPerPage;
2015-02-16 20:28:49 +00:00
/**
* @var string
*
* @Assert\NotBlank()
* @ORM\Column(name="language", type="string", nullable=false)
2015-01-22 16:18:56 +00:00
*/
2015-02-16 20:28:49 +00:00
private $language;
2015-03-28 13:27:45 +00:00
/**
* @var string
*
* @ORM\Column(name="rss_token", type="string", nullable=true)
*/
private $rssToken;
/**
2015-05-30 11:52:26 +00:00
* @var int
2015-03-28 13:27:45 +00:00
*
* @ORM\Column(name="rss_limit", type="integer", nullable=true)
2015-03-28 20:43:49 +00:00
* @Assert\Range(
* min = 1,
* max = 100000,
* maxMessage = "This will certainly kill the app"
* )
2015-03-28 13:27:45 +00:00
*/
private $rssLimit;
2015-02-16 20:28:49 +00:00
/**
* @ORM\OneToOne(targetEntity="Wallabag\UserBundle\Entity\User", inversedBy="config")
2015-02-16 20:28:49 +00:00
*/
private $user;
2015-10-11 15:14:50 +00:00
/**
* @ORM\OneToMany(targetEntity="Wallabag\CoreBundle\Entity\TaggingRule", mappedBy="config", cascade={"remove"})
2015-11-29 15:19:02 +00:00
* @ORM\OrderBy({"id" = "ASC"})
2015-10-11 15:14:50 +00:00
*/
private $taggingRules;
2015-02-16 20:28:49 +00:00
/*
* @param User $user
*/
2015-10-03 04:29:55 +00:00
public function __construct(\Wallabag\UserBundle\Entity\User $user)
2015-02-16 20:28:49 +00:00
{
$this->user = $user;
2015-10-11 15:14:50 +00:00
$this->taggingRules = new ArrayCollection();
2015-02-16 20:28:49 +00:00
}
2015-01-22 16:18:56 +00:00
/**
2015-05-30 11:52:26 +00:00
* Get id.
2015-01-22 16:18:56 +00:00
*
2015-05-30 11:52:26 +00:00
* @return int
2015-01-22 16:18:56 +00:00
*/
public function getId()
{
return $this->id;
}
/**
2015-05-30 11:52:26 +00:00
* Set theme.
*
* @param string $theme
2015-01-22 16:18:56 +00:00
*
* @return Config
*/
2015-02-16 20:28:49 +00:00
public function setTheme($theme)
2015-01-22 16:18:56 +00:00
{
2015-02-16 20:28:49 +00:00
$this->theme = $theme;
2015-01-22 16:18:56 +00:00
return $this;
}
/**
2015-05-30 11:52:26 +00:00
* Get theme.
2015-01-22 16:18:56 +00:00
*
2015-01-31 18:09:34 +00:00
* @return string
2015-01-22 16:18:56 +00:00
*/
2015-02-16 20:28:49 +00:00
public function getTheme()
2015-01-22 16:18:56 +00:00
{
2015-02-16 20:28:49 +00:00
return $this->theme;
2015-01-22 16:18:56 +00:00
}
/**
2015-05-30 11:52:26 +00:00
* Set itemsPerPage.
*
* @param int $itemsPerPage
2015-01-22 16:18:56 +00:00
*
* @return Config
*/
2015-02-16 20:28:49 +00:00
public function setItemsPerPage($itemsPerPage)
2015-01-22 16:18:56 +00:00
{
2015-03-28 13:27:45 +00:00
$this->itemsPerPage = $itemsPerPage;
2015-01-22 16:18:56 +00:00
return $this;
}
/**
2015-05-30 11:52:26 +00:00
* Get itemsPerPage.
2015-02-16 20:28:49 +00:00
*
2015-05-30 11:52:26 +00:00
* @return int
2015-02-16 20:28:49 +00:00
*/
public function getItemsPerPage()
{
2015-03-28 13:27:45 +00:00
return $this->itemsPerPage;
2015-02-16 20:28:49 +00:00
}
/**
2015-05-30 11:52:26 +00:00
* Set language.
*
* @param string $language
2015-02-16 20:28:49 +00:00
*
* @return Config
*/
public function setLanguage($language)
{
$this->language = $language;
return $this;
}
/**
2015-05-30 11:52:26 +00:00
* Get language.
2015-01-22 16:18:56 +00:00
*
2015-01-31 18:09:34 +00:00
* @return string
2015-01-22 16:18:56 +00:00
*/
2015-02-16 20:28:49 +00:00
public function getLanguage()
{
return $this->language;
}
/**
2015-05-30 11:52:26 +00:00
* Set user.
*
* @param User $user
2015-02-16 20:28:49 +00:00
*
* @return Config
*/
2015-10-06 10:16:08 +00:00
public function setUser(\Wallabag\UserBundle\Entity\User $user = null)
2015-02-16 20:28:49 +00:00
{
$this->user = $user;
return $this;
}
/**
2015-05-30 11:52:26 +00:00
* Get user.
2015-02-16 20:28:49 +00:00
*
* @return User
2015-02-16 20:28:49 +00:00
*/
public function getUser()
2015-01-22 16:18:56 +00:00
{
2015-02-16 20:28:49 +00:00
return $this->user;
2015-01-22 16:18:56 +00:00
}
2015-03-28 13:27:45 +00:00
/**
2015-05-30 11:52:26 +00:00
* Set rssToken.
*
* @param string $rssToken
2015-03-28 13:27:45 +00:00
*
* @return Config
*/
public function setRssToken($rssToken)
{
$this->rssToken = $rssToken;
return $this;
}
/**
2015-05-30 11:52:26 +00:00
* Get rssToken.
2015-03-28 13:27:45 +00:00
*
* @return string
*/
public function getRssToken()
{
return $this->rssToken;
}
/**
2015-05-30 11:52:26 +00:00
* Set rssLimit.
*
* @param string $rssLimit
2015-03-28 13:27:45 +00:00
*
* @return Config
*/
public function setRssLimit($rssLimit)
{
$this->rssLimit = $rssLimit;
return $this;
}
/**
2015-05-30 11:52:26 +00:00
* Get rssLimit.
2015-03-28 13:27:45 +00:00
*
* @return string
*/
public function getRssLimit()
{
return $this->rssLimit;
}
2015-10-11 15:14:50 +00:00
/**
* @param TaggingRule $rule
*
* @return Config
*/
public function addTaggingRule(TaggingRule $rule)
{
$this->taggingRules[] = $rule;
return $this;
}
/**
* @return ArrayCollection<TaggingRule>
*/
public function getTaggingRules()
{
return $this->taggingRules;
}
2015-01-22 16:18:56 +00:00
}