@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | { |
| 66 | 66 | // First, are there many column or only one? |
| 67 | 67 | // If one column, we name the setter after it. Otherwise, we name the setter after the table name |
| 68 | - if (count($this->foreignKey->getLocalColumns()) > 1) { |
|
| 68 | + if (count($this->foreignKey->getLocalColumns())>1) { |
|
| 69 | 69 | $name = TDBMDaoGenerator::toSingular(TDBMDaoGenerator::toCamelCase($this->foreignKey->getForeignTableName())); |
| 70 | 70 | if ($this->alternativeName) { |
| 71 | 71 | $camelizedColumns = array_map(['Mouf\\Database\\TDBM\\Utils\\TDBMDaoGenerator', 'toCamelCase'], $this->foreignKey->getLocalColumns()); |
@@ -78,8 +78,8 @@ discard block |
||
| 78 | 78 | if (strpos(strtolower($column), 'id_') === 0) { |
| 79 | 79 | $column = substr($column, 3); |
| 80 | 80 | } |
| 81 | - if (strrpos(strtolower($column), '_id') === strlen($column) - 3) { |
|
| 82 | - $column = substr($column, 0, strlen($column) - 3); |
|
| 81 | + if (strrpos(strtolower($column), '_id') === strlen($column)-3) { |
|
| 82 | + $column = substr($column, 0, strlen($column)-3); |
|
| 83 | 83 | } |
| 84 | 84 | $name = TDBMDaoGenerator::toCamelCase($column); |
| 85 | 85 | if ($this->alternativeName) { |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | |
| 84 | 84 | private function toIndex($offset) |
| 85 | 85 | { |
| 86 | - if ($offset < 0 || filter_var($offset, FILTER_VALIDATE_INT) === false) { |
|
| 86 | + if ($offset<0 || filter_var($offset, FILTER_VALIDATE_INT) === false) { |
|
| 87 | 87 | throw new TDBMInvalidOffsetException('Trying to access result set using offset "'.$offset.'". An offset must be a positive integer.'); |
| 88 | 88 | } |
| 89 | 89 | if ($this->statement === null) { |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | public function next() |
| 101 | 101 | { |
| 102 | 102 | // Let's overload the next() method to store the result. |
| 103 | - if (isset($this->results[$this->key + 1])) { |
|
| 103 | + if (isset($this->results[$this->key+1])) { |
|
| 104 | 104 | ++$this->key; |
| 105 | 105 | $this->current = $this->results[$this->key]; |
| 106 | 106 | } else { |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | */ |
| 113 | 113 | public function getCurrentPage() |
| 114 | 114 | { |
| 115 | - return floor($this->offset / $this->limit) + 1; |
|
| 115 | + return floor($this->offset/$this->limit)+1; |
|
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | /** |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | */ |
| 252 | 252 | public function jsonSerialize() |
| 253 | 253 | { |
| 254 | - return array_map(function (AbstractTDBMObject $item) { |
|
| 254 | + return array_map(function(AbstractTDBMObject $item) { |
|
| 255 | 255 | return $item->jsonSerialize(); |
| 256 | 256 | }, $this->toArray()); |
| 257 | 257 | } |
@@ -181,6 +181,9 @@ |
||
| 181 | 181 | |
| 182 | 182 | protected $errorMsg; |
| 183 | 183 | |
| 184 | + /** |
|
| 185 | + * @param string $msg |
|
| 186 | + */ |
|
| 184 | 187 | private function displayErrorMsg($msg) |
| 185 | 188 | { |
| 186 | 189 | $this->errorMsg = $msg; |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | */ |
| 187 | 187 | private function checkTableName($tableName = null) { |
| 188 | 188 | if ($tableName === null) { |
| 189 | - if (count($this->dbRows) > 1) { |
|
| 189 | + if (count($this->dbRows)>1) { |
|
| 190 | 190 | throw new TDBMException('This object is based on several tables. You must specify which table you are retrieving data from.'); |
| 191 | 191 | } elseif (count($this->dbRows) === 1) { |
| 192 | 192 | $tableName = array_keys($this->dbRows)[0]; |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | protected function set($var, $value, $tableName = null) |
| 214 | 214 | { |
| 215 | 215 | if ($tableName === null) { |
| 216 | - if (count($this->dbRows) > 1) { |
|
| 216 | + if (count($this->dbRows)>1) { |
|
| 217 | 217 | throw new TDBMException('This object is based on several tables. You must specify which table you are retrieving data from.'); |
| 218 | 218 | } elseif (count($this->dbRows) === 1) { |
| 219 | 219 | $tableName = array_keys($this->dbRows)[0]; |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | protected function setRef($foreignKeyName, AbstractTDBMObject $bean, $tableName = null) |
| 240 | 240 | { |
| 241 | 241 | if ($tableName === null) { |
| 242 | - if (count($this->dbRows) > 1) { |
|
| 242 | + if (count($this->dbRows)>1) { |
|
| 243 | 243 | throw new TDBMException('This object is based on several tables. You must specify which table you are retrieving data from.'); |
| 244 | 244 | } elseif (count($this->dbRows) === 1) { |
| 245 | 245 | $tableName = array_keys($this->dbRows)[0]; |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | * @Action |
| 87 | 87 | * |
| 88 | 88 | * @param string $name |
| 89 | - * @param bool $selfedit |
|
| 89 | + * @param string|boolean $selfedit |
|
| 90 | 90 | */ |
| 91 | 91 | public function generate($name, $daonamespace, $beannamespace, $daofactoryclassname, $daofactoryinstancename, $storeInUtc = 0, $selfedit = 'false', $useCustomComposer = false, $composerFile = '') |
| 92 | 92 | { |
@@ -109,6 +109,8 @@ discard block |
||
| 109 | 109 | * @param string $daofactoryinstancename |
| 110 | 110 | * @param string $selfedit |
| 111 | 111 | * @param bool $storeInUtc |
| 112 | + * @param boolean $useCustomComposer |
|
| 113 | + * @param string $composerFile |
|
| 112 | 114 | * |
| 113 | 115 | * @throws \Mouf\MoufException |
| 114 | 116 | */ |
@@ -245,7 +245,7 @@ |
||
| 245 | 245 | */ |
| 246 | 246 | public function jsonSerialize($stopRecursion = false) |
| 247 | 247 | { |
| 248 | - return array_map(function (AbstractTDBMObject $item) use ($stopRecursion) { |
|
| 248 | + return array_map(function(AbstractTDBMObject $item) use ($stopRecursion) { |
|
| 249 | 249 | return $item->jsonSerialize($stopRecursion); |
| 250 | 250 | }, $this->toArray()); |
| 251 | 251 | } |
@@ -62,6 +62,10 @@ discard block |
||
| 62 | 62 | |
| 63 | 63 | private $logger; |
| 64 | 64 | |
| 65 | + /** |
|
| 66 | + * @param null|string $className |
|
| 67 | + * @param integer $mode |
|
| 68 | + */ |
|
| 65 | 69 | public function __construct(QueryFactory $queryFactory, array $parameters, $objectStorage, $className, TDBMService $tdbmService, MagicQuery $magicQuery, $mode, LoggerInterface $logger) |
| 66 | 70 | { |
| 67 | 71 | if ($mode !== null && $mode !== TDBMService::MODE_CURSOR && $mode !== TDBMService::MODE_ARRAY) { |
@@ -299,7 +303,6 @@ discard block |
||
| 299 | 303 | * |
| 300 | 304 | * $resultSet = $resultSet->withParameters('label ASC, status DESC'); |
| 301 | 305 | * |
| 302 | - * @param string|UncheckedOrderBy|null $orderBy |
|
| 303 | 306 | * @return ResultIterator |
| 304 | 307 | */ |
| 305 | 308 | public function withParameters(array $parameters) : ResultIterator |
@@ -374,11 +374,11 @@ |
||
| 374 | 374 | $refDbRows = $reference->_getDbRows(); |
| 375 | 375 | $firstRefDbRow = reset($refDbRows); |
| 376 | 376 | $pkValues = array_values($firstRefDbRow->_getPrimaryKeys()); |
| 377 | - for ($i = 0, $count = count($localColumns); $i < $count; ++$i) { |
|
| 377 | + for ($i = 0, $count = count($localColumns); $i<$count; ++$i) { |
|
| 378 | 378 | $dbRow[$localColumns[$i]] = $pkValues[$i]; |
| 379 | 379 | } |
| 380 | 380 | } else { |
| 381 | - for ($i = 0, $count = count($localColumns); $i < $count; ++$i) { |
|
| 381 | + for ($i = 0, $count = count($localColumns); $i<$count; ++$i) { |
|
| 382 | 382 | $dbRow[$localColumns[$i]] = null; |
| 383 | 383 | } |
| 384 | 384 | } |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | /** |
| 69 | 69 | * Adds an additional object to the result set (if not already available). |
| 70 | 70 | * |
| 71 | - * @param $object |
|
| 71 | + * @param AbstractTDBMObject $object |
|
| 72 | 72 | */ |
| 73 | 73 | public function add($object) |
| 74 | 74 | { |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | /** |
| 86 | 86 | * Removes an object from the result set. |
| 87 | 87 | * |
| 88 | - * @param $object |
|
| 88 | + * @param AbstractTDBMObject $object |
|
| 89 | 89 | */ |
| 90 | 90 | public function remove($object) |
| 91 | 91 | { |
@@ -205,6 +205,7 @@ discard block |
||
| 205 | 205 | |
| 206 | 206 | /** |
| 207 | 207 | * @param int $offset |
| 208 | + * @param integer $limit |
|
| 208 | 209 | * |
| 209 | 210 | * @return \Porpaginas\Page |
| 210 | 211 | */ |
@@ -227,7 +228,7 @@ discard block |
||
| 227 | 228 | /** |
| 228 | 229 | * Return an iterator over all results of the paginatable. |
| 229 | 230 | * |
| 230 | - * @return Iterator |
|
| 231 | + * @return \Iterator |
|
| 231 | 232 | */ |
| 232 | 233 | public function getIterator() |
| 233 | 234 | { |