diff options
Diffstat (limited to 'src/Wallabag/FederationBundle/Entity/Instance.php')
-rw-r--r-- | src/Wallabag/FederationBundle/Entity/Instance.php | 111 |
1 files changed, 111 insertions, 0 deletions
diff --git a/src/Wallabag/FederationBundle/Entity/Instance.php b/src/Wallabag/FederationBundle/Entity/Instance.php new file mode 100644 index 00000000..ff8960cd --- /dev/null +++ b/src/Wallabag/FederationBundle/Entity/Instance.php | |||
@@ -0,0 +1,111 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Wallabag\FederationBundle\Entity; | ||
4 | |||
5 | use Doctrine\ORM\Mapping as ORM; | ||
6 | use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; | ||
7 | |||
8 | /** | ||
9 | * Account. | ||
10 | * | ||
11 | * @ORM\Entity | ||
12 | * @UniqueEntity(fields={"domain"}). | ||
13 | * @ORM\Table(name="`instance`") | ||
14 | */ | ||
15 | class Instance { | ||
16 | /** | ||
17 | * @var int | ||
18 | * | ||
19 | * @ORM\Column(name="id", type="integer") | ||
20 | * @ORM\Id | ||
21 | * @ORM\GeneratedValue(strategy="AUTO") | ||
22 | * | ||
23 | */ | ||
24 | private $id; | ||
25 | |||
26 | /** | ||
27 | * @var string | ||
28 | * | ||
29 | * @ORM\Column(name="domain", type="string") | ||
30 | */ | ||
31 | private $domain; | ||
32 | |||
33 | /** | ||
34 | * @var float | ||
35 | * | ||
36 | * @ORM\Column(name="score", type="float") | ||
37 | */ | ||
38 | private $score = 0; | ||
39 | |||
40 | /** | ||
41 | * @var array | ||
42 | * | ||
43 | * @ORM\OneToMany(targetEntity="Wallabag\FederationBundle\Entity\Account", mappedBy="server") | ||
44 | */ | ||
45 | private $users; | ||
46 | |||
47 | /** | ||
48 | * Instance constructor. | ||
49 | * @param string $domain | ||
50 | */ | ||
51 | public function __construct($domain) | ||
52 | { | ||
53 | $this->domain = $domain; | ||
54 | } | ||
55 | |||
56 | /** | ||
57 | * @return int | ||
58 | */ | ||
59 | public function getId() | ||
60 | { | ||
61 | return $this->id; | ||
62 | } | ||
63 | |||
64 | /** | ||
65 | * @return string | ||
66 | */ | ||
67 | public function getDomain() | ||
68 | { | ||
69 | return $this->domain; | ||
70 | } | ||
71 | |||
72 | /** | ||
73 | * @param string $domain | ||
74 | */ | ||
75 | public function setDomain($domain) | ||
76 | { | ||
77 | $this->domain = $domain; | ||
78 | } | ||
79 | |||
80 | /** | ||
81 | * @return float | ||
82 | */ | ||
83 | public function getScore() | ||
84 | { | ||
85 | return $this->score; | ||
86 | } | ||
87 | |||
88 | /** | ||
89 | * @param float $score | ||
90 | */ | ||
91 | public function setScore($score) | ||
92 | { | ||
93 | $this->score = $score; | ||
94 | } | ||
95 | |||
96 | /** | ||
97 | * @return array | ||
98 | */ | ||
99 | public function getUsers() | ||
100 | { | ||
101 | return $this->users; | ||
102 | } | ||
103 | |||
104 | /** | ||
105 | * @param array $users | ||
106 | */ | ||
107 | public function setUsers($users) | ||
108 | { | ||
109 | $this->users = $users; | ||
110 | } | ||
111 | } | ||