@@ 7-304 (lines=298) @@ | ||
4 | ||
5 | use Yandex\Market\Content\Models\Base\MarketModel; |
|
6 | ||
7 | class ModelChild extends MarketModel |
|
8 | { |
|
9 | protected $offersCount = null; |
|
10 | ||
11 | protected $rating = null; |
|
12 | ||
13 | protected $reviewsCount = null; |
|
14 | ||
15 | protected $articlesCount = null; |
|
16 | ||
17 | protected $isNew = null; |
|
18 | ||
19 | protected $vendorId = null; |
|
20 | ||
21 | protected $gradesCount = null; |
|
22 | ||
23 | protected $categoryId = null; |
|
24 | ||
25 | protected $id = null; |
|
26 | ||
27 | protected $photos = null; |
|
28 | ||
29 | protected $link = null; |
|
30 | ||
31 | protected $isGroup = null; |
|
32 | ||
33 | protected $vendorName = null; |
|
34 | ||
35 | protected $name = null; |
|
36 | ||
37 | protected $prices = null; |
|
38 | ||
39 | protected $description = null; |
|
40 | ||
41 | protected $facts = null; |
|
42 | ||
43 | protected $mainPhoto = null; |
|
44 | ||
45 | protected $parent = null; |
|
46 | ||
47 | /** |
|
48 | * Additional properties available during listed requests. |
|
49 | */ |
|
50 | protected $childrenCount = null; |
|
51 | ||
52 | protected $popularity = null; |
|
53 | ||
54 | protected $mappingClasses = [ |
|
55 | 'photos' => 'Yandex\Market\Content\Models\Photos', |
|
56 | 'prices' => 'Yandex\Market\Content\Models\Prices', |
|
57 | 'facts' => 'Yandex\Market\Content\Models\Facts', |
|
58 | 'mainPhoto' => 'Yandex\Market\Content\Models\Base\Photo', |
|
59 | 'parent' => 'Yandex\Market\Content\Models\ModelParent' |
|
60 | ]; |
|
61 | ||
62 | protected $propNameMap = [ |
|
63 | 'vendor' => 'vendorName', |
|
64 | 'parentModel' => 'parent', |
|
65 | 'modificationsCount' => 'childrenCount', |
|
66 | 'gradeCount' => 'gradesCount' |
|
67 | ]; |
|
68 | ||
69 | /** |
|
70 | * Constructor |
|
71 | * |
|
72 | * @param array $data |
|
73 | */ |
|
74 | public function __construct($data = array()) |
|
75 | { |
|
76 | // fix photo inheritance |
|
77 | // @todo: Check whether only one child can be inherit in "photos" property. |
|
78 | if (isset($data['photos']) && count($data['photos']) == 1 && isset($data['photos']['photo']) |
|
79 | ) { |
|
80 | $data['photos'] = $data['photos']['photo']; |
|
81 | } |
|
82 | parent::__construct($data); |
|
83 | } |
|
84 | ||
85 | /** |
|
86 | * Retrieve the offersCount property |
|
87 | * |
|
88 | * @return int|null |
|
89 | */ |
|
90 | public function getOffersCount() |
|
91 | { |
|
92 | return $this->offersCount; |
|
93 | } |
|
94 | ||
95 | /** |
|
96 | * Retrieve the rating property |
|
97 | * |
|
98 | * @return float|null |
|
99 | */ |
|
100 | public function getRating() |
|
101 | { |
|
102 | return $this->rating; |
|
103 | } |
|
104 | ||
105 | /** |
|
106 | * Retrieve the reviewsCount property |
|
107 | * |
|
108 | * @return int|null |
|
109 | */ |
|
110 | public function getReviewsCount() |
|
111 | { |
|
112 | return $this->reviewsCount; |
|
113 | } |
|
114 | ||
115 | /** |
|
116 | * Retrieve the articlesCount property |
|
117 | * |
|
118 | * @return int|null |
|
119 | */ |
|
120 | public function getArticlesCount() |
|
121 | { |
|
122 | return $this->articlesCount; |
|
123 | } |
|
124 | ||
125 | /** |
|
126 | * Retrieve the isNew property |
|
127 | * |
|
128 | * @return bool|null |
|
129 | */ |
|
130 | public function getIsNew() |
|
131 | { |
|
132 | if ($this->isNew === null) { |
|
133 | return null; |
|
134 | } |
|
135 | ||
136 | if ($this->isNew == 1) { |
|
137 | return true; |
|
138 | } |
|
139 | ||
140 | return false; |
|
141 | } |
|
142 | ||
143 | /** |
|
144 | * Retrieve the vendorId property |
|
145 | * |
|
146 | * @return int|null |
|
147 | */ |
|
148 | public function getVendorId() |
|
149 | { |
|
150 | return $this->vendorId; |
|
151 | } |
|
152 | ||
153 | /** |
|
154 | * Retrieve the gradesCount property |
|
155 | * |
|
156 | * @return int|null |
|
157 | */ |
|
158 | public function getGradesCount() |
|
159 | { |
|
160 | return $this->gradesCount; |
|
161 | } |
|
162 | ||
163 | /** |
|
164 | * Retrieve the categoryId property |
|
165 | * |
|
166 | * @return int|null |
|
167 | */ |
|
168 | public function getCategoryId() |
|
169 | { |
|
170 | return $this->categoryId; |
|
171 | } |
|
172 | ||
173 | /** |
|
174 | * Retrieve the id property |
|
175 | * |
|
176 | * @return int|null |
|
177 | */ |
|
178 | public function getId() |
|
179 | { |
|
180 | return $this->id; |
|
181 | } |
|
182 | ||
183 | /** |
|
184 | * Retrieve the id property |
|
185 | * |
|
186 | * @return Photos|null |
|
187 | */ |
|
188 | public function getPhotos() |
|
189 | { |
|
190 | return $this->photos; |
|
191 | } |
|
192 | ||
193 | /** |
|
194 | * Retrieve the link property |
|
195 | * |
|
196 | * @return string|null |
|
197 | */ |
|
198 | public function getLink() |
|
199 | { |
|
200 | return $this->link; |
|
201 | } |
|
202 | ||
203 | /** |
|
204 | * Retrieve the isGroup property |
|
205 | * |
|
206 | * @return bool|null |
|
207 | */ |
|
208 | public function getIsGroup() |
|
209 | { |
|
210 | return $this->isGroup; |
|
211 | } |
|
212 | ||
213 | /** |
|
214 | * Retrieve the vendorName property |
|
215 | * @return string|null |
|
216 | */ |
|
217 | public function getVendorName() |
|
218 | { |
|
219 | return $this->vendorName; |
|
220 | } |
|
221 | ||
222 | /** |
|
223 | * Retrieve the name property |
|
224 | * @return string|null |
|
225 | */ |
|
226 | public function getName() |
|
227 | { |
|
228 | return $this->name; |
|
229 | } |
|
230 | ||
231 | /** |
|
232 | * Retrieve the prices property |
|
233 | * |
|
234 | * @return Prices|null |
|
235 | */ |
|
236 | public function getPrices() |
|
237 | { |
|
238 | return $this->prices; |
|
239 | } |
|
240 | ||
241 | /** |
|
242 | * Retrieve the description property |
|
243 | * @return string|null |
|
244 | */ |
|
245 | public function getDescription() |
|
246 | { |
|
247 | return $this->description; |
|
248 | } |
|
249 | ||
250 | /** |
|
251 | * Retrieve the facts property |
|
252 | * |
|
253 | * @return Facts|null |
|
254 | */ |
|
255 | public function getFacts() |
|
256 | { |
|
257 | return $this->facts; |
|
258 | } |
|
259 | ||
260 | /** |
|
261 | * Retrieve the mainPhoto property |
|
262 | * |
|
263 | * @return Photo|null |
|
264 | */ |
|
265 | public function getMainPhoto() |
|
266 | { |
|
267 | return $this->mainPhoto; |
|
268 | } |
|
269 | ||
270 | /** |
|
271 | * Retrieve the parent property |
|
272 | * |
|
273 | * @return ModelParent|null |
|
274 | */ |
|
275 | public function getParent() |
|
276 | { |
|
277 | return $this->parent; |
|
278 | } |
|
279 | ||
280 | /** |
|
281 | * Retrieve the childrenCount property |
|
282 | * |
|
283 | * @note Property available during /category/{category_id}/models request. |
|
284 | * |
|
285 | * @return int|null |
|
286 | */ |
|
287 | public function getChildrenCount() |
|
288 | { |
|
289 | return $this->childrenCount; |
|
290 | } |
|
291 | ||
292 | /** |
|
293 | * Retrieve the popularity property |
|
294 | * |
|
295 | * @note Property available during /model/{model_id} request. |
|
296 | * for list of children models in parent model. |
|
297 | * |
|
298 | * @return float|null |
|
299 | */ |
|
300 | public function getPopularity() |
|
301 | { |
|
302 | return $this->popularity; |
|
303 | } |
|
304 | } |
|
305 |
@@ 7-305 (lines=299) @@ | ||
4 | ||
5 | use Yandex\Market\Content\Models\Base\MarketModel; |
|
6 | ||
7 | class ModelSingle extends MarketModel |
|
8 | { |
|
9 | protected $offersCount = null; |
|
10 | ||
11 | protected $rating = null; |
|
12 | ||
13 | protected $reviewsCount = null; |
|
14 | ||
15 | protected $articlesCount = null; |
|
16 | ||
17 | protected $isNew = null; |
|
18 | ||
19 | protected $vendorId = null; |
|
20 | ||
21 | protected $gradesCount = null; |
|
22 | ||
23 | protected $categoryId = null; |
|
24 | ||
25 | protected $id = null; |
|
26 | ||
27 | protected $photos = null; |
|
28 | ||
29 | protected $link = null; |
|
30 | ||
31 | protected $isGroup = null; |
|
32 | ||
33 | protected $vendorName = null; |
|
34 | ||
35 | protected $name = null; |
|
36 | ||
37 | protected $prices = null; |
|
38 | ||
39 | protected $description = null; |
|
40 | ||
41 | protected $facts = null; |
|
42 | ||
43 | protected $mainPhoto = null; |
|
44 | ||
45 | /** |
|
46 | * Additional properties available during listed requests. |
|
47 | */ |
|
48 | protected $childrenCount = null; |
|
49 | ||
50 | protected $bigPhoto = null; |
|
51 | ||
52 | protected $previewPhoto = null; |
|
53 | ||
54 | protected $mappingClasses = [ |
|
55 | 'photos' => 'Yandex\Market\Content\Models\Photos', |
|
56 | 'prices' => 'Yandex\Market\Content\Models\Prices', |
|
57 | 'facts' => 'Yandex\Market\Content\Models\Facts', |
|
58 | 'mainPhoto' => 'Yandex\Market\Content\Models\Base\Photo', |
|
59 | 'bigPhoto' => 'Yandex\Market\Content\Models\Base\Photo', |
|
60 | 'previewPhoto' => 'Yandex\Market\Content\Models\Base\Photo' |
|
61 | ]; |
|
62 | ||
63 | protected $propNameMap = [ |
|
64 | 'vendor' => 'vendorName', |
|
65 | 'modificationsCount' => 'childrenCount', |
|
66 | 'gradeCount' => 'gradesCount' |
|
67 | ]; |
|
68 | ||
69 | /** |
|
70 | * Constructor |
|
71 | * |
|
72 | * @param array $data |
|
73 | */ |
|
74 | public function __construct($data = array()) |
|
75 | { |
|
76 | // fix photo inheritance |
|
77 | // @todo: Check whether only one child can be inherit in "photos" property. |
|
78 | if (isset($data['photos']) && count($data['photos']) == 1 && isset($data['photos']['photo']) |
|
79 | ) { |
|
80 | $data['photos'] = $data['photos']['photo']; |
|
81 | } |
|
82 | parent::__construct($data); |
|
83 | } |
|
84 | ||
85 | /** |
|
86 | * Retrieve the offersCount property |
|
87 | * |
|
88 | * @return int|null |
|
89 | */ |
|
90 | public function getOffersCount() |
|
91 | { |
|
92 | return $this->offersCount; |
|
93 | } |
|
94 | ||
95 | /** |
|
96 | * Retrieve the rating property |
|
97 | * |
|
98 | * @return float|null |
|
99 | */ |
|
100 | public function getRating() |
|
101 | { |
|
102 | return $this->rating; |
|
103 | } |
|
104 | ||
105 | /** |
|
106 | * Retrieve the reviewsCount property |
|
107 | * |
|
108 | * @return int|null |
|
109 | */ |
|
110 | public function getReviewsCount() |
|
111 | { |
|
112 | return $this->reviewsCount; |
|
113 | } |
|
114 | ||
115 | /** |
|
116 | * Retrieve the articlesCount property |
|
117 | * |
|
118 | * @return int|null |
|
119 | */ |
|
120 | public function getArticlesCount() |
|
121 | { |
|
122 | return $this->articlesCount; |
|
123 | } |
|
124 | ||
125 | /** |
|
126 | * Retrieve the isNew property |
|
127 | * |
|
128 | * @return bool|null |
|
129 | */ |
|
130 | public function getIsNew() |
|
131 | { |
|
132 | if ($this->isNew === null) { |
|
133 | return null; |
|
134 | } |
|
135 | ||
136 | if ($this->isNew == 1) { |
|
137 | return true; |
|
138 | } |
|
139 | ||
140 | return false; |
|
141 | } |
|
142 | ||
143 | /** |
|
144 | * Retrieve the vendorId property |
|
145 | * |
|
146 | * @return int|null |
|
147 | */ |
|
148 | public function getVendorId() |
|
149 | { |
|
150 | return $this->vendorId; |
|
151 | } |
|
152 | ||
153 | /** |
|
154 | * Retrieve the gradesCount property |
|
155 | * |
|
156 | * @return int|null |
|
157 | */ |
|
158 | public function getGradesCount() |
|
159 | { |
|
160 | return $this->gradesCount; |
|
161 | } |
|
162 | ||
163 | /** |
|
164 | * Retrieve the categoryId property |
|
165 | * |
|
166 | * @return int|null |
|
167 | */ |
|
168 | public function getCategoryId() |
|
169 | { |
|
170 | return $this->categoryId; |
|
171 | } |
|
172 | ||
173 | /** |
|
174 | * Retrieve the id property |
|
175 | * |
|
176 | * @return int|null |
|
177 | */ |
|
178 | public function getId() |
|
179 | { |
|
180 | return $this->id; |
|
181 | } |
|
182 | ||
183 | /** |
|
184 | * Retrieve the id property |
|
185 | * |
|
186 | * @return Photos|null |
|
187 | */ |
|
188 | public function getPhotos() |
|
189 | { |
|
190 | return $this->photos; |
|
191 | } |
|
192 | ||
193 | /** |
|
194 | * Retrieve the link property |
|
195 | * |
|
196 | * @return string|null |
|
197 | */ |
|
198 | public function getLink() |
|
199 | { |
|
200 | return $this->link; |
|
201 | } |
|
202 | ||
203 | /** |
|
204 | * Retrieve the isGroup property |
|
205 | * |
|
206 | * @return bool|null |
|
207 | */ |
|
208 | public function getIsGroup() |
|
209 | { |
|
210 | return $this->isGroup; |
|
211 | } |
|
212 | ||
213 | /** |
|
214 | * Retrieve the vendorName property |
|
215 | * @return string|null |
|
216 | */ |
|
217 | public function getVendorName() |
|
218 | { |
|
219 | return $this->vendorName; |
|
220 | } |
|
221 | ||
222 | /** |
|
223 | * Retrieve the name property |
|
224 | * @return string|null |
|
225 | */ |
|
226 | public function getName() |
|
227 | { |
|
228 | return $this->name; |
|
229 | } |
|
230 | ||
231 | /** |
|
232 | * Retrieve the prices property |
|
233 | * |
|
234 | * @return Prices|null |
|
235 | */ |
|
236 | public function getPrices() |
|
237 | { |
|
238 | return $this->prices; |
|
239 | } |
|
240 | ||
241 | /** |
|
242 | * Retrieve the description property |
|
243 | * @return string|null |
|
244 | */ |
|
245 | public function getDescription() |
|
246 | { |
|
247 | return $this->description; |
|
248 | } |
|
249 | ||
250 | /** |
|
251 | * Retrieve the facts property |
|
252 | * |
|
253 | * @return Facts|null |
|
254 | */ |
|
255 | public function getFacts() |
|
256 | { |
|
257 | return $this->facts; |
|
258 | } |
|
259 | ||
260 | /** |
|
261 | * Retrieve the mainPhoto property |
|
262 | * |
|
263 | * @return Photo|null |
|
264 | */ |
|
265 | public function getMainPhoto() |
|
266 | { |
|
267 | return $this->mainPhoto; |
|
268 | } |
|
269 | ||
270 | /** |
|
271 | * Retrieve the childrenCount property |
|
272 | * |
|
273 | * @note Property available during /category/{category_id}/models request. |
|
274 | * |
|
275 | * @return int|null |
|
276 | */ |
|
277 | public function getChildrenCount() |
|
278 | { |
|
279 | return $this->childrenCount; |
|
280 | } |
|
281 | ||
282 | /** |
|
283 | * Retrieve the bigPhoto property |
|
284 | * |
|
285 | * @note Property available during /search request. |
|
286 | * |
|
287 | * @return int|null |
|
288 | */ |
|
289 | public function getBigPhoto() |
|
290 | { |
|
291 | return $this->bigPhoto; |
|
292 | } |
|
293 | ||
294 | /** |
|
295 | * Retrieve the previewPhoto property |
|
296 | * |
|
297 | * @note Property available during /search request. |
|
298 | * |
|
299 | * @return int|null |
|
300 | */ |
|
301 | public function getPreviewPhoto() |
|
302 | { |
|
303 | return $this->previewPhoto; |
|
304 | } |
|
305 | } |
|
306 |