1: <?php
2:
3: namespace Mapbender\WmcBundle\Entity;
4:
5: use Doctrine\ORM\Mapping as ORM;
6: use Mapbender\CoreBundle\Entity\State;
7: use Mapbender\WmsBundle\Component\OnlineResource;
8: use Mapbender\WmsBundle\Component\LegendUrl;
9: use Symfony\Component\Validator\Constraints as Assert;
10:
11: /**
12: * A Wmc entity presents an OGC WMC.
13: * @ORM\Entity
14: * @ORM\Table(name="mb_wmc_wmc")
15: * ORM\DiscriminatorMap({"mb_wmc" = "Wmc"})
16: */
17: class Wmc
18: {
19:
20: /**
21: * @ORM\Id
22: * @ORM\Column(type="integer")
23: * @ORM\GeneratedValue(strategy="AUTO")
24: */
25: protected $id;
26:
27: /**
28: * @ORM\OneToOne(targetEntity="Mapbender\CoreBundle\Entity\State", cascade={"persist","remove"})
29: * @ORM\JoinColumn(name="state", referencedColumnName="id")
30: * */
31: protected $state;
32:
33: /**
34: * @var array $keywords The keywords of the wmc
35: * @ORM\Column(type="array",nullable=true)
36: * */
37: protected $keywords = array();
38:
39: /**
40: * @var string $abstract The wmc description
41: * @ORM\Column(type="text", nullable=true)
42: */
43: protected $abstract;
44:
45: /**
46: * @var string A description url
47: * @ORM\Column(type="object", nullable=true)
48: */
49: public $logourl;
50:
51: /**
52: * @var string A description url
53: * @ORM\Column(type="object", nullable=true)
54: */
55: public $descriptionurl;
56:
57: /**
58: * @var string $screenshotPath The wmc description
59: * @ORM\Column(type="string", length=255, nullable=true)
60: */
61: private $screenshotPath;
62:
63: /**
64: * @Assert\File(maxSize="6000000")
65: */
66: private $screenshot;
67:
68: /* @TODO ContactImformation */
69:
70: /**
71: * Get id
72: *
73: * @return integer $id
74: */
75: public function getId()
76: {
77: return $this->id;
78: }
79:
80: public function setState($state)
81: {
82: $this->state = $state;
83: return $this;
84: }
85:
86: public function getState()
87: {
88: return $this->state;
89: }
90:
91: public function setKeywords($keywords)
92: {
93: $this->keywords = $keywords;
94: return $this;
95: }
96:
97: public function getKeywords()
98: {
99: return $this->keywords;
100: }
101:
102: /**
103: * Set abstract
104: *
105: * @param string $abstract
106: * @return Source
107: */
108: public function setAbstract($abstract)
109: {
110: $this->abstract = $abstract;
111: return $this;
112: }
113:
114: /**
115: * Get abstract
116: *
117: * @return string
118: */
119: public function getAbstract()
120: {
121: return $this->abstract;
122: }
123:
124: /**
125: * Set logourl
126: *
127: * @param LegendUrl $logourl
128: * @return Wmc
129: */
130: public function setLogourl(LegendUrl $logourl)
131: {
132: $this->logourl = $logourl;
133: return $this;
134: }
135:
136: /**
137: * Get logourl
138: *
139: * @return LegendUrl
140: */
141: public function getLogourl()
142: {
143: return $this->logourl;
144: }
145:
146: /**
147: * Set descriptionurl
148: *
149: * @param OnlineResource $descriptionurl
150: * @return Wmc
151: */
152: public function setDescriptionurl(OnlineResource $descriptionurl)
153: {
154: $this->descriptionurl = $descriptionurl;
155: return $this;
156: }
157:
158: /**
159: * Get descriptionurl
160: *
161: * @return OnlineResource
162: */
163: public function getDescriptionurl()
164: {
165: return $this->descriptionurl;
166: }
167:
168: /**
169: * Set screenshotPath
170: *
171: * @param string $screenshotPath
172: * @return Source
173: */
174: public function setScreenshotPath($screenshotPath)
175: {
176: $this->screenshotPath = $screenshotPath;
177: return $this;
178: }
179:
180: /**
181: * Get screenshotPath
182: *
183: * @return string
184: */
185: public function getScreenshotPath()
186: {
187: return $this->screenshotPath;
188: }
189:
190:
191:
192: /**
193: * @param string $screenshot
194: */
195: public function setScreenshot($screenshot) {
196: $this->screenshot = $screenshot;
197: }
198:
199: /**
200: * Get screenshot
201: *
202: * @return string
203: */
204: public function getScreenshot() {
205: return $this->screenshot;
206: }
207:
208:
209: public static function create($state = null, $logoUrl = null,
210: $descriptionUrl = null)
211: {
212: $state = $state === null ? new State() : $state;
213: $wmc = new Wmc();
214: $wmc->setState($state);
215: $logoUrl = $logoUrl === null ? LegendUrl::create() : logoUrl;
216: if($logoUrl !== null)
217: {
218: $wmc->setLogourl($logoUrl);
219: }
220: $descriptionUrl = $descriptionUrl === null ? OnlineResource::create() : $descriptionUrl;
221: if($descriptionUrl !== null)
222: {
223: $wmc->setDescriptionurl($descriptionUrl);
224: }
225: return $wmc;
226: }
227:
228: }
229:
230: