@@ -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); |
@@ -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) { |
@@ -8,7 +8,7 @@ |
||
| 8 | 8 | { |
| 9 | 9 | public function getItems($a, $b) |
| 10 | 10 | { |
| 11 | - $items=parent::getItems($a, $b); |
|
| 11 | + $items = parent::getItems($a, $b); |
|
| 12 | 12 | $return = array(); |
| 13 | 13 | foreach ($items as $item) { |
| 14 | 14 | $return[] = $item; |
@@ -77,7 +77,7 @@ |
||
| 77 | 77 | $offset = ((($page * $perPage) - $perPage) + 1); //this is the first item on the page |
| 78 | 78 | |
| 79 | 79 | $paginatorVars['p'] = floor($offset / $_GET['nn']) + 1; //new page number |
| 80 | - $paginatorVars['n'] = $_GET['nn']; //new items per page |
|
| 80 | + $paginatorVars['n'] = $_GET['nn']; //new items per page |
|
| 81 | 81 | |
| 82 | 82 | $query = '?' . http_build_query($paginatorVars); |
| 83 | 83 | |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | * flag is set to false if edit() has been called, |
| 14 | 14 | * to differentiate between a form for a new record, or an existing record. |
| 15 | 15 | */ |
| 16 | - protected $new=true; |
|
| 16 | + protected $new = true; |
|
| 17 | 17 | |
| 18 | 18 | /* |
| 19 | 19 | * automatically set the hydrator for the form |
@@ -138,7 +138,7 @@ |
||
| 138 | 138 | } |
| 139 | 139 | } else { |
| 140 | 140 | if ($this->renderErrors) { |
| 141 | - $markup = $elementString; //. $elementErrors; |
|
| 141 | + $markup = $elementString; //. $elementErrors; |
|
| 142 | 142 | } else { |
| 143 | 143 | $markup = $elementString; |
| 144 | 144 | } |
@@ -175,7 +175,7 @@ |
||
| 175 | 175 | /** |
| 176 | 176 | * Set the label position |
| 177 | 177 | * |
| 178 | - * @param $labelPosition |
|
| 178 | + * @param string $labelPosition |
|
| 179 | 179 | * @return FormRow |
| 180 | 180 | * @throws \Zend\Form\Exception\InvalidArgumentException |
| 181 | 181 | */ |
@@ -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; |