1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* admin |
5
|
|
|
* |
6
|
|
|
* @category Tollwerk |
7
|
|
|
* @package Tollwerk\Admin |
8
|
|
|
* @subpackage Tollwerk\Admin\Infrastructure\Model |
9
|
|
|
* @author Joschi Kuphal <[email protected]> / @jkphl |
10
|
|
|
* @copyright Copyright © 2016 Joschi Kuphal <[email protected]> / @jkphl |
11
|
|
|
* @license http://opensource.org/licenses/MIT The MIT License (MIT) |
12
|
|
|
*/ |
13
|
|
|
|
14
|
|
|
/*********************************************************************************** |
15
|
|
|
* The MIT License (MIT) |
16
|
|
|
* |
17
|
|
|
* Copyright © 2016 Joschi Kuphal <[email protected]> / @jkphl |
18
|
|
|
* |
19
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy of |
20
|
|
|
* this software and associated documentation files (the "Software"), to deal in |
21
|
|
|
* the Software without restriction, including without limitation the rights to |
22
|
|
|
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of |
23
|
|
|
* the Software, and to permit persons to whom the Software is furnished to do so, |
24
|
|
|
* subject to the following conditions: |
25
|
|
|
* |
26
|
|
|
* The above copyright notice and this permission notice shall be included in all |
27
|
|
|
* copies or substantial portions of the Software. |
28
|
|
|
* |
29
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
30
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS |
31
|
|
|
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR |
32
|
|
|
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER |
33
|
|
|
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
34
|
|
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
35
|
|
|
***********************************************************************************/ |
36
|
|
|
|
37
|
|
|
namespace Tollwerk\Admin\Infrastructure\Model; |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* Port model |
41
|
|
|
* |
42
|
|
|
* @package Tollwerk\Admin |
43
|
|
|
* @subpackage Tollwerk\Admin\Infrastructure |
44
|
|
|
* @Entity |
45
|
|
|
* @Table(name="port",uniqueConstraints={@UniqueConstraint(name="primary_idx", columns={"vhost_id", "port"})}) |
46
|
|
|
*/ |
47
|
|
|
class Port |
48
|
|
|
{ |
49
|
|
|
/** |
50
|
|
|
* Port ID |
51
|
|
|
* |
52
|
|
|
* @var integer |
53
|
|
|
* @Id @Column(type="integer") |
54
|
|
|
* @GeneratedValue |
55
|
|
|
*/ |
56
|
|
|
protected $id; |
57
|
|
|
/** |
58
|
|
|
* Virtual host this port is belonging to |
59
|
|
|
* |
60
|
|
|
* @var Vhost|null |
61
|
|
|
* @ManyToOne(targetEntity="Tollwerk\Admin\Infrastructure\Model\Vhost", inversedBy="ports") |
62
|
|
|
* @JoinColumn(name="vhost_id", referencedColumnName="id", onDelete="CASCADE") |
63
|
|
|
*/ |
64
|
|
|
protected $vhost; |
65
|
|
|
/** |
66
|
|
|
* HTTP port |
67
|
|
|
* |
68
|
|
|
* @var int |
69
|
|
|
* @Column(type="integer", options={"unsigned":true}) |
70
|
|
|
*/ |
71
|
|
|
protected $port; |
72
|
|
|
/** |
73
|
|
|
* Protocol |
74
|
|
|
* |
75
|
|
|
* @var int |
76
|
|
|
* @Column(type="integer", options={"unsigned":true}) |
77
|
|
|
*/ |
78
|
|
|
protected $protocol; |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* Return the port ID |
82
|
|
|
* |
83
|
|
|
* @return int Port ID |
84
|
|
|
*/ |
85
|
|
|
public function getId() |
86
|
|
|
{ |
87
|
|
|
return $this->id; |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* Set the port ID |
92
|
|
|
* |
93
|
|
|
* @param int $id Port ID |
94
|
|
|
* @return Port |
95
|
|
|
*/ |
96
|
|
|
public function setId($id) |
97
|
|
|
{ |
98
|
|
|
$this->id = $id; |
99
|
|
|
return $this; |
100
|
|
|
} |
101
|
|
|
|
102
|
|
|
/** |
103
|
|
|
* Return the virtual host this port is belonging to |
104
|
|
|
* |
105
|
|
|
* @return Vhost Virtual host this port is belonging to |
106
|
|
|
*/ |
107
|
|
|
public function getVhost() |
108
|
|
|
{ |
109
|
|
|
return $this->vhost; |
110
|
|
|
} |
111
|
|
|
|
112
|
|
|
/** |
113
|
|
|
* Set the virtual host this port is belonging to |
114
|
|
|
* |
115
|
|
|
* @param Vhost $vhost Virtual host this port is belonging to |
116
|
|
|
* @return Port Self reference |
117
|
|
|
*/ |
118
|
|
|
public function setVhost($vhost = null) |
119
|
|
|
{ |
120
|
|
|
$this->vhost = $vhost; |
121
|
|
|
return $this; |
122
|
|
|
} |
123
|
|
|
|
124
|
|
|
/** |
125
|
|
|
* Return the HTTP port |
126
|
|
|
* |
127
|
|
|
* @return int HTTP port |
128
|
|
|
*/ |
129
|
|
|
public function getPort() |
130
|
|
|
{ |
131
|
|
|
return $this->port; |
132
|
|
|
} |
133
|
|
|
|
134
|
|
|
/** |
135
|
|
|
* Set the HTTP port |
136
|
|
|
* |
137
|
|
|
* @param int $port HTTP port |
138
|
|
|
* @return Port Self reference |
139
|
|
|
*/ |
140
|
|
|
public function setPort($port) |
141
|
|
|
{ |
142
|
|
|
$this->port = $port; |
143
|
|
|
return $this; |
144
|
|
|
} |
145
|
|
|
|
146
|
|
|
/** |
147
|
|
|
* Return the protocol |
148
|
|
|
* |
149
|
|
|
* @return int Protocol |
150
|
|
|
*/ |
151
|
|
|
public function getProtocol() |
152
|
|
|
{ |
153
|
|
|
return $this->protocol; |
154
|
|
|
} |
155
|
|
|
|
156
|
|
|
/** |
157
|
|
|
* Set the protocol |
158
|
|
|
* |
159
|
|
|
* @param int $protocol Protocol |
160
|
|
|
* @return Port Self reference |
161
|
|
|
*/ |
162
|
|
|
public function setProtocol($protocol) |
163
|
|
|
{ |
164
|
|
|
$this->protocol = $protocol; |
165
|
|
|
return $this; |
166
|
|
|
} |
167
|
|
|
} |
168
|
|
|
|