1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* This file is part of the Deploy module for webcms2. |
5
|
|
|
* Copyright (c) @see LICENSE |
6
|
|
|
*/ |
7
|
|
|
|
8
|
|
|
namespace WebCMS\DeployModule\Entity; |
9
|
|
|
|
10
|
|
|
use Doctrine\ORM\Mapping as ORM; |
11
|
|
|
|
12
|
|
|
/** |
13
|
|
|
* Server holds information about production server. |
14
|
|
|
* |
15
|
|
|
* From this entity information will be deployed application to the production server. |
16
|
|
|
* |
17
|
|
|
* @ORM\Entity |
18
|
|
|
* @author Tomáš Voslař <tomas.voslar at webcook.cz> |
19
|
|
|
*/ |
20
|
|
|
class Server extends \WebCMS\Entity\Entity |
21
|
|
|
{ |
22
|
|
|
/** |
23
|
|
|
* Server's name. |
24
|
|
|
* |
25
|
|
|
* @ORM\Column(unique=true) |
26
|
|
|
* @var string |
27
|
|
|
*/ |
28
|
|
|
private $name; |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* Server's ip address. |
32
|
|
|
* |
33
|
|
|
* @ORM\Column() |
34
|
|
|
* @var string |
35
|
|
|
*/ |
36
|
|
|
private $ip; |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* Path to the production environment. |
40
|
|
|
* |
41
|
|
|
* @ORM\Column() |
42
|
|
|
* @var string |
43
|
|
|
*/ |
44
|
|
|
private $path; |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* Applications associated with the production server. |
48
|
|
|
* |
49
|
|
|
* @orm\ManyToMany(targetEntity="Application", mappedBy="servers") |
50
|
|
|
*/ |
51
|
|
|
private $applications; |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* Initialize applications array collection. |
55
|
|
|
*/ |
56
|
10 |
|
public function __construct() |
57
|
|
|
{ |
58
|
10 |
|
$this->applications = new \Doctrine\Common\Collections\ArrayCollection; |
59
|
10 |
|
} |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* Add application instance into collection. |
63
|
|
|
* |
64
|
|
|
* @param Application $application Application instance. |
65
|
|
|
*/ |
66
|
5 |
|
public function addApplication(Application $application) |
67
|
|
|
{ |
68
|
5 |
|
$this->applications->add($application); |
69
|
5 |
|
} |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* Gets the value of name. |
73
|
|
|
* |
74
|
|
|
* @return string |
75
|
|
|
*/ |
76
|
8 |
|
public function getName() |
77
|
|
|
{ |
78
|
8 |
|
return $this->name; |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* Sets the value of name. |
83
|
|
|
* |
84
|
|
|
* @param string $name the name |
85
|
|
|
* |
86
|
|
|
* @return self |
87
|
|
|
*/ |
88
|
9 |
|
public function setName($name) |
89
|
|
|
{ |
90
|
9 |
|
$this->name = $name; |
91
|
|
|
|
92
|
9 |
|
return $this; |
93
|
|
|
} |
94
|
|
|
|
95
|
|
|
/** |
96
|
|
|
* Gets the value of ip. |
97
|
|
|
* |
98
|
|
|
* @return string |
99
|
|
|
*/ |
100
|
5 |
|
public function getIp() |
101
|
|
|
{ |
102
|
5 |
|
return $this->ip; |
103
|
|
|
} |
104
|
|
|
|
105
|
|
|
/** |
106
|
|
|
* Sets the value of ip. |
107
|
|
|
* |
108
|
|
|
* @param string $ip the ip |
109
|
|
|
* |
110
|
|
|
* @return self |
111
|
|
|
*/ |
112
|
9 |
|
public function setIp($ip) |
113
|
|
|
{ |
114
|
9 |
|
$this->ip = $ip; |
115
|
|
|
|
116
|
9 |
|
return $this; |
117
|
|
|
} |
118
|
|
|
|
119
|
|
|
/** |
120
|
|
|
* Gets the value of path. |
121
|
|
|
* |
122
|
|
|
* @return string |
123
|
|
|
*/ |
124
|
5 |
|
public function getPath() |
125
|
|
|
{ |
126
|
5 |
|
return $this->path; |
127
|
|
|
} |
128
|
|
|
|
129
|
|
|
/** |
130
|
|
|
* Sets the value of path. |
131
|
|
|
* |
132
|
|
|
* @param string $path the path |
133
|
|
|
* |
134
|
|
|
* @return self |
135
|
|
|
*/ |
136
|
9 |
|
public function setPath($path) |
137
|
|
|
{ |
138
|
9 |
|
$this->path = $path; |
139
|
|
|
|
140
|
9 |
|
return $this; |
141
|
|
|
} |
142
|
|
|
|
143
|
|
|
/** |
144
|
|
|
* Gets the value of applications. |
145
|
|
|
* |
146
|
|
|
* @return \Doctrine\Common\Collections\ArrayCollection |
147
|
|
|
*/ |
148
|
5 |
|
public function getApplications() |
149
|
|
|
{ |
150
|
5 |
|
return $this->applications; |
151
|
|
|
} |
152
|
|
|
} |
153
|
|
|
|