@@ -35,6 +35,9 @@ discard block |
||
35 | 35 | class TDBMObject extends AbstractTDBMObject implements \ArrayAccess, \Iterator |
36 | 36 | { |
37 | 37 | |
38 | + /** |
|
39 | + * @param string $var |
|
40 | + */ |
|
38 | 41 | public function __get($var) |
39 | 42 | { |
40 | 43 | return $this->get($var); |
@@ -51,6 +54,10 @@ discard block |
||
51 | 54 | return $this->has($var); |
52 | 55 | } |
53 | 56 | |
57 | + /** |
|
58 | + * @param string $var |
|
59 | + * @param string|null $value |
|
60 | + */ |
|
54 | 61 | public function __set($var, $value) |
55 | 62 | { |
56 | 63 | $this->set($var, $value); |
@@ -108,7 +108,7 @@ |
||
108 | 108 | public function rewind() |
109 | 109 | { |
110 | 110 | $this->_dbLoadIfNotLoaded(); |
111 | - if (count($this->dbRow) > 0) { |
|
111 | + if (count($this->dbRow)>0) { |
|
112 | 112 | $this->_validIterator = true; |
113 | 113 | } else { |
114 | 114 | $this->_validIterator = false; |
@@ -27,8 +27,7 @@ |
||
27 | 27 | /** |
28 | 28 | * Returns the foreignkey the column is part of, if any. null otherwise. |
29 | 29 | * |
30 | - * @param Column $column |
|
31 | - * @return ForeignKeyConstraint|null |
|
30 | + * @return boolean |
|
32 | 31 | */ |
33 | 32 | public function getForeignKey() { |
34 | 33 | return false; |
@@ -144,9 +144,7 @@ discard block |
||
144 | 144 | * |
145 | 145 | * @param string $daonamespace |
146 | 146 | * @param string $beannamespace |
147 | - * @param int $keepSupport |
|
148 | 147 | * @param int $storeInUtc |
149 | - * @param int $castDatesToDateTime |
|
150 | 148 | * @param string $selfedit |
151 | 149 | * |
152 | 150 | * @throws \Mouf\MoufException |
@@ -183,6 +181,9 @@ discard block |
||
183 | 181 | |
184 | 182 | protected $errorMsg; |
185 | 183 | |
184 | + /** |
|
185 | + * @param string $msg |
|
186 | + */ |
|
186 | 187 | private function displayErrorMsg($msg) |
187 | 188 | { |
188 | 189 | $this->errorMsg = $msg; |
@@ -60,6 +60,9 @@ discard block |
||
60 | 60 | |
61 | 61 | private $innerResultIterator; |
62 | 62 | |
63 | + /** |
|
64 | + * @param integer $offset |
|
65 | + */ |
|
63 | 66 | public function __construct(ResultIterator $parentResult, $magicSql, array $parameters, $limit, $offset, array $columnDescriptors, $objectStorage, $className, TDBMService $tdbmService, MagicQuery $magicQuery, $mode) |
64 | 67 | { |
65 | 68 | $this->parentResult = $parentResult; |
@@ -108,7 +111,7 @@ discard block |
||
108 | 111 | } |
109 | 112 | |
110 | 113 | /** |
111 | - * @return int |
|
114 | + * @return double |
|
112 | 115 | */ |
113 | 116 | public function getCurrentPage() |
114 | 117 | { |
@@ -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 | } |
@@ -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 | */ |
@@ -241,7 +241,7 @@ |
||
241 | 241 | */ |
242 | 242 | public function jsonSerialize() |
243 | 243 | { |
244 | - return array_map(function (AbstractTDBMObject $item) { |
|
244 | + return array_map(function(AbstractTDBMObject $item) { |
|
245 | 245 | return $item->jsonSerialize(); |
246 | 246 | }, $this->toArray()); |
247 | 247 | } |
@@ -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 | { |
@@ -1201,7 +1201,7 @@ discard block |
||
1201 | 1201 | sort($tables); |
1202 | 1202 | |
1203 | 1203 | return $this->fromCache($this->cachePrefix.'_linkbetweeninheritedtables_'.implode('__split__', $tables), |
1204 | - function () use ($tables) { |
|
1204 | + function() use ($tables) { |
|
1205 | 1205 | return $this->_getLinkBetweenInheritedTablesWithoutCache($tables); |
1206 | 1206 | }); |
1207 | 1207 | } |
@@ -1249,7 +1249,7 @@ discard block |
||
1249 | 1249 | */ |
1250 | 1250 | public function _getRelatedTablesByInheritance($table) |
1251 | 1251 | { |
1252 | - return $this->fromCache($this->cachePrefix.'_relatedtables_'.$table, function () use ($table) { |
|
1252 | + return $this->fromCache($this->cachePrefix.'_relatedtables_'.$table, function() use ($table) { |
|
1253 | 1253 | return $this->_getRelatedTablesByInheritanceWithoutCache($table); |
1254 | 1254 | }); |
1255 | 1255 | } |
@@ -1509,7 +1509,7 @@ discard block |
||
1509 | 1509 | $objects = $this->findObjects($mainTable, $filterString, $parameters, null, $additionalTablesFetch, self::MODE_ARRAY, $className); |
1510 | 1510 | $page = $objects->take(0, 2); |
1511 | 1511 | $count = $page->count(); |
1512 | - if ($count > 1) { |
|
1512 | + if ($count>1) { |
|
1513 | 1513 | 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."); |
1514 | 1514 | } elseif ($count === 0) { |
1515 | 1515 | return; |
@@ -1626,7 +1626,7 @@ discard block |
||
1626 | 1626 | $remoteTable = $remoteFk->getForeignTableName(); |
1627 | 1627 | |
1628 | 1628 | $primaryKeys = $this->getPrimaryKeyValues($bean); |
1629 | - $columnNames = array_map(function ($name) use ($pivotTableName) { return $pivotTableName.'.'.$name; }, $localFk->getLocalColumns()); |
|
1629 | + $columnNames = array_map(function($name) use ($pivotTableName) { return $pivotTableName.'.'.$name; }, $localFk->getLocalColumns()); |
|
1630 | 1630 | |
1631 | 1631 | $filter = array_combine($columnNames, $primaryKeys); |
1632 | 1632 | |
@@ -1647,7 +1647,7 @@ discard block |
||
1647 | 1647 | $table1 = $fks[0]->getForeignTableName(); |
1648 | 1648 | $table2 = $fks[1]->getForeignTableName(); |
1649 | 1649 | |
1650 | - $beanTables = array_map(function (DbRow $dbRow) { return $dbRow->_getDbTableName(); }, $bean->_getDbRows()); |
|
1650 | + $beanTables = array_map(function(DbRow $dbRow) { return $dbRow->_getDbTableName(); }, $bean->_getDbRows()); |
|
1651 | 1651 | |
1652 | 1652 | if (in_array($table1, $beanTables)) { |
1653 | 1653 | return [$fks[0], $fks[1]]; |
@@ -43,7 +43,6 @@ discard block |
||
43 | 43 | /** |
44 | 44 | * Constructor. |
45 | 45 | * |
46 | - * @param Connection $dbConnection The connection to the database. |
|
47 | 46 | */ |
48 | 47 | public function __construct(SchemaAnalyzer $schemaAnalyzer, Schema $schema, TDBMSchemaAnalyzer $tdbmSchemaAnalyzer) |
49 | 48 | { |
@@ -100,6 +99,9 @@ discard block |
||
100 | 99 | * Generates in one method call the daos and the beans for one table. |
101 | 100 | * |
102 | 101 | * @param $tableName |
102 | + * @param string $daonamespace |
|
103 | + * @param string $beannamespace |
|
104 | + * @param boolean $storeInUtc |
|
103 | 105 | */ |
104 | 106 | public function generateDaoAndBean(Table $table, $daonamespace, $beannamespace, ClassNameMapper $classNameMapper, $storeInUtc) |
105 | 107 | { |
@@ -140,7 +142,7 @@ discard block |
||
140 | 142 | /** |
141 | 143 | * Returns the name of the base bean class from the table name. |
142 | 144 | * |
143 | - * @param $tableName |
|
145 | + * @param string $tableName |
|
144 | 146 | * |
145 | 147 | * @return string |
146 | 148 | */ |
@@ -152,7 +154,7 @@ discard block |
||
152 | 154 | /** |
153 | 155 | * Returns the name of the base DAO class from the table name. |
154 | 156 | * |
155 | - * @param $tableName |
|
157 | + * @param string $tableName |
|
156 | 158 | * |
157 | 159 | * @return string |
158 | 160 | */ |
@@ -223,9 +225,10 @@ discard block |
||
223 | 225 | /** |
224 | 226 | * Writes the PHP bean DAO with simple functions to create/get/save objects. |
225 | 227 | * |
226 | - * @param string $fileName The file that will be written (without the directory) |
|
227 | 228 | * @param string $className The name of the class |
228 | - * @param string $tableName The name of the table |
|
229 | + * @param string $table The name of the table |
|
230 | + * @param string $baseClassName |
|
231 | + * @param string $beanClassName |
|
229 | 232 | */ |
230 | 233 | public function generateDao($className, $baseClassName, $beanClassName, Table $table, $daonamespace, $beannamespace, ClassNameMapper $classNameMapper) |
231 | 234 | { |
@@ -468,6 +471,8 @@ discard block |
||
468 | 471 | * Generates the factory bean. |
469 | 472 | * |
470 | 473 | * @param Table[] $tableList |
474 | + * @param string $daoFactoryClassName |
|
475 | + * @param string $daoNamespace |
|
471 | 476 | */ |
472 | 477 | private function generateFactory(array $tableList, $daoFactoryClassName, $daoNamespace, ClassNameMapper $classNameMapper) |
473 | 478 | { |
@@ -76,11 +76,11 @@ discard block |
||
76 | 76 | |
77 | 77 | // Remove all beans and daos from junction tables |
78 | 78 | $junctionTables = $this->schemaAnalyzer->detectJunctionTables(); |
79 | - $junctionTableNames = array_map(function (Table $table) { |
|
79 | + $junctionTableNames = array_map(function(Table $table) { |
|
80 | 80 | return $table->getName(); |
81 | 81 | }, $junctionTables); |
82 | 82 | |
83 | - $tableList = array_filter($tableList, function (Table $table) use ($junctionTableNames) { |
|
83 | + $tableList = array_filter($tableList, function(Table $table) use ($junctionTableNames) { |
|
84 | 84 | return !in_array($table->getName(), $junctionTableNames); |
85 | 85 | }); |
86 | 86 | |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | // Ok, let's return the list of all tables. |
94 | 94 | // These will be used by the calling script to create Mouf instances. |
95 | 95 | |
96 | - return array_map(function (Table $table) { return $table->getName(); }, $tableList); |
|
96 | + return array_map(function(Table $table) { return $table->getName(); }, $tableList); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | /** |
@@ -558,7 +558,7 @@ discard block |
||
558 | 558 | $pos = strpos($str, ' '); |
559 | 559 | } |
560 | 560 | $before = substr($str, 0, $pos); |
561 | - $after = substr($str, $pos + 1); |
|
561 | + $after = substr($str, $pos+1); |
|
562 | 562 | $str = $before.strtoupper(substr($after, 0, 1)).substr($after, 1); |
563 | 563 | } |
564 | 564 |
@@ -126,14 +126,14 @@ |
||
126 | 126 | if (strpos($daonamespace, '\\') === 0) { |
127 | 127 | $daonamespace = substr($daonamespace, 1); |
128 | 128 | } |
129 | - if (strpos($daonamespace, '\\') === strlen($daonamespace) - 1) { |
|
130 | - $daonamespace = substr($daonamespace, 0, strlen($daonamespace) - 1); |
|
129 | + if (strpos($daonamespace, '\\') === strlen($daonamespace)-1) { |
|
130 | + $daonamespace = substr($daonamespace, 0, strlen($daonamespace)-1); |
|
131 | 131 | } |
132 | 132 | if (strpos($beannamespace, '\\') === 0) { |
133 | 133 | $beannamespace = substr($beannamespace, 1); |
134 | 134 | } |
135 | - if (strpos($beannamespace, '\\') === strlen($beannamespace) - 1) { |
|
136 | - $beannamespace = substr($beannamespace, 0, strlen($beannamespace) - 1); |
|
135 | + if (strpos($beannamespace, '\\') === strlen($beannamespace)-1) { |
|
136 | + $beannamespace = substr($beannamespace, 0, strlen($beannamespace)-1); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | $tdbmService = new InstanceProxy($name); |
@@ -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 = []; |