@@ -220,7 +220,7 @@ |
||
220 | 220 | public function hydrate(array $data, AbstractModel $model = null, HydratorInterface $hydrator = null) |
221 | 221 | { |
222 | 222 | $hydrator = $hydrator ?: $this->getHydrator(); |
223 | - $model = $model ?: $this->getModel(); |
|
223 | + $model = $model ?: $this->getModel(); |
|
224 | 224 | |
225 | 225 | return $hydrator->hydrate($data, $model); |
226 | 226 | } |
@@ -34,6 +34,9 @@ discard block |
||
34 | 34 | protected $paginatorOptions; |
35 | 35 | protected $enabledOnly = false; |
36 | 36 | |
37 | + /** |
|
38 | + * @param string $tableName |
|
39 | + */ |
|
37 | 40 | public function getSelect($tableName = null) |
38 | 41 | { |
39 | 42 | return $this->getSql()->select($tableName ?: $this->getTableName()); |
@@ -85,6 +88,10 @@ discard block |
||
85 | 88 | } |
86 | 89 | |
87 | 90 | //return deleted nuber of rows |
91 | + |
|
92 | + /** |
|
93 | + * @param string $tableName |
|
94 | + */ |
|
88 | 95 | public function delete(array $where, $tableName = null) |
89 | 96 | { |
90 | 97 | $tableName = $tableName ?: $this->getTableName(); |
@@ -135,6 +142,10 @@ discard block |
||
135 | 142 | } |
136 | 143 | |
137 | 144 | //returns affected number of rows |
145 | + |
|
146 | + /** |
|
147 | + * @param string $tableName |
|
148 | + */ |
|
138 | 149 | public function update($dataOrModel, array $where, $tableName = null, HydratorInterface $hydrator = null) |
139 | 150 | { |
140 | 151 | $tableName = $tableName ?: $this->getTableName(); |
@@ -302,7 +313,7 @@ discard block |
||
302 | 313 | |
303 | 314 | /** |
304 | 315 | * @param Sql |
305 | - * @return AbstractDbMapper |
|
316 | + * @return AbstractMapper |
|
306 | 317 | */ |
307 | 318 | protected function setSql(Sql $sql) |
308 | 319 | { |
@@ -412,6 +423,9 @@ discard block |
||
412 | 423 | return $this->enabledOnly; |
413 | 424 | } |
414 | 425 | |
426 | + /** |
|
427 | + * @param boolean $bool |
|
428 | + */ |
|
415 | 429 | public function setEnabledOnly($bool) |
416 | 430 | { |
417 | 431 | $this->enabledOnly = $bool; |
@@ -111,7 +111,7 @@ |
||
111 | 111 | 'INNER' |
112 | 112 | ) |
113 | 113 | ->where(array( |
114 | - $c_o . '.builder' => 1, |
|
114 | + $c_o . '.builder' => 1, |
|
115 | 115 | $c_p_o . '.product_id' => $productId, |
116 | 116 | )); |
117 | 117 |
@@ -13,7 +13,7 @@ |
||
13 | 13 | $data['name'] = $model->getName(); |
14 | 14 | $data['instruction'] = $model->getInstruction(); |
15 | 15 | $data['required'] = ($model->getRequired()) ? 1 : 0; |
16 | - $data['builder'] = ($model->getBuilder()) ? 1 : 0; |
|
16 | + $data['builder'] = ($model->getBuilder()) ? 1 : 0; |
|
17 | 17 | $data['option_type_id'] = $model->getOptionTypeId(); |
18 | 18 | |
19 | 19 | return $data; |
@@ -53,7 +53,7 @@ |
||
53 | 53 | |
54 | 54 | public function __toString() |
55 | 55 | { |
56 | - $string = $this->has('distributor') ? $this->getDistributor()->getName(): '___' ; |
|
56 | + $string = $this->has('distributor') ? $this->getDistributor()->getName() : '___'; |
|
57 | 57 | return $string; |
58 | 58 | } |
59 | 59 | } |
@@ -10,7 +10,7 @@ |
||
10 | 10 | protected $parent; |
11 | 11 | |
12 | 12 | /** |
13 | - * @return parent |
|
13 | + * @return AbstractModel |
|
14 | 14 | */ |
15 | 15 | public function getParent() |
16 | 16 | { |
@@ -15,13 +15,13 @@ |
||
15 | 15 | public function __construct(array $config = array()) |
16 | 16 | { |
17 | 17 | if (count($config)) { |
18 | - $this->parentOptionId = isset($config['parent_option_id']) ? $config['parent_option_id'] : null; |
|
19 | - $this->productId = isset($config['product_id']) ? $config['product_id'] : null; |
|
20 | - $this->itemNumber = isset($config['item_number']) ? $config['item_number'] : null; |
|
18 | + $this->parentOptionId = isset($config['parent_option_id']) ? $config['parent_option_id'] : null; |
|
19 | + $this->productId = isset($config['product_id']) ? $config['product_id'] : null; |
|
20 | + $this->itemNumber = isset($config['item_number']) ? $config['item_number'] : null; |
|
21 | 21 | $this->parentOptionName = isset($config['parent_option_name']) ? $config['parent_option_name'] : null; |
22 | - $this->flatOptions = isset($config['flat_options']) ? $config['flat_options'] : array(); |
|
23 | - $this->image = isset($config['image']) ? $config['image'] : null; |
|
24 | - $this->uom = isset($config['uom']) ? $config['uom'] : null; |
|
22 | + $this->flatOptions = isset($config['flat_options']) ? $config['flat_options'] : array(); |
|
23 | + $this->image = isset($config['image']) ? $config['image'] : null; |
|
24 | + $this->uom = isset($config['uom']) ? $config['uom'] : null; |
|
25 | 25 | } |
26 | 26 | } |
27 | 27 |
@@ -68,7 +68,7 @@ |
||
68 | 68 | if ($this->getPriceDiscountFixed()) { |
69 | 69 | return -$this->getPriceDiscountFixed(); |
70 | 70 | } elseif ($this->getPriceDiscountPercent()) { |
71 | - return $parentPrice * -($this->getPriceDiscountPercent()/100); |
|
71 | + return $parentPrice * -($this->getPriceDiscountPercent() / 100); |
|
72 | 72 | } elseif ($this->getPriceNoCharge()) { |
73 | 73 | return -$parentPrice; |
74 | 74 | } elseif ($this->getPriceOverrideFixed()) { |
@@ -10,7 +10,7 @@ |
||
10 | 10 | protected $parent; |
11 | 11 | |
12 | 12 | /** |
13 | - * @return parent |
|
13 | + * @return AbstractModel |
|
14 | 14 | */ |
15 | 15 | public function getParent() |
16 | 16 | { |
@@ -85,8 +85,8 @@ discard block |
||
85 | 85 | |
86 | 86 | public function addProduct($categoryOrId, $productOrId) |
87 | 87 | { |
88 | - $categoryId = ( is_numeric($categoryOrId) ? $categoryOrId : $categoryOrId->getCategoryId() ); |
|
89 | - $productId = ( is_numeric($productOrId) ? $productOrId : $productOrId->getProductId() ); |
|
88 | + $categoryId = (is_numeric($categoryOrId) ? $categoryOrId : $categoryOrId->getCategoryId()); |
|
89 | + $productId = (is_numeric($productOrId) ? $productOrId : $productOrId->getProductId()); |
|
90 | 90 | |
91 | 91 | return $this->getEntityMapper()->addProduct($categoryId, $productId); |
92 | 92 | } |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | if (null === $categoryOrId) { |
97 | 97 | throw new \RuntimeException('categoryOrId cannot be null'); |
98 | 98 | } |
99 | - $categoryId = ( is_numeric($categoryOrId) ? $categoryOrId : $categoryOrId->getCategoryId() ); |
|
99 | + $categoryId = (is_numeric($categoryOrId) ? $categoryOrId : $categoryOrId->getCategoryId()); |
|
100 | 100 | |
101 | 101 | $parentCategoryId = ( |
102 | 102 | is_int($parentCategoryOrIdOrNull) |
@@ -112,8 +112,8 @@ discard block |
||
112 | 112 | |
113 | 113 | public function setImage($categoryOrId, $imageOrId) |
114 | 114 | { |
115 | - $categoryId = ( is_int($categoryOrId) ? $categoryOrId : $categoryOrId->getCategoryId() ); |
|
116 | - $imageId = ( is_int($imageOrId) ? $imageOrId : $imageOrId->getMediaId() ); |
|
115 | + $categoryId = (is_int($categoryOrId) ? $categoryOrId : $categoryOrId->getCategoryId()); |
|
116 | + $imageId = (is_int($imageOrId) ? $imageOrId : $imageOrId->getMediaId()); |
|
117 | 117 | |
118 | 118 | return $this->getImageService()->addLinker('category', $categoryId, $imageId); |
119 | 119 | } |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | |
43 | 43 | public function addOption($choiceOrId, $optionOrId) |
44 | 44 | { |
45 | - $choiceId = ( is_int($choiceOrId) ? $choiceOrId : $choiceOrId->getChoiceId() ); |
|
46 | - $optionId = ( is_int($optionOrId) ? $optionOrId : $optionOrId->getOptionId() ); |
|
45 | + $choiceId = (is_int($choiceOrId) ? $choiceOrId : $choiceOrId->getChoiceId()); |
|
46 | + $optionId = (is_int($optionOrId) ? $optionOrId : $optionOrId->getOptionId()); |
|
47 | 47 | $this->getEntityMapper()->addOption($choiceId, $optionId); |
48 | 48 | return $this->getOptionService()->find(array('option_id' => $optionId)); |
49 | 49 | } |
@@ -68,14 +68,14 @@ discard block |
||
68 | 68 | |
69 | 69 | public function removeOption($choiceOrId, $optionOrId) |
70 | 70 | { |
71 | - $productId = ( is_int($choiceOrId) ? $choiceOrId : $choiceOrId->getProductId() ); |
|
72 | - $optionId = ( is_int($optionOrId) ? $optionOrId : $optionOrId->getOptionId() ); |
|
71 | + $productId = (is_int($choiceOrId) ? $choiceOrId : $choiceOrId->getProductId()); |
|
72 | + $optionId = (is_int($optionOrId) ? $optionOrId : $optionOrId->getOptionId()); |
|
73 | 73 | $this->getEntityMapper()->removeOption($productId, $optionId); |
74 | 74 | } |
75 | 75 | |
76 | 76 | public function choiceFromProduct($productOrId) |
77 | 77 | { |
78 | - $product = ( !is_int($productOrId) ? $productOrId : $this->getProductService()->find($productOrId) ); |
|
78 | + $product = (!is_int($productOrId) ? $productOrId : $this->getProductService()->find($productOrId)); |
|
79 | 79 | $choice = $this->getEntity()->setProductId($product->getProductId()); |
80 | 80 | return $this->persist($choice); |
81 | 81 | } |
@@ -185,8 +185,8 @@ |
||
185 | 185 | |
186 | 186 | public function addOption($productOrId, $optionOrId) |
187 | 187 | { |
188 | - $productId = ( is_int($productOrId) ? $productOrId : $productOrId->getProductId() ); |
|
189 | - $optionId = ( is_int($optionOrId) ? $optionOrId : $optionOrId->getOptionId() ); |
|
188 | + $productId = (is_int($productOrId) ? $productOrId : $productOrId->getProductId()); |
|
189 | + $optionId = (is_int($optionOrId) ? $optionOrId : $optionOrId->getOptionId()); |
|
190 | 190 | |
191 | 191 | $this->getEntityMapper()->addOption($productId, $optionId); |
192 | 192 |