1: <?php
2:
3: namespace Mapbender\CoreBundle\Entity;
4:
5: use Doctrine\Common\Collections\ArrayCollection;
6: use Doctrine\ORM\EntityManager;
7: use Doctrine\ORM\Mapping as ORM;
8:
9: /**
10: * @author Karim Malhas
11: *
12: * @ORM\Entity
13: * @ORM\Table(name="mb_core_sourceinstance")
14: * @ORM\InheritanceType("JOINED")
15: * @ORM\DiscriminatorColumn(name="discr", type="string")
16: * ORM\DiscriminatorMap({"mb_core_sourceinstance" = "SourceInstance"})
17: */
18: abstract class SourceInstance
19: {
20:
21: /**
22: * @var integer $id
23: * @ORM\Id
24: * @ORM\Column(type="integer")
25: * @ORM\GeneratedValue(strategy="AUTO")
26: */
27: protected $id;
28:
29: /**
30: * @var string $title The source title
31: * @ORM\Column(type="string", nullable=true)
32: */
33: protected $title;
34:
35: /**
36: * @ORM\ManyToOne(targetEntity="Layerset", inversedBy="instances", cascade={"persist","refresh"})
37: * @ORM\JoinColumn(name="layerset", referencedColumnName="id")
38: */
39: protected $layerset;
40:
41: /**
42: * @var integer $weight The sorting weight for display
43: * @ORM\Column(type="integer")
44: */
45: protected $weight;
46:
47: /**
48: * @ORM\Column(type="boolean", nullable=true)
49: */
50: protected $enabled = true;
51:
52: /**
53: * Creates an instance
54: */
55: public function __construct()
56: {
57:
58: }
59:
60: /**
61: * Returns an id
62: *
63: * @return integer id
64: */
65: public function getId()
66: {
67: return $this->id;
68: }
69:
70: /**
71: * Returns a title
72: *
73: * @param String title
74: */
75: public function getTitle()
76: {
77: return $this->title;
78: }
79:
80: /**
81: * Sets a title
82: *
83: * @param String $title
84: */
85: public function setTitle($title)
86: {
87: $this->title = $title;
88: }
89:
90: /**
91: * Returns a source type
92: *
93: * @return String type
94: */
95: public abstract function getType();
96:
97: /**
98: * Returns a manager type
99: *
100: * @return String a manager type
101: */
102: public abstract function getManagertype();
103:
104: /**
105: * Returns a full class name
106: *
107: * @return string
108: */
109: public function getClassname()
110: {
111: return get_class();
112: }
113:
114: /**
115: * Returns assets
116: *
117: * @return array assets
118: */
119: public function getAssets()
120: {
121: return array();
122: }
123:
124: /**
125: * Sets a weight
126: *
127: * @param integer $weight
128: */
129: public function setWeight($weight)
130: {
131: $this->weight = $weight;
132: return $this;
133: }
134:
135: /**
136: * Returns a weight
137: *
138: * @return integer
139: */
140: public function getWeight()
141: {
142: return $this->weight;
143: }
144:
145: /**
146: * Sets the layerset
147: *
148: * @param Layerset $layerset Layerset
149: * @return Sourceinstance
150: */
151: public function setLayerset($layerset)
152: {
153: $this->layerset = $layerset;
154: return $this;
155: }
156:
157: /**
158: * Returns the layerset
159: * @return Layerset
160: */
161: public function getLayerset()
162: {
163: $this->layerset;
164: }
165:
166: /**
167: * Sets an enabled
168: *
169: * @param integer $enabled
170: * @return SourceInstance SourceInstance
171: */
172: public function setEnabled($enabled)
173: {
174: $this->enabled = $enabled;
175: return $this;
176: }
177:
178: /**
179: * Returns an enabled
180: *
181: * @return integer
182: */
183: public function getEnabled()
184: {
185: return $this->enabled;
186: }
187:
188: /**
189: * Returns instance source
190: *
191: * @return Source
192: */
193: public abstract function getSource();
194:
195: /**
196: * Sets an id
197: * @param integer $id id
198: */
199: public abstract function setId($id);
200:
201: /**
202: * Sets a configuration of a source instance
203: *
204: * @param array $configuration configuration of a source instance
205: */
206: public abstract function setConfiguration($configuration);
207:
208: /**
209: * Returns a configuration of a source instance
210: */
211: public abstract function getConfiguration();
212:
213: /**
214: * Remove a source instance from a database
215: * @param EntityManager $em
216: */
217: public abstract function remove(EntityManager $em);
218:
219: }
220: