@@ -66,6 +66,13 @@ discard block |
||
66 | 66 | |
67 | 67 | private $mode; |
68 | 68 | |
69 | + /** |
|
70 | + * @param string $magicSql |
|
71 | + * @param string $magicSqlCount |
|
72 | + * @param WeakrefObjectStorage $objectStorage |
|
73 | + * @param string|null $className |
|
74 | + * @param integer $mode |
|
75 | + */ |
|
69 | 76 | public function __construct($magicSql, $magicSqlCount, array $parameters, array $columnDescriptors, $objectStorage, $className, TDBMService $tdbmService, MagicQuery $magicQuery, $mode) |
70 | 77 | { |
71 | 78 | $this->magicSql = $magicSql; |
@@ -147,6 +154,7 @@ discard block |
||
147 | 154 | |
148 | 155 | /** |
149 | 156 | * @param int $offset |
157 | + * @param integer $limit |
|
150 | 158 | * |
151 | 159 | * @return PageIterator |
152 | 160 | */ |
@@ -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 | } |
@@ -777,7 +777,7 @@ discard block |
||
777 | 777 | * This is used internally by TDBM to add an object to the list of objects that have been |
778 | 778 | * created/updated but not saved yet. |
779 | 779 | * |
780 | - * @param AbstractTDBMObject $myObject |
|
780 | + * @param DbRow $myObject |
|
781 | 781 | */ |
782 | 782 | public function _addToToSaveObjectList(DbRow $myObject) |
783 | 783 | { |
@@ -1441,7 +1441,7 @@ discard block |
||
1441 | 1441 | } |
1442 | 1442 | |
1443 | 1443 | /** |
1444 | - * @param $table |
|
1444 | + * @param string $table |
|
1445 | 1445 | * @param array $primaryKeys |
1446 | 1446 | * @param array $additionalTablesFetch |
1447 | 1447 | * @param bool $lazy Whether to perform lazy loading on this object or not. |
@@ -1616,7 +1616,7 @@ discard block |
||
1616 | 1616 | * @param $pivotTableName |
1617 | 1617 | * @param AbstractTDBMObject $bean |
1618 | 1618 | * |
1619 | - * @return AbstractTDBMObject[] |
|
1619 | + * @return ResultIterator |
|
1620 | 1620 | */ |
1621 | 1621 | public function _getRelatedBeans($pivotTableName, AbstractTDBMObject $bean) |
1622 | 1622 | { |
@@ -1016,7 +1016,7 @@ discard block |
||
1016 | 1016 | sort($tables); |
1017 | 1017 | |
1018 | 1018 | return $this->fromCache($this->cachePrefix.'_linkbetweeninheritedtables_'.implode('__split__', $tables), |
1019 | - function () use ($tables) { |
|
1019 | + function() use ($tables) { |
|
1020 | 1020 | return $this->_getLinkBetweenInheritedTablesWithoutCache($tables); |
1021 | 1021 | }); |
1022 | 1022 | } |
@@ -1063,7 +1063,7 @@ discard block |
||
1063 | 1063 | */ |
1064 | 1064 | public function _getRelatedTablesByInheritance($table) |
1065 | 1065 | { |
1066 | - return $this->fromCache($this->cachePrefix.'_relatedtables_'.$table, function () use ($table) { |
|
1066 | + return $this->fromCache($this->cachePrefix.'_relatedtables_'.$table, function() use ($table) { |
|
1067 | 1067 | return $this->_getRelatedTablesByInheritanceWithoutCache($table); |
1068 | 1068 | }); |
1069 | 1069 | } |
@@ -1347,7 +1347,7 @@ discard block |
||
1347 | 1347 | $objects = $this->findObjects($mainTable, $filter, $parameters, null, $additionalTablesFetch, self::MODE_ARRAY, $className); |
1348 | 1348 | $page = $objects->take(0, 2); |
1349 | 1349 | $count = $page->count(); |
1350 | - if ($count > 1) { |
|
1350 | + if ($count>1) { |
|
1351 | 1351 | throw new DuplicateRowException("Error while querying an object for table '$mainTable': More than 1 row have been returned, but we should have received at most one."); |
1352 | 1352 | } elseif ($count === 0) { |
1353 | 1353 | return; |
@@ -1464,7 +1464,7 @@ discard block |
||
1464 | 1464 | $remoteTable = $remoteFk->getForeignTableName(); |
1465 | 1465 | |
1466 | 1466 | $primaryKeys = $this->getPrimaryKeyValues($bean); |
1467 | - $columnNames = array_map(function ($name) use ($pivotTableName) { return $pivotTableName.'.'.$name; }, $localFk->getLocalColumns()); |
|
1467 | + $columnNames = array_map(function($name) use ($pivotTableName) { return $pivotTableName.'.'.$name; }, $localFk->getLocalColumns()); |
|
1468 | 1468 | |
1469 | 1469 | $filter = array_combine($columnNames, $primaryKeys); |
1470 | 1470 | |
@@ -1485,7 +1485,7 @@ discard block |
||
1485 | 1485 | $table1 = $fks[0]->getForeignTableName(); |
1486 | 1486 | $table2 = $fks[1]->getForeignTableName(); |
1487 | 1487 | |
1488 | - $beanTables = array_map(function (DbRow $dbRow) { return $dbRow->_getDbTableName(); }, $bean->_getDbRows()); |
|
1488 | + $beanTables = array_map(function(DbRow $dbRow) { return $dbRow->_getDbTableName(); }, $bean->_getDbRows()); |
|
1489 | 1489 | |
1490 | 1490 | if (in_array($table1, $beanTables)) { |
1491 | 1491 | return [$fks[0], $fks[1]]; |
@@ -1541,7 +1541,7 @@ discard block |
||
1541 | 1541 | { |
1542 | 1542 | if (!isset($typesForTable[$tableName])) { |
1543 | 1543 | $columns = $this->tdbmSchemaAnalyzer->getSchema()->getTable($tableName)->getColumns(); |
1544 | - $typesForTable[$tableName] = array_map(function (Column $column) { |
|
1544 | + $typesForTable[$tableName] = array_map(function(Column $column) { |
|
1545 | 1545 | return $column->getType(); |
1546 | 1546 | }, $columns); |
1547 | 1547 | } |
@@ -124,7 +124,7 @@ |
||
124 | 124 | public function getIncomingForeignKeys($tableName) |
125 | 125 | { |
126 | 126 | $junctionTables = $this->schemaAnalyzer->detectJunctionTables(); |
127 | - $junctionTableNames = array_map(function (Table $table) { return $table->getName(); }, $junctionTables); |
|
127 | + $junctionTableNames = array_map(function(Table $table) { return $table->getName(); }, $junctionTables); |
|
128 | 128 | $childrenRelationships = $this->schemaAnalyzer->getChildrenRelationships($tableName); |
129 | 129 | |
130 | 130 | $fks = []; |
@@ -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; |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | /** |
148 | 148 | * Returns the name of the base bean class from the table name. |
149 | 149 | * |
150 | - * @param $tableName |
|
150 | + * @param string $tableName |
|
151 | 151 | * |
152 | 152 | * @return string |
153 | 153 | */ |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | /** |
160 | 160 | * Returns the name of the base DAO class from the table name. |
161 | 161 | * |
162 | - * @param $tableName |
|
162 | + * @param string $tableName |
|
163 | 163 | * |
164 | 164 | * @return string |
165 | 165 | */ |
@@ -176,6 +176,7 @@ discard block |
||
176 | 176 | * @param Table $table The table |
177 | 177 | * @param string $beannamespace The namespace of the bean |
178 | 178 | * @param ClassNameMapper $classNameMapper |
179 | + * @param boolean $storeInUtc |
|
179 | 180 | * |
180 | 181 | * @throws TDBMException |
181 | 182 | */ |
@@ -486,6 +487,8 @@ discard block |
||
486 | 487 | * Generates the factory bean. |
487 | 488 | * |
488 | 489 | * @param Table[] $tableList |
490 | + * @param string $daoFactoryClassName |
|
491 | + * @param string $daoNamespace |
|
489 | 492 | */ |
490 | 493 | private function generateFactory(array $tableList, $daoFactoryClassName, $daoNamespace, ClassNameMapper $classNameMapper) |
491 | 494 | { |
@@ -77,11 +77,11 @@ discard block |
||
77 | 77 | |
78 | 78 | // Remove all beans and daos from junction tables |
79 | 79 | $junctionTables = $this->schemaAnalyzer->detectJunctionTables(); |
80 | - $junctionTableNames = array_map(function (Table $table) { |
|
80 | + $junctionTableNames = array_map(function(Table $table) { |
|
81 | 81 | return $table->getName(); |
82 | 82 | }, $junctionTables); |
83 | 83 | |
84 | - $tableList = array_filter($tableList, function (Table $table) use ($junctionTableNames) { |
|
84 | + $tableList = array_filter($tableList, function(Table $table) use ($junctionTableNames) { |
|
85 | 85 | return !in_array($table->getName(), $junctionTableNames); |
86 | 86 | }); |
87 | 87 | |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | // Ok, let's return the list of all tables. |
95 | 95 | // These will be used by the calling script to create Mouf instances. |
96 | 96 | |
97 | - return array_map(function (Table $table) { return $table->getName(); }, $tableList); |
|
97 | + return array_map(function(Table $table) { return $table->getName(); }, $tableList); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | /** |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | $usedBeans[] = $beanClassName; |
288 | 288 | // Let's suppress duplicates in used beans (if any) |
289 | 289 | $usedBeans = array_flip(array_flip($usedBeans)); |
290 | - $useStatements = array_map(function ($usedBean) { |
|
290 | + $useStatements = array_map(function($usedBean) { |
|
291 | 291 | return "use $usedBean;\n"; |
292 | 292 | }, $usedBeans); |
293 | 293 | |
@@ -587,7 +587,7 @@ discard block |
||
587 | 587 | $pos = strpos($str, ' '); |
588 | 588 | } |
589 | 589 | $before = substr($str, 0, $pos); |
590 | - $after = substr($str, $pos + 1); |
|
590 | + $after = substr($str, $pos+1); |
|
591 | 591 | $str = $before.strtoupper(substr($after, 0, 1)).substr($after, 1); |
592 | 592 | } |
593 | 593 |
@@ -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]; |