@@ -34,6 +34,9 @@ discard block |
||
34 | 34 | return $options; |
35 | 35 | } |
36 | 36 | |
37 | + /** |
|
38 | + * @param integer $productId |
|
39 | + */ |
|
37 | 40 | public function getBuildersByProductId($productId) |
38 | 41 | { |
39 | 42 | $choices = $this->getEntityMapper()->getBuildersByProductId($productId); |
@@ -130,6 +133,9 @@ discard block |
||
130 | 133 | return true; //choice was found, and then deleted successfully |
131 | 134 | } |
132 | 135 | |
136 | + /** |
|
137 | + * @param integer $optionId |
|
138 | + */ |
|
133 | 139 | public function sortChoices($optionId, array $order = array()) |
134 | 140 | { |
135 | 141 | return $this->getEntityMapper()->sortChoices($optionId, $order); |
@@ -189,7 +195,7 @@ discard block |
||
189 | 195 | } |
190 | 196 | |
191 | 197 | /** |
192 | - * @param $productService |
|
198 | + * @param Product $productService |
|
193 | 199 | * @return self |
194 | 200 | */ |
195 | 201 | public function setProductService($productService) |
@@ -196,6 +196,7 @@ discard block |
||
196 | 196 | /** |
197 | 197 | * store new sort order for product options |
198 | 198 | * $order is array of position => optionId |
199 | + * @param integer $productId |
|
199 | 200 | */ |
200 | 201 | public function sortOptions($productId, array $order) |
201 | 202 | { |
@@ -241,6 +242,9 @@ discard block |
||
241 | 242 | return $this->getEntityMapper()->removeSpec($productId, $specId); |
242 | 243 | } |
243 | 244 | |
245 | + /** |
|
246 | + * @param \SpeckCatalog\Model\Product $dataOrModel |
|
247 | + */ |
|
244 | 248 | public function insert($dataOrModel) |
245 | 249 | { |
246 | 250 | $vars = array( |
@@ -264,6 +268,9 @@ discard block |
||
264 | 268 | // |
265 | 269 | } |
266 | 270 | |
271 | + /** |
|
272 | + * @param integer $categoryId |
|
273 | + */ |
|
267 | 274 | public function getByCategoryId($categoryId) |
268 | 275 | { |
269 | 276 | return $this->getEntityMapper()->getByCategoryId($categoryId); |
@@ -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 |
@@ -11,6 +11,9 @@ |
||
11 | 11 | protected $uomService; |
12 | 12 | protected $productService; |
13 | 13 | |
14 | + /** |
|
15 | + * @param integer $productId |
|
16 | + */ |
|
14 | 17 | public function getByProductId($productId, $populate = false, $recursive = false) |
15 | 18 | { |
16 | 19 | $productUoms = $this->getEntityMapper()->getByProductId($productId); |
@@ -15,11 +15,17 @@ |
||
15 | 15 | return $spec; |
16 | 16 | } |
17 | 17 | |
18 | + /** |
|
19 | + * @param integer $productId |
|
20 | + */ |
|
18 | 21 | public function getByProductId($productId) |
19 | 22 | { |
20 | 23 | return $this->getEntityMapper()->getByProductId($productId); |
21 | 24 | } |
22 | 25 | |
26 | + /** |
|
27 | + * @param \SpeckCatalog\Model\Spec $spec |
|
28 | + */ |
|
23 | 29 | public function insert($spec) |
24 | 30 | { |
25 | 31 | $id = parent::insert($spec); |
@@ -262,6 +262,9 @@ |
||
262 | 262 | return $this; |
263 | 263 | } |
264 | 264 | |
265 | + /** |
|
266 | + * @param string $name |
|
267 | + */ |
|
265 | 268 | public function getService($name) |
266 | 269 | { |
267 | 270 | if (!array_key_exists($name, $this->services)) { |
@@ -92,12 +92,12 @@ discard block |
||
92 | 92 | //data needed to represent a uom to be displayed |
93 | 93 | $data = array( |
94 | 94 | 'enabled' => false, |
95 | - 'key' => $uom->getUomCode().$uom->getQuantity(), |
|
95 | + 'key' => $uom->getUomCode() . $uom->getQuantity(), |
|
96 | 96 | 'price' => 'N/A', |
97 | 97 | 'name' => $uom->getUom()->getName(), |
98 | 98 | 'code' => $uom->getUomCode(), |
99 | 99 | 'quantity' => $uom->getQuantity(), |
100 | - 'uom_string' => $uom->getUomCode().$uom->getQuantity(), |
|
100 | + 'uom_string' => $uom->getUomCode() . $uom->getQuantity(), |
|
101 | 101 | ); |
102 | 102 | if ($enabled) { |
103 | 103 | $data['enabled'] = true; |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | public function renderMany($uoms, $uomString = null, $quantity = 1) |
171 | 171 | { |
172 | 172 | foreach ($uoms as $uom) { |
173 | - $key= $uom['key']; |
|
173 | + $key = $uom['key']; |
|
174 | 174 | $options[$key] = array( |
175 | 175 | 'value' => $key, |
176 | 176 | 'label' => $this->getDisplayName($uom, true), |
@@ -39,6 +39,9 @@ discard block |
||
39 | 39 | return (int) $result->getGeneratedValue(); |
40 | 40 | } |
41 | 41 | |
42 | + /** |
|
43 | + * @param integer $parentOptionId |
|
44 | + */ |
|
42 | 45 | public function insertChoice($parentOptionId) |
43 | 46 | { |
44 | 47 | $mapper = $this->getTestMapper(); |
@@ -48,6 +51,11 @@ discard block |
||
48 | 51 | return (int) $result->getGeneratedValue(); |
49 | 52 | } |
50 | 53 | |
54 | + /** |
|
55 | + * @param integer $productId |
|
56 | + * @param string $uomCode |
|
57 | + * @param integer $quantity |
|
58 | + */ |
|
51 | 59 | public function insertProductUom($productId, $uomCode, $quantity) |
52 | 60 | { |
53 | 61 | $productUom = array( |
@@ -61,6 +69,12 @@ discard block |
||
61 | 69 | $mapper->insert($productUom, 'catalog_product_uom'); |
62 | 70 | } |
63 | 71 | |
72 | + /** |
|
73 | + * @param integer $productId |
|
74 | + * @param string $uomCode |
|
75 | + * @param integer $quantity |
|
76 | + * @param integer $distributorId |
|
77 | + */ |
|
64 | 78 | public function insertAvailability($productId, $uomCode, $quantity, $distributorId) |
65 | 79 | { |
66 | 80 | $availability = array( |
@@ -74,6 +88,9 @@ discard block |
||
74 | 88 | $mapper->insert($availability, 'catalog_availability'); |
75 | 89 | } |
76 | 90 | |
91 | + /** |
|
92 | + * @param string $parentType |
|
93 | + */ |
|
77 | 94 | public function insertImage($parentType, $parentId = 1) |
78 | 95 | { |
79 | 96 | $mapper = $this->getTestMapper(); |
@@ -108,6 +125,10 @@ discard block |
||
108 | 125 | return (int) $result->getGeneratedValue(); |
109 | 126 | } |
110 | 127 | |
128 | + /** |
|
129 | + * @param string $uomCode |
|
130 | + * @param string $name |
|
131 | + */ |
|
111 | 132 | public function insertUom($uomCode, $name) |
112 | 133 | { |
113 | 134 | $uom = array('uom_code' => $uomCode, 'name' => $name); |
@@ -166,6 +166,9 @@ |
||
166 | 166 | return $mock; |
167 | 167 | } |
168 | 168 | |
169 | + /** |
|
170 | + * @return \Zend\ServiceManager\ServiceLocatorInterface |
|
171 | + */ |
|
169 | 172 | public function getMockServiceManager(array $items = array()) |
170 | 173 | { |
171 | 174 | $mockSM = $this->getMock('\Zend\ServiceManager\ServiceLocatorInterface'); |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | __DIR__ . '/config/module.config.routes.php', |
26 | 26 | __DIR__ . '/config/module.config.servicemanager.php', |
27 | 27 | ); |
28 | - foreach($configFiles as $configFile) { |
|
28 | + foreach ($configFiles as $configFile) { |
|
29 | 29 | $config = \Zend\Stdlib\ArrayUtils::merge($config, include $configFile); |
30 | 30 | } |
31 | 31 | return $config; |
@@ -43,25 +43,25 @@ discard block |
||
43 | 43 | |
44 | 44 | public function onBootstrap($e) |
45 | 45 | { |
46 | - if($e->getRequest() instanceof \Zend\Console\Request){ |
|
46 | + if ($e->getRequest() instanceof \Zend\Console\Request) { |
|
47 | 47 | return; |
48 | 48 | } |
49 | 49 | |
50 | 50 | $app = $e->getParam('application'); |
51 | 51 | |
52 | - $locator = $app->getServiceManager(); |
|
52 | + $locator = $app->getServiceManager(); |
|
53 | 53 | $this->setServiceManager($locator); |
54 | 54 | |
55 | - $em = $app->getEventManager()->getSharedManager(); |
|
55 | + $em = $app->getEventManager()->getSharedManager(); |
|
56 | 56 | |
57 | - $em->attach('ImageUploader\Service\Uploader', 'fileupload.pre', array('SpeckCatalog\Event\FileUpload', 'preFileUpload')); |
|
57 | + $em->attach('ImageUploader\Service\Uploader', 'fileupload.pre', array('SpeckCatalog\Event\FileUpload', 'preFileUpload')); |
|
58 | 58 | $em->attach('ImageUploader\Service\Uploader', 'fileupload.post', array('SpeckCatalog\Event\FileUpload', 'postFileUpload')); |
59 | 59 | |
60 | - $em->attach('SpeckCatalog\Service\ProductUom', 'insert.post', function ($e) { |
|
60 | + $em->attach('SpeckCatalog\Service\ProductUom', 'insert.post', function($e) { |
|
61 | 61 | $eventClass = new Event\FrontendEnabled; |
62 | 62 | $eventClass->insertProductUom($e); |
63 | 63 | }); |
64 | - $em->attach('SpeckCatalog\Service\ProductUom', 'update.post', function ($e) { |
|
64 | + $em->attach('SpeckCatalog\Service\ProductUom', 'update.post', function($e) { |
|
65 | 65 | $eventClass = new Event\FrontendEnabled; |
66 | 66 | $eventClass->updateProductUom($e); |
67 | 67 | }); |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | $em->attach('SpeckCatalog\Service\Product', 'insert.post', array('SpeckCatalog\Event\FrontendEnabled', 'insertProduct')); |
70 | 70 | |
71 | 71 | //install event listeners |
72 | - $em->attach('SpeckInstall\Controller\InstallController', 'install.create_tables.post', array($this, 'constraints'),1); |
|
72 | + $em->attach('SpeckInstall\Controller\InstallController', 'install.create_tables.post', array($this, 'constraints'), 1); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | public function constraints($e) |
@@ -79,15 +79,15 @@ discard block |
||
79 | 79 | |
80 | 80 | //check dependencies |
81 | 81 | $tables = $mapper->query("show tables like 'contact_company'"); |
82 | - if(!count($tables)) { |
|
82 | + if (!count($tables)) { |
|
83 | 83 | return array(false, 'SpeckCatalog could not add table constraints - missing table contact_company from SpeckContact'); |
84 | 84 | } |
85 | 85 | $tables = $mapper->query("show tables like 'catalog_product'"); |
86 | - if(!count($tables)) { |
|
86 | + if (!count($tables)) { |
|
87 | 87 | return array(false, 'SpeckCatalog could not add table constraints - missing tables provided by SpeckCatalog'); |
88 | 88 | } |
89 | 89 | |
90 | - $alter = file_get_contents(__DIR__ .'/data/alter.sql'); |
|
90 | + $alter = file_get_contents(__DIR__ . '/data/alter.sql'); |
|
91 | 91 | $mapper->query($alter); |
92 | 92 | |
93 | 93 | } catch (\Exception $e) { |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -return function ($class) { |
|
2 | +return function($class) { |
|
3 | 3 | static $map; |
4 | 4 | if (!$map) { |
5 | 5 | $map = include __DIR__ . '/autoload_classmap.php'; |