1 | <?php |
||
14 | class DocumentAdapter implements Document { |
||
15 | |||
16 | /** |
||
17 | * Stores are fields with their values which should be stored in the index |
||
18 | * |
||
19 | * @var array |
||
20 | */ |
||
21 | protected $fields = array(); |
||
22 | |||
23 | /** |
||
24 | * |
||
25 | * @var string |
||
26 | */ |
||
27 | protected $entityClass = null; |
||
28 | |||
29 | /** |
||
30 | * |
||
31 | * @var mixed |
||
32 | */ |
||
33 | protected $entityId = null; |
||
34 | |||
35 | /** |
||
36 | * |
||
37 | * @var string |
||
38 | */ |
||
39 | protected $entityType = null; |
||
40 | |||
41 | /** |
||
42 | * |
||
43 | * @var string |
||
44 | */ |
||
45 | protected $file = null; |
||
46 | |||
47 | /** |
||
48 | * |
||
49 | * {@inheritdoc} |
||
50 | * |
||
51 | * @see \StingerSoft\EntitySearchBundle\Model\Document::addField() |
||
52 | */ |
||
53 | public function addField($fieldname, $value) { |
||
56 | |||
57 | /** |
||
58 | * |
||
59 | * {@inheritdoc} |
||
60 | * |
||
61 | * @see \StingerSoft\EntitySearchBundle\Model\Document::getFields() |
||
62 | */ |
||
63 | public function getFields() { |
||
66 | |||
67 | /** |
||
68 | * |
||
69 | * {@inheritdoc} |
||
70 | * |
||
71 | * @see \StingerSoft\EntitySearchBundle\Model\Document::getFieldValue() |
||
72 | */ |
||
73 | public function getFieldValue($field) { |
||
76 | |||
77 | /** |
||
78 | * |
||
79 | * {@inheritdoc} |
||
80 | * |
||
81 | * @see \StingerSoft\EntitySearchBundle\Model\Document::addMultiValueField() |
||
82 | */ |
||
83 | public function addMultiValueField($field, $value) { |
||
92 | |||
93 | /** |
||
94 | * |
||
95 | * {@inheritdoc} |
||
96 | * |
||
97 | * @see \StingerSoft\EntitySearchBundle\Model\Document::setEntityClass() |
||
98 | */ |
||
99 | public function setEntityClass($clazz) { |
||
100 | $this->entityClass = $clazz; |
||
101 | if(!$this->entityType) { |
||
102 | $this->entityType = $entityClass; |
||
|
|||
103 | } |
||
104 | } |
||
105 | |||
106 | /** |
||
107 | * |
||
108 | * {@inheritdoc} |
||
109 | * |
||
110 | * @see \StingerSoft\EntitySearchBundle\Model\Document::getEntityClass() |
||
111 | */ |
||
112 | public function getEntityClass() { |
||
115 | |||
116 | /** |
||
117 | * |
||
118 | * {@inheritdoc} |
||
119 | * |
||
120 | * @see \StingerSoft\EntitySearchBundle\Model\Document::setEntityId() |
||
121 | */ |
||
122 | public function setEntityId($id) { |
||
125 | |||
126 | /** |
||
127 | * |
||
128 | * {@inheritdoc} |
||
129 | * |
||
130 | * @see \StingerSoft\EntitySearchBundle\Model\Document::getEntityId() |
||
131 | */ |
||
132 | public function getEntityId() { |
||
135 | |||
136 | /** |
||
137 | * |
||
138 | * {@inheritdoc} |
||
139 | * |
||
140 | * @see \StingerSoft\EntitySearchBundle\Model\Document::setEntityType() |
||
141 | */ |
||
142 | public function setEntityType($type) { |
||
145 | |||
146 | /** |
||
147 | * |
||
148 | * {@inheritdoc} |
||
149 | * |
||
150 | * @see \StingerSoft\EntitySearchBundle\Model\Document::getEntityType() |
||
151 | */ |
||
152 | public function getEntityType() { |
||
155 | |||
156 | /** |
||
157 | * |
||
158 | * {@inheritdoc} |
||
159 | * |
||
160 | * @see \StingerSoft\EntitySearchBundle\Model\Document::setFile() |
||
161 | */ |
||
162 | public function setFile($path) { |
||
165 | |||
166 | /** |
||
167 | * |
||
168 | * {@inheritdoc} |
||
169 | * |
||
170 | * @see \StingerSoft\EntitySearchBundle\Model\Document::getFile() |
||
171 | */ |
||
172 | public function getFile() { |
||
175 | |||
176 | /** |
||
177 | * |
||
178 | * {@inheritdoc} |
||
179 | * |
||
180 | * @see \StingerSoft\EntitySearchBundle\Model\Document::__get() |
||
181 | */ |
||
182 | public function __get($name) { |
||
185 | |||
186 | /** |
||
187 | * |
||
188 | * {@inheritdoc} |
||
189 | * |
||
190 | * @see \StingerSoft\EntitySearchBundle\Model\Document::__isset() |
||
191 | */ |
||
192 | public function __isset($name) { |
||
195 | } |
This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.