Completed
Push — php-cs-fixer ( b6f93e...b9836a )
by Fabio
07:15
created
framework/Data/Common/Oracle/TOracleTableInfo.php 2 patches
Doc Comments   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 
49 49
 	/**
50 50
 	 * @param TDbConnection database connection.
51
-	 * @return TDbCommandBuilder new command builder
51
+	 * @return TOracleCommandBuilder new command builder
52 52
 	 */
53 53
 	public function createCommandBuilder($connection)
54 54
 	{
@@ -58,6 +58,8 @@  discard block
 block discarded – undo
58 58
 	/**
59 59
 	 * @param string information array key name
60 60
 	 * @param mixed default value if information array value is null
61
+	 * @param string $name
62
+	 * @param boolean $default
61 63
 	 * @return mixed information array value.
62 64
 	 */
63 65
 	public function getInfo($name, $default = null)
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
  */
26 26
 class TOracleTableInfo extends \Prado\TComponent
27 27
 {
28
-	private $_info = [];
28
+	private $_info=[];
29 29
 
30 30
 	private $_primaryKeys;
31 31
 	private $_foreignKeys;
@@ -38,12 +38,12 @@  discard block
 block discarded – undo
38 38
 	 * Sets the database table meta data information.
39 39
 	 * @param array table column information.
40 40
 	 */
41
-	public function __construct($tableInfo = [], $primary = [], $foreign = [])
41
+	public function __construct($tableInfo=[], $primary=[], $foreign=[])
42 42
 	{
43
-		$this->_info = $tableInfo;
44
-		$this->_primaryKeys = $primary;
45
-		$this->_foreignKeys = $foreign;
46
-		$this->_columns = new TMap;
43
+		$this->_info=$tableInfo;
44
+		$this->_primaryKeys=$primary;
45
+		$this->_foreignKeys=$foreign;
46
+		$this->_columns=new TMap;
47 47
 	}
48 48
 
49 49
 	/**
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 	 * @param mixed default value if information array value is null
61 61
 	 * @return mixed information array value.
62 62
 	 */
63
-	public function getInfo($name, $default = null)
63
+	public function getInfo($name, $default=null)
64 64
 	{
65 65
 		return isset($this->_info[$name]) ? $this->_info[$name] : $default;
66 66
 	}
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 	 */
72 72
 	protected function setInfo($name, $value)
73 73
 	{
74
-		$this->_info[$name] = $value;
74
+		$this->_info[$name]=$value;
75 75
 	}
76 76
 
77 77
 	/**
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 	 */
88 88
 	public function getTableFullName()
89 89
 	{
90
-		return $this->_info['SchemaName'] . '.' . $this->getTableName();
90
+		return $this->_info['SchemaName'].'.'.$this->getTableName();
91 91
 	}
92 92
 
93 93
 	/**
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 	 */
113 113
 	public function getColumn($name)
114 114
 	{
115
-		if(($column = $this->_columns->itemAt($name)) !== null)
115
+		if(($column=$this->_columns->itemAt($name))!==null)
116 116
 			return $column;
117 117
 		throw new TDbException('dbtableinfo_invalid_column_name', $name, $this->getTableFullName());
118 118
 	}
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 	public function getColumnNames()
125 125
 	{
126 126
 		foreach($this->getColumns() as $column)
127
-			$names[] = $column->getColumnName();
127
+			$names[]=$column->getColumnName();
128 128
 		return $names;
129 129
 	}
130 130
 
@@ -149,11 +149,11 @@  discard block
 block discarded – undo
149 149
 	 */
150 150
 	public function getLowerCaseColumnNames()
151 151
 	{
152
-		if($this->_lowercase === null)
152
+		if($this->_lowercase===null)
153 153
 		{
154
-			$this->_lowercase = [];
154
+			$this->_lowercase=[];
155 155
 			foreach($this->getColumns()->getKeys() as $key)
156
-				$this->_lowercase[strtolower($key)] = $key;
156
+				$this->_lowercase[strtolower($key)]=$key;
157 157
 		}
158 158
 		return $this->_lowercase;
159 159
 	}
Please login to merge, or discard this patch.
framework/Data/Common/TDbTableColumn.php 2 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -38,6 +38,7 @@
 block discarded – undo
38 38
 	/**
39 39
 	 * @param string information array key name
40 40
 	 * @param mixed default value if information array value is null
41
+	 * @param string $name
41 42
 	 * @return mixed information array value.
42 43
 	 */
43 44
 	protected function getInfo($name, $default = null)
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -22,9 +22,9 @@  discard block
 block discarded – undo
22 22
  */
23 23
 class TDbTableColumn extends \Prado\TComponent
24 24
 {
25
-	const UNDEFINED_VALUE = INF; //use infinity for undefined value
25
+	const UNDEFINED_VALUE=INF; //use infinity for undefined value
26 26
 
27
-	private $_info = [];
27
+	private $_info=[];
28 28
 
29 29
 	/**
30 30
 	 * Sets the table column meta data.
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	 */
33 33
 	public function __construct($columnInfo)
34 34
 	{
35
-		$this->_info = $columnInfo;
35
+		$this->_info=$columnInfo;
36 36
 	}
37 37
 
38 38
 	/**
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 	 * @param mixed default value if information array value is null
41 41
 	 * @return mixed information array value.
42 42
 	 */
43
-	protected function getInfo($name, $default = null)
43
+	protected function getInfo($name, $default=null)
44 44
 	{
45 45
 		return isset($this->_info[$name]) ? $this->_info[$name] : $default;
46 46
 	}
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 	 */
52 52
 	protected function setInfo($name, $value)
53 53
 	{
54
-		$this->_info[$name] = $value;
54
+		$this->_info[$name]=$value;
55 55
 	}
56 56
 
57 57
 	/**
@@ -151,10 +151,10 @@  discard block
 block discarded – undo
151 151
 
152 152
 	public function getMaxiumNumericConstraint()
153 153
 	{
154
-		if(($precision = $this->getNumericPrecision()) !== null)
154
+		if(($precision=$this->getNumericPrecision())!==null)
155 155
 		{
156
-			$scale = $this->getNumericScale();
157
-			return $scale === null ? pow(10, $precision) : pow(10, $precision - $scale);
156
+			$scale=$this->getNumericScale();
157
+			return $scale===null ? pow(10, $precision) : pow(10, $precision - $scale);
158 158
 		}
159 159
 	}
160 160
 
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 	 */
188 188
 	public function hasSequence()
189 189
 	{
190
-		return $this->getSequenceName() !== null;
190
+		return $this->getSequenceName()!==null;
191 191
 	}
192 192
 
193 193
 	/**
Please login to merge, or discard this patch.
framework/Data/Common/TDbTableInfo.php 2 patches
Doc Comments   +2 added lines patch added patch discarded remove patch
@@ -63,6 +63,8 @@
 block discarded – undo
63 63
 	/**
64 64
 	 * @param string information array key name
65 65
 	 * @param mixed default value if information array value is null
66
+	 * @param string $name
67
+	 * @param boolean $default
66 68
 	 * @return mixed information array value.
67 69
 	 */
68 70
 	protected function getInfo($name, $default = null)
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
  */
25 25
 class TDbTableInfo extends \Prado\TComponent
26 26
 {
27
-	private $_info = [];
27
+	private $_info=[];
28 28
 
29 29
 	private $_primaryKeys;
30 30
 	private $_foreignKeys;
@@ -43,12 +43,12 @@  discard block
 block discarded – undo
43 43
 	 * Sets the database table meta data information.
44 44
 	 * @param array table column information.
45 45
 	 */
46
-	public function __construct($tableInfo = [], $primary = [], $foreign = [])
46
+	public function __construct($tableInfo=[], $primary=[], $foreign=[])
47 47
 	{
48
-		$this->_info = $tableInfo;
49
-		$this->_primaryKeys = $primary;
50
-		$this->_foreignKeys = $foreign;
51
-		$this->_columns = new TMap;
48
+		$this->_info=$tableInfo;
49
+		$this->_primaryKeys=$primary;
50
+		$this->_foreignKeys=$foreign;
51
+		$this->_columns=new TMap;
52 52
 	}
53 53
 
54 54
 	/**
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 	 * @param mixed default value if information array value is null
66 66
 	 * @return mixed information array value.
67 67
 	 */
68
-	protected function getInfo($name, $default = null)
68
+	protected function getInfo($name, $default=null)
69 69
 	{
70 70
 		return isset($this->_info[$name]) ? $this->_info[$name] : $default;
71 71
 	}
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 	 */
77 77
 	protected function setInfo($name, $value)
78 78
 	{
79
-		$this->_info[$name] = $value;
79
+		$this->_info[$name]=$value;
80 80
 	}
81 81
 
82 82
 	/**
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 	 */
118 118
 	public function getColumn($name)
119 119
 	{
120
-		if(($column = $this->_columns->itemAt($name)) !== null)
120
+		if(($column=$this->_columns->itemAt($name))!==null)
121 121
 			return $column;
122 122
 		throw new TDbException('dbtableinfo_invalid_column_name', $name, $this->getTableFullName());
123 123
 	}
@@ -128,11 +128,11 @@  discard block
 block discarded – undo
128 128
 	 */
129 129
 	public function getColumnNames()
130 130
 	{
131
-		if($this->_names === null)
131
+		if($this->_names===null)
132 132
 		{
133
-			$this->_names = [];
133
+			$this->_names=[];
134 134
 			foreach($this->getColumns() as $column)
135
-				$this->_names[] = $column->getColumnName();
135
+				$this->_names[]=$column->getColumnName();
136 136
 		}
137 137
 		return $this->_names;
138 138
 	}
@@ -158,11 +158,11 @@  discard block
 block discarded – undo
158 158
 	 */
159 159
 	public function getLowerCaseColumnNames()
160 160
 	{
161
-		if($this->_lowercase === null)
161
+		if($this->_lowercase===null)
162 162
 		{
163
-			$this->_lowercase = [];
163
+			$this->_lowercase=[];
164 164
 			foreach($this->getColumns()->getKeys() as $key)
165
-				$this->_lowercase[strtolower($key)] = $key;
165
+				$this->_lowercase[strtolower($key)]=$key;
166 166
 		}
167 167
 		return $this->_lowercase;
168 168
 	}
Please login to merge, or discard this patch.
framework/Data/DataGateway/TTableGateway.php 2 patches
Doc Comments   +5 added lines patch added patch discarded remove patch
@@ -103,6 +103,7 @@  discard block
 block discarded – undo
103 103
 
104 104
 	/**
105 105
 	 * @param TDbTableInfo table or view information.
106
+	 * @param TDbTableInfo $tableInfo
106 107
 	 */
107 108
 	protected function setTableInfo($tableInfo)
108 109
 	{
@@ -113,6 +114,7 @@  discard block
 block discarded – undo
113 114
 	/**
114 115
 	 * Sets up the command builder for the given table.
115 116
 	 * @param string table or view name.
117
+	 * @param string $tableName
116 118
 	 */
117 119
 	protected function setTableName($tableName)
118 120
 	{
@@ -224,6 +226,7 @@  discard block
 block discarded – undo
224 226
 	 *
225 227
 	 * @param string|TSqlCriteria SQL condition or criteria object.
226 228
 	 * @param mixed parameter values.
229
+	 * @param TSqlCriteria $criteria
227 230
 	 * @return array matching record object.
228 231
 	 */
229 232
 	public function find($criteria, $parameters = [])
@@ -237,6 +240,7 @@  discard block
 block discarded – undo
237 240
 	 * Accepts same parameters as find(), but returns TDbDataReader instead.
238 241
 	 * @param string|TSqlCriteria SQL condition or criteria object.
239 242
 	 * @param mixed parameter values.
243
+	 * @param TSqlCriteria $criteria
240 244
 	 * @return TDbDataReader matching records.
241 245
 	 */
242 246
 	public function findAll($criteria = null, $parameters = [])
@@ -299,6 +303,7 @@  discard block
 block discarded – undo
299 303
 	 * </code>
300 304
 	 * @param string delete condition.
301 305
 	 * @param array condition parameters.
306
+	 * @param TSqlCriteria $criteria
302 307
 	 * @return integer number of records deleted.
303 308
 	 */
304 309
 	public function deleteAll($criteria, $parameters = [])
Please login to merge, or discard this patch.
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 	 */
93 93
 	public function __construct($table, $connection)
94 94
 	{
95
-		$this->_connection = $connection;
95
+		$this->_connection=$connection;
96 96
 		if(is_string($table))
97 97
 			$this->setTableName($table);
98 98
 		elseif($table instanceof TDbTableInfo)
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 	 */
107 107
 	protected function setTableInfo($tableInfo)
108 108
 	{
109
-		$builder = $tableInfo->createCommandBuilder($this->getDbConnection());
109
+		$builder=$tableInfo->createCommandBuilder($this->getDbConnection());
110 110
 		$this->initCommandBuilder($builder);
111 111
 	}
112 112
 
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 	 */
117 117
 	protected function setTableName($tableName)
118 118
 	{
119
-		$meta = TDbMetaData::getInstance($this->getDbConnection());
119
+		$meta=TDbMetaData::getInstance($this->getDbConnection());
120 120
 		$this->initCommandBuilder($meta->createCommandBuilder($tableName));
121 121
 	}
122 122
 
@@ -135,9 +135,9 @@  discard block
 block discarded – undo
135 135
 	 */
136 136
 	protected function initCommandBuilder($builder)
137 137
 	{
138
-		$this->_command = new TDataGatewayCommand($builder);
139
-		$this->_command->OnCreateCommand[] = [$this, 'onCreateCommand'];
140
-		$this->_command->OnExecuteCommand[] = [$this, 'onExecuteCommand'];
138
+		$this->_command=new TDataGatewayCommand($builder);
139
+		$this->_command->OnCreateCommand[]=[$this, 'onCreateCommand'];
140
+		$this->_command->OnExecuteCommand[]=[$this, 'onExecuteCommand'];
141 141
 	}
142 142
 
143 143
 	/**
@@ -189,10 +189,10 @@  discard block
 block discarded – undo
189 189
 	 * @param array binding parameters, positional or named.
190 190
 	 * @return array query results.
191 191
 	 */
192
-	public function findBySql($sql, $parameters = [])
192
+	public function findBySql($sql, $parameters=[])
193 193
 	{
194
-		$args = func_num_args() > 1 ? array_slice(func_get_args(), 1) : null;
195
-		$criteria = $this->getCriteria($sql, $parameters, $args);
194
+		$args=func_num_args() > 1 ? array_slice(func_get_args(), 1) : null;
195
+		$criteria=$this->getCriteria($sql, $parameters, $args);
196 196
 		return $this->getCommand()->findBySql($criteria);
197 197
 	}
198 198
 
@@ -202,10 +202,10 @@  discard block
 block discarded – undo
202 202
 	 * @param array binding parameters, positional or named.
203 203
 	 * @return TDbDataReader query results.
204 204
 	 */
205
-	public function findAllBySql($sql, $parameters = [])
205
+	public function findAllBySql($sql, $parameters=[])
206 206
 	{
207
-		$args = func_num_args() > 1 ? array_slice(func_get_args(), 1) : null;
208
-		$criteria = $this->getCriteria($sql, $parameters, $args);
207
+		$args=func_num_args() > 1 ? array_slice(func_get_args(), 1) : null;
208
+		$criteria=$this->getCriteria($sql, $parameters, $args);
209 209
 		return $this->getCommand()->findAllBySql($criteria);
210 210
 	}
211 211
 
@@ -226,10 +226,10 @@  discard block
 block discarded – undo
226 226
 	 * @param mixed parameter values.
227 227
 	 * @return array matching record object.
228 228
 	 */
229
-	public function find($criteria, $parameters = [])
229
+	public function find($criteria, $parameters=[])
230 230
 	{
231
-		$args = func_num_args() > 1 ? array_slice(func_get_args(), 1) : null;
232
-		$criteria = $this->getCriteria($criteria, $parameters, $args);
231
+		$args=func_num_args() > 1 ? array_slice(func_get_args(), 1) : null;
232
+		$criteria=$this->getCriteria($criteria, $parameters, $args);
233 233
 		return $this->getCommand()->find($criteria);
234 234
 	}
235 235
 
@@ -239,11 +239,11 @@  discard block
 block discarded – undo
239 239
 	 * @param mixed parameter values.
240 240
 	 * @return TDbDataReader matching records.
241 241
 	 */
242
-	public function findAll($criteria = null, $parameters = [])
242
+	public function findAll($criteria=null, $parameters=[])
243 243
 	{
244
-		$args = func_num_args() > 1 ? array_slice(func_get_args(), 1) : null;
245
-		if($criteria !== null)
246
-			$criteria = $this->getCriteria($criteria, $parameters, $args);
244
+		$args=func_num_args() > 1 ? array_slice(func_get_args(), 1) : null;
245
+		if($criteria!==null)
246
+			$criteria=$this->getCriteria($criteria, $parameters, $args);
247 247
 		return $this->getCommand()->findAll($criteria);
248 248
 	}
249 249
 
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
 	public function findByPk($keys)
263 263
 	{
264 264
 		if(func_num_args() > 1)
265
-			$keys = func_get_args();
265
+			$keys=func_get_args();
266 266
 		return $this->getCommand()->findByPk($keys);
267 267
 	}
268 268
 
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 	public function findAllByPks($keys)
287 287
 	{
288 288
 		if(func_num_args() > 1)
289
-			$keys = func_get_args();
289
+			$keys=func_get_args();
290 290
 		return $this->getCommand()->findAllByPk($keys);
291 291
 	}
292 292
 
@@ -301,10 +301,10 @@  discard block
 block discarded – undo
301 301
 	 * @param array condition parameters.
302 302
 	 * @return integer number of records deleted.
303 303
 	 */
304
-	public function deleteAll($criteria, $parameters = [])
304
+	public function deleteAll($criteria, $parameters=[])
305 305
 	{
306
-		$args = func_num_args() > 1 ? array_slice(func_get_args(), 1) : null;
307
-		$criteria = $this->getCriteria($criteria, $parameters, $args);
306
+		$args=func_num_args() > 1 ? array_slice(func_get_args(), 1) : null;
307
+		$criteria=$this->getCriteria($criteria, $parameters, $args);
308 308
 		return $this->getCommand()->delete($criteria);
309 309
 	}
310 310
 
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
 	public function deleteByPk($keys)
335 335
 	{
336 336
 		if(func_num_args() > 1)
337
-			$keys = func_get_args();
337
+			$keys=func_get_args();
338 338
 		return $this->getCommand()->deleteByPk($keys);
339 339
 	}
340 340
 
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
 	public function deleteAllByPks($keys)
345 345
 	{
346 346
 		if(func_num_args() > 1)
347
-			$keys = func_get_args();
347
+			$keys=func_get_args();
348 348
 		return $this->deleteByPk($keys);
349 349
 	}
350 350
 
@@ -354,11 +354,11 @@  discard block
 block discarded – undo
354 354
 	 * @param mixed parameter values.
355 355
 	 * @return int number of records.
356 356
 	 */
357
-	public function count($criteria = null, $parameters = [])
357
+	public function count($criteria=null, $parameters=[])
358 358
 	{
359
-		$args = func_num_args() > 1 ? array_slice(func_get_args(), 1) : null;
360
-		if($criteria !== null)
361
-			$criteria = $this->getCriteria($criteria, $parameters, $args);
359
+		$args=func_num_args() > 1 ? array_slice(func_get_args(), 1) : null;
360
+		if($criteria!==null)
361
+			$criteria=$this->getCriteria($criteria, $parameters, $args);
362 362
 		return $this->getCommand()->count($criteria);
363 363
 	}
364 364
 
@@ -376,10 +376,10 @@  discard block
 block discarded – undo
376 376
 	 * @param array additional binding name-value pairs.
377 377
 	 * @return integer number of records updated.
378 378
 	 */
379
-	public function update($data, $criteria, $parameters = [])
379
+	public function update($data, $criteria, $parameters=[])
380 380
 	{
381
-		$args = func_num_args() > 2 ? array_slice(func_get_args(), 2) : null;
382
-		$criteria = $this->getCriteria($criteria, $parameters, $args);
381
+		$args=func_num_args() > 2 ? array_slice(func_get_args(), 2) : null;
382
+		$criteria=$this->getCriteria($criteria, $parameters, $args);
383 383
 		return $this->getCommand()->update($data, $criteria);
384 384
 	}
385 385
 
@@ -416,7 +416,7 @@  discard block
 block discarded – undo
416 416
 	{
417 417
 		if(is_string($criteria))
418 418
 		{
419
-			$useArgs = !is_array($parameters) && is_array($args);
419
+			$useArgs=!is_array($parameters) && is_array($args);
420 420
 			return new TSqlCriteria($criteria, $useArgs ? $args : $parameters);
421 421
 		}
422 422
 		elseif($criteria instanceof TSqlCriteria)
@@ -456,19 +456,19 @@  discard block
 block discarded – undo
456 456
 	 */
457 457
 	public function __call($method, $args)
458 458
 	{
459
-		$delete = false;
460
-		if($findOne = substr(strtolower($method), 0, 6) === 'findby')
461
-			$condition = $method[6] === '_' ? substr($method, 7) : substr($method, 6);
462
-		elseif(substr(strtolower($method), 0, 9) === 'findallby')
463
-			$condition = $method[9] === '_' ? substr($method, 10) : substr($method, 9);
464
-		elseif($delete = substr(strtolower($method), 0, 8) === 'deleteby')
465
-			$condition = $method[8] === '_' ? substr($method, 9) : substr($method, 8);
466
-		elseif($delete = substr(strtolower($method), 0, 11) === 'deleteallby')
467
-			$condition = $method[11] === '_' ? substr($method, 12) : substr($method, 11);
459
+		$delete=false;
460
+		if($findOne=substr(strtolower($method), 0, 6)==='findby')
461
+			$condition=$method[6]==='_' ? substr($method, 7) : substr($method, 6);
462
+		elseif(substr(strtolower($method), 0, 9)==='findallby')
463
+			$condition=$method[9]==='_' ? substr($method, 10) : substr($method, 9);
464
+		elseif($delete=substr(strtolower($method), 0, 8)==='deleteby')
465
+			$condition=$method[8]==='_' ? substr($method, 9) : substr($method, 8);
466
+		elseif($delete=substr(strtolower($method), 0, 11)==='deleteallby')
467
+			$condition=$method[11]==='_' ? substr($method, 12) : substr($method, 11);
468 468
 		else
469 469
 			return null;
470 470
 
471
-		$criteria = $this->getCommand()->createCriteriaFromString($method, $condition, $args);
471
+		$criteria=$this->getCommand()->createCriteriaFromString($method, $condition, $args);
472 472
 		if($delete)
473 473
 			return $this->deleteAll($criteria);
474 474
 		else
Please login to merge, or discard this patch.
framework/Data/SqlMap/Configuration/TSqlMapStatement.php 2 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -270,6 +270,7 @@
 block discarded – undo
270 270
 	 * @param TSqlMapTypeHandlerRegistry type handler registry
271 271
 	 * @param string result class name.
272 272
 	 * @param array result data.
273
+	 * @param string $type
273 274
 	 * @return mixed result object.
274 275
 	 */
275 276
 	protected function createInstanceOf($registry, $type, $row = null)
Please login to merge, or discard this patch.
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 	 */
58 58
 	public function setID($value)
59 59
 	{
60
-		$this->_ID = $value;
60
+		$this->_ID=$value;
61 61
 	}
62 62
 
63 63
 	/**
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 	 */
76 76
 	public function setParameterMap($value)
77 77
 	{
78
-		$this->_parameterMapName = $value;
78
+		$this->_parameterMapName=$value;
79 79
 	}
80 80
 
81 81
 	/**
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 	 */
95 95
 	public function setParameterClass($value)
96 96
 	{
97
-		$this->_parameterClassName = $value;
97
+		$this->_parameterClassName=$value;
98 98
 	}
99 99
 
100 100
 	/**
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 	 */
113 113
 	public function setResultMap($value)
114 114
 	{
115
-		$this->_resultMapName = $value;
115
+		$this->_resultMapName=$value;
116 116
 	}
117 117
 
118 118
 	/**
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 	 */
134 134
 	public function setResultClass($value)
135 135
 	{
136
-		$this->_resultClassName = $value;
136
+		$this->_resultClassName=$value;
137 137
 	}
138 138
 
139 139
 	/**
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 	 */
150 150
 	public function setCacheModel($value)
151 151
 	{
152
-		$this->_cacheModelName = $value;
152
+		$this->_cacheModelName=$value;
153 153
 	}
154 154
 
155 155
 	/**
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 	 */
166 166
 	public function setCache($value)
167 167
 	{
168
-		$this->_cache = $value;
168
+		$this->_cache=$value;
169 169
 	}
170 170
 
171 171
 	/**
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 	 */
182 182
 	public function setSqlText($value)
183 183
 	{
184
-		$this->_SQL = $value;
184
+		$this->_SQL=$value;
185 185
 	}
186 186
 
187 187
 	/**
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 	 */
199 199
 	public function setListClass($value)
200 200
 	{
201
-		$this->_listClass = $value;
201
+		$this->_listClass=$value;
202 202
 	}
203 203
 
204 204
 	/**
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 	 */
215 215
 	public function setExtends($value)
216 216
 	{
217
-		$this->_extendStatement = $value;
217
+		$this->_extendStatement=$value;
218 218
 	}
219 219
 
220 220
 	/**
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 	 */
241 241
 	public function setInlineParameterMap($map)
242 242
 	{
243
-		$this->_parameterMap = $map;
243
+		$this->_parameterMap=$map;
244 244
 	}
245 245
 
246 246
 	/**
@@ -249,9 +249,9 @@  discard block
 block discarded – undo
249 249
 	public function initialize($manager)
250 250
 	{
251 251
 		if(strlen($this->_resultMapName) > 0)
252
-			$this->_resultMap = $manager->getResultMap($this->_resultMapName);
252
+			$this->_resultMap=$manager->getResultMap($this->_resultMapName);
253 253
 		if(strlen($this->_parameterMapName) > 0)
254
-			$this->_parameterMap = $manager->getParameterMap($this->_parameterMapName);
254
+			$this->_parameterMap=$manager->getParameterMap($this->_parameterMapName);
255 255
 	}
256 256
 
257 257
 	/**
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
 	 */
261 261
 	public function createInstanceOfListClass($registry)
262 262
 	{
263
-		if(strlen($type = $this->getListClass()) > 0)
263
+		if(strlen($type=$this->getListClass()) > 0)
264 264
 			return $this->createInstanceOf($registry, $type);
265 265
 		return [];
266 266
 	}
@@ -272,10 +272,10 @@  discard block
 block discarded – undo
272 272
 	 * @param array result data.
273 273
 	 * @return mixed result object.
274 274
 	 */
275
-	protected function createInstanceOf($registry, $type, $row = null)
275
+	protected function createInstanceOf($registry, $type, $row=null)
276 276
 	{
277
-		$handler = $registry->getTypeHandler($type);
278
-		if($handler !== null)
277
+		$handler=$registry->getTypeHandler($type);
278
+		if($handler!==null)
279 279
 			return $handler->createNewInstance($row);
280 280
 		else
281 281
 			return $registry->createInstanceOf($type);
@@ -289,26 +289,26 @@  discard block
 block discarded – undo
289 289
 	 */
290 290
 	public function createInstanceOfResultClass($registry, $row)
291 291
 	{
292
-		if(strlen($type = $this->getResultClass()) > 0)
292
+		if(strlen($type=$this->getResultClass()) > 0)
293 293
 			return $this->createInstanceOf($registry, $type, $row);
294 294
 	}
295 295
 
296 296
 	public function __sleep()
297 297
 	{
298
-		$cn = __CLASS__;
299
-		$exprops = ["\0$cn\0_resultMap"];
300
-		if (!$this->_parameterMapName) $exprops[] = "\0$cn\0_parameterMapName";
301
-		if (!$this->_parameterMap) $exprops[] = "\0$cn\0_parameterMap";
302
-		if (!$this->_parameterClassName) $exprops[] = "\0$cn\0_parameterClassName";
303
-		if (!$this->_resultMapName) $exprops[] = "\0$cn\0_resultMapName";
304
-		if (!$this->_resultMap) $exprops[] = "\0$cn\0_resultMap";
305
-		if (!$this->_resultClassName) $exprops[] = "\0$cn\0_resultClassName";
306
-		if (!$this->_cacheModelName) $exprops[] = "\0$cn\0_cacheModelName";
307
-		if (!$this->_SQL) $exprops[] = "\0$cn\0_SQL";
308
-		if (!$this->_listClass) $exprops[] = "\0$cn\0_listClass";
309
-		if (!$this->_typeHandler) $exprops[] = "\0$cn\0_typeHandler";
310
-		if (!$this->_extendStatement) $exprops[] = "\0$cn\0_extendStatement";
311
-		if (!$this->_cache) $exprops[] = "\0$cn\0_cache";
298
+		$cn=__CLASS__;
299
+		$exprops=["\0$cn\0_resultMap"];
300
+		if(!$this->_parameterMapName) $exprops[]="\0$cn\0_parameterMapName";
301
+		if(!$this->_parameterMap) $exprops[]="\0$cn\0_parameterMap";
302
+		if(!$this->_parameterClassName) $exprops[]="\0$cn\0_parameterClassName";
303
+		if(!$this->_resultMapName) $exprops[]="\0$cn\0_resultMapName";
304
+		if(!$this->_resultMap) $exprops[]="\0$cn\0_resultMap";
305
+		if(!$this->_resultClassName) $exprops[]="\0$cn\0_resultClassName";
306
+		if(!$this->_cacheModelName) $exprops[]="\0$cn\0_cacheModelName";
307
+		if(!$this->_SQL) $exprops[]="\0$cn\0_SQL";
308
+		if(!$this->_listClass) $exprops[]="\0$cn\0_listClass";
309
+		if(!$this->_typeHandler) $exprops[]="\0$cn\0_typeHandler";
310
+		if(!$this->_extendStatement) $exprops[]="\0$cn\0_extendStatement";
311
+		if(!$this->_cache) $exprops[]="\0$cn\0_cache";
312 312
 
313 313
 		return array_diff(parent::__sleep(), $exprops);
314 314
 	}
Please login to merge, or discard this patch.
framework/Data/SqlMap/Configuration/TSqlMapXmlConfigBuilder.php 2 patches
Doc Comments   +7 added lines, -3 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 	 * Create an instance of an object give by the attribute named 'class' in the
28 28
 	 * node and set the properties on the object given by attribute names and values.
29 29
 	 * @param SimpleXmlNode property node
30
-	 * @return Object new instance of class with class name given by 'class' attribute value.
30
+	 * @return \Prado\TComponent new instance of class with class name given by 'class' attribute value.
31 31
 	 */
32 32
 	protected function createObjectFromNode($node)
33 33
 	{
@@ -47,6 +47,7 @@  discard block
 block discarded – undo
47 47
 	 * @param Object object instance
48 48
 	 * @param SimpleXmlNode property node
49 49
 	 * @param array exception property name
50
+	 * @param \Prado\TComponent $obj
50 51
 	 */
51 52
 	protected function setObjectPropFromNode($obj, $node, $except = [])
52 53
 	{
@@ -67,6 +68,8 @@  discard block
 block discarded – undo
67 68
 	 * Gets the filename relative to the basefile.
68 69
 	 * @param string base filename
69 70
 	 * @param string relative filename
71
+	 * @param string $basefile
72
+	 * @param string $resource
70 73
 	 * @return string absolute filename.
71 74
 	 */
72 75
 	protected function getAbsoluteFilePath($basefile, $resource)
@@ -84,7 +87,7 @@  discard block
 block discarded – undo
84 87
 	/**
85 88
 	 * Load document using simple xml.
86 89
 	 * @param string filename.
87
-	 * @return SimpleXmlElement xml document.
90
+	 * @return \SimpleXMLElement xml document.
88 91
 	 */
89 92
 	protected function loadXmlDocument($filename, TSqlMapXmlConfiguration $config)
90 93
 	{
@@ -97,9 +100,10 @@  discard block
 block discarded – undo
97 100
 	}
98 101
 	/**
99 102
 	 * Get element node by ID value (try for attribute name ID as case insensitive).
100
-	 * @param SimpleXmlDocument $document
103
+	 * @param \SimpleXMLElement $document
101 104
 	 * @param string tag name.
102 105
 	 * @param string id value.
106
+	 * @param string $tag
103 107
 	 * @return SimpleXmlElement node if found, null otherwise.
104 108
 	 */
105 109
 	protected function getElementByIdValue($document, $tag, $value)
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 	{
34 34
 		if(isset($node['class']))
35 35
 		{
36
-			$obj = Prado::createComponent((string)$node['class']);
36
+			$obj=Prado::createComponent((string) $node['class']);
37 37
 			$this->setObjectPropFromNode($obj, $node, ['class']);
38 38
 			return $obj;
39 39
 		}
@@ -48,14 +48,14 @@  discard block
 block discarded – undo
48 48
 	 * @param SimpleXmlNode property node
49 49
 	 * @param array exception property name
50 50
 	 */
51
-	protected function setObjectPropFromNode($obj, $node, $except = [])
51
+	protected function setObjectPropFromNode($obj, $node, $except=[])
52 52
 	{
53 53
 		foreach($node->attributes() as $name => $value)
54 54
 		{
55 55
 			if(!in_array($name, $except))
56 56
 			{
57 57
 				if($obj->canSetProperty($name))
58
-					$obj->{$name} = (string)$value;
58
+					$obj->{$name}=(string) $value;
59 59
 				else
60 60
 					throw new TSqlMapConfigurationException(
61 61
 						'sqlmap_invalid_property', $name, get_class($obj),
@@ -71,10 +71,10 @@  discard block
 block discarded – undo
71 71
 	 */
72 72
 	protected function getAbsoluteFilePath($basefile, $resource)
73 73
 	{
74
-		$basedir = dirname($basefile);
75
-		$file = realpath($basedir . DIRECTORY_SEPARATOR . $resource);
74
+		$basedir=dirname($basefile);
75
+		$file=realpath($basedir.DIRECTORY_SEPARATOR.$resource);
76 76
 		if(!is_string($file) || !is_file($file))
77
-			$file = realpath($resource);
77
+			$file=realpath($resource);
78 78
 		if(is_string($file) && is_file($file))
79 79
 			return $file;
80 80
 		else
@@ -88,8 +88,8 @@  discard block
 block discarded – undo
88 88
 	 */
89 89
 	protected function loadXmlDocument($filename, TSqlMapXmlConfiguration $config)
90 90
 	{
91
-		if(strpos($filename, '${') !== false)
92
-			$filename = $config->replaceProperties($filename);
91
+		if(strpos($filename, '${')!==false)
92
+			$filename=$config->replaceProperties($filename);
93 93
 		if(!is_file($filename))
94 94
 			throw new TSqlMapConfigurationException(
95 95
 				'sqlmap_unable_to_find_config', $filename);
@@ -105,9 +105,9 @@  discard block
 block discarded – undo
105 105
 	protected function getElementByIdValue($document, $tag, $value)
106 106
 	{
107 107
 		//hack to allow upper case and lower case attribute names.
108
-		foreach(['id','ID','Id', 'iD'] as $id)
108
+		foreach(['id', 'ID', 'Id', 'iD'] as $id)
109 109
 		{
110
-			$xpath = "//{$tag}[@{$id}='{$value}']";
110
+			$xpath="//{$tag}[@{$id}='{$value}']";
111 111
 			foreach($document->xpath($xpath) as $node)
112 112
 				return $node;
113 113
 		}
Please login to merge, or discard this patch.
framework/Data/SqlMap/DataMapper/TSqlMapPagedList.php 3 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -46,6 +46,7 @@  discard block
 block discarded – undo
46 46
 	 * @param int page size
47 47
 	 * @param mixed delegate for each data row retrieved.
48 48
 	 * @param int number of page to fetch on initialization
49
+	 * @param integer $pageSize
49 50
 	 */
50 51
 	public function __construct(IMappedStatement $statement, $parameter, $pageSize, $delegate = null, $page = 0)
51 52
 	{
@@ -61,6 +62,8 @@  discard block
 block discarded – undo
61 62
 	 * @param mixed query parameters
62 63
 	 * @param int page size.
63 64
 	 * @param int number of page.
65
+	 * @param IMappedStatement $statement
66
+	 * @param integer $page
64 67
 	 */
65 68
 	protected function initialize($statement, $parameter, $pageSize, $page)
66 69
 	{
Please login to merge, or discard this patch.
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -47,12 +47,12 @@  discard block
 block discarded – undo
47 47
 	 * @param mixed delegate for each data row retrieved.
48 48
 	 * @param int number of page to fetch on initialization
49 49
 	 */
50
-	public function __construct(IMappedStatement $statement, $parameter, $pageSize, $delegate = null, $page = 0)
50
+	public function __construct(IMappedStatement $statement, $parameter, $pageSize, $delegate=null, $page=0)
51 51
 	{
52 52
 		parent::__construct();
53 53
 		parent::setCustomPaging(true);
54 54
 		$this->initialize($statement, $parameter, $pageSize, $page);
55
-		$this->_delegate = $delegate;
55
+		$this->_delegate=$delegate;
56 56
 	}
57 57
 
58 58
 	/**
@@ -64,8 +64,8 @@  discard block
 block discarded – undo
64 64
 	 */
65 65
 	protected function initialize($statement, $parameter, $pageSize, $page)
66 66
 	{
67
-		$this->_statement = $statement;
68
-		$this->_parameter = $parameter;
67
+		$this->_statement=$statement;
68
+		$this->_parameter=$parameter;
69 69
 		$this->setPageSize($pageSize);
70 70
 		$this->attachEventHandler('OnFetchData', [$this, 'fetchDataFromStatement']);
71 71
 		$this->gotoPage($page);
@@ -86,9 +86,9 @@  discard block
 block discarded – undo
86 86
 	 */
87 87
 	protected function fetchDataFromStatement($sender, $param)
88 88
 	{
89
-		$limit = $this->getOffsetAndLimit($param);
90
-		$connection = $this->_statement->getManager()->getDbConnection();
91
-		$data = $this->_statement->executeQueryForList($connection,
89
+		$limit=$this->getOffsetAndLimit($param);
90
+		$connection=$this->_statement->getManager()->getDbConnection();
91
+		$data=$this->_statement->executeQueryForList($connection,
92 92
 						$this->_parameter, null, $limit[0], $limit[1], $this->_delegate);
93 93
 		$this->populateData($param, $data);
94 94
 	}
@@ -118,49 +118,49 @@  discard block
 block discarded – undo
118 118
 	 */
119 119
 	protected function populateData($param, $data)
120 120
 	{
121
-		$total = $data instanceof TList ? $data->getCount() : count($data);
122
-		$pageSize = $this->getPageSize();
121
+		$total=$data instanceof TList ? $data->getCount() : count($data);
122
+		$pageSize=$this->getPageSize();
123 123
 		if($total < 1)
124 124
 		{
125 125
 			$param->setData($data);
126
-			$this->_prevPageList = null;
127
-			$this->_nextPageList = null;
126
+			$this->_prevPageList=null;
127
+			$this->_nextPageList=null;
128 128
 			return;
129 129
 		}
130 130
 
131 131
 		if($param->getNewPageIndex() < 1)
132 132
 		{
133
-			$this->_prevPageList = null;
133
+			$this->_prevPageList=null;
134 134
 			if($total <= $pageSize)
135 135
 			{
136 136
 				$param->setData($data);
137
-				$this->_nextPageList = null;
137
+				$this->_nextPageList=null;
138 138
 			}
139 139
 			else
140 140
 			{
141 141
 				$param->setData(array_slice($data, 0, $pageSize));
142
-				$this->_nextPageList = array_slice($data, $pageSize - 1, $total);
142
+				$this->_nextPageList=array_slice($data, $pageSize - 1, $total);
143 143
 			}
144 144
 		}
145 145
 		else
146 146
 		{
147 147
 			if($total <= $pageSize)
148 148
 			{
149
-				$this->_prevPageList = array_slice($data, 0, $total);
149
+				$this->_prevPageList=array_slice($data, 0, $total);
150 150
 				$param->setData([]);
151
-				$this->_nextPageList = null;
151
+				$this->_nextPageList=null;
152 152
 			}
153 153
 			elseif($total <= $pageSize * 2)
154 154
 			{
155
-				$this->_prevPageList = array_slice($data, 0, $pageSize);
155
+				$this->_prevPageList=array_slice($data, 0, $pageSize);
156 156
 				$param->setData(array_slice($data, $pageSize, $total));
157
-				$this->_nextPageList = null;
157
+				$this->_nextPageList=null;
158 158
 			}
159 159
 			else
160 160
 			{
161
-				$this->_prevPageList = array_slice($data, 0, $pageSize);
161
+				$this->_prevPageList=array_slice($data, 0, $pageSize);
162 162
 				$param->setData(array_slice($data, $pageSize, $pageSize));
163
-				$this->_nextPageList = array_slice($data, $pageSize * 2, $total - $pageSize * 2);
163
+				$this->_nextPageList=array_slice($data, $pageSize * 2, $total - $pageSize * 2);
164 164
 			}
165 165
 		}
166 166
 	}
@@ -172,8 +172,8 @@  discard block
 block discarded – undo
172 172
 	 */
173 173
 	protected function getOffsetAndLimit($param)
174 174
 	{
175
-		$index = $param->getNewPageIndex();
176
-		$pageSize = $this->getPageSize();
175
+		$index=$param->getNewPageIndex();
176
+		$pageSize=$this->getPageSize();
177 177
 		return $index < 1 ? [$index, $pageSize * 2] : [($index - 1) * $pageSize, $pageSize * 3];
178 178
 	}
179 179
 
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 	 */
183 183
 	public function getIsNextPageAvailable()
184 184
 	{
185
-		return $this->_nextPageList !== null;
185
+		return $this->_nextPageList!==null;
186 186
 	}
187 187
 
188 188
 	/**
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 	 */
191 191
 	public function getIsPreviousPageAvailable()
192 192
 	{
193
-		return $this->_prevPageList !== null;
193
+		return $this->_prevPageList!==null;
194 194
 	}
195 195
 
196 196
 	/**
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 	 */
199 199
 	public function getIsLastPage()
200 200
 	{
201
-		return ($this->_nextPageList === null) || $this->_nextPageList->getCount() < 1;
201
+		return ($this->_nextPageList===null) || $this->_nextPageList->getCount() < 1;
202 202
 	}
203 203
 
204 204
 	/**
Please login to merge, or discard this patch.
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -135,28 +135,24 @@
 block discarded – undo
135 135
 			{
136 136
 				$param->setData($data);
137 137
 				$this->_nextPageList = null;
138
-			}
139
-			else
138
+			} else
140 139
 			{
141 140
 				$param->setData(array_slice($data, 0, $pageSize));
142 141
 				$this->_nextPageList = array_slice($data, $pageSize - 1, $total);
143 142
 			}
144
-		}
145
-		else
143
+		} else
146 144
 		{
147 145
 			if($total <= $pageSize)
148 146
 			{
149 147
 				$this->_prevPageList = array_slice($data, 0, $total);
150 148
 				$param->setData([]);
151 149
 				$this->_nextPageList = null;
152
-			}
153
-			elseif($total <= $pageSize * 2)
150
+			} elseif($total <= $pageSize * 2)
154 151
 			{
155 152
 				$this->_prevPageList = array_slice($data, 0, $pageSize);
156 153
 				$param->setData(array_slice($data, $pageSize, $total));
157 154
 				$this->_nextPageList = null;
158
-			}
159
-			else
155
+			} else
160 156
 			{
161 157
 				$this->_prevPageList = array_slice($data, 0, $pageSize);
162 158
 				$param->setData(array_slice($data, $pageSize, $pageSize));
Please login to merge, or discard this patch.
framework/Data/SqlMap/Statements/TCachingStatement.php 2 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -101,6 +101,10 @@
 block discarded – undo
101 101
 		return $cacheKey->getHash();
102 102
 	}
103 103
 
104
+	/**
105
+	 * @param integer $skip
106
+	 * @param integer $max
107
+	 */
104 108
 	protected function createCommand($connection, $parameter, $skip = null, $max = null)
105 109
 	{
106 110
 		return $this->_mappedStatement->getCommand()->create($this->getManager(),
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 
27 27
 	public function __construct(TMappedStatement $statement)
28 28
 	{
29
-		$this->_mappedStatement = $statement;
29
+		$this->_mappedStatement=$statement;
30 30
 	}
31 31
 
32 32
 	public function getID()
@@ -44,14 +44,14 @@  discard block
 block discarded – undo
44 44
 		return $this->_mappedStatement->getManager();
45 45
 	}
46 46
 
47
-	public function executeQueryForMap($connection, $parameter, $keyProperty, $valueProperty = null, $skip = -1, $max = -1, $delegate = null)
47
+	public function executeQueryForMap($connection, $parameter, $keyProperty, $valueProperty=null, $skip=-1, $max=-1, $delegate=null)
48 48
 	{
49
-		$sql = $this->createCommand($connection, $parameter, $skip, $max);
50
-		$key = $this->getCacheKey([clone($sql), $keyProperty, $valueProperty,$skip, $max]);
51
-		$map = $this->getStatement()->getCache()->get($key);
52
-		if($map === null)
49
+		$sql=$this->createCommand($connection, $parameter, $skip, $max);
50
+		$key=$this->getCacheKey([clone($sql), $keyProperty, $valueProperty, $skip, $max]);
51
+		$map=$this->getStatement()->getCache()->get($key);
52
+		if($map===null)
53 53
 		{
54
-			$map = $this->_mappedStatement->runQueryForMap(
54
+			$map=$this->_mappedStatement->runQueryForMap(
55 55
 				$connection, $parameter, $sql, $keyProperty, $valueProperty, $delegate);
56 56
 			$this->getStatement()->getCache()->set($key, $map);
57 57
 		}
@@ -68,28 +68,28 @@  discard block
 block discarded – undo
68 68
 		return $this->executeInsert($connection, $parameter);
69 69
 	}
70 70
 
71
-	public function executeQueryForList($connection, $parameter, $result = null, $skip = -1, $max = -1, $delegate = null)
71
+	public function executeQueryForList($connection, $parameter, $result=null, $skip=-1, $max=-1, $delegate=null)
72 72
 	{
73
-		$sql = $this->createCommand($connection, $parameter, $skip, $max);
74
-		$key = $this->getCacheKey([clone($sql), $parameter, $skip, $max]);
75
-		$list = $this->getStatement()->getCache()->get($key);
76
-		if($list === null)
73
+		$sql=$this->createCommand($connection, $parameter, $skip, $max);
74
+		$key=$this->getCacheKey([clone($sql), $parameter, $skip, $max]);
75
+		$list=$this->getStatement()->getCache()->get($key);
76
+		if($list===null)
77 77
 		{
78
-			$list = $this->_mappedStatement->runQueryForList(
78
+			$list=$this->_mappedStatement->runQueryForList(
79 79
 				$connection, $parameter, $sql, $result, $delegate);
80 80
 			$this->getStatement()->getCache()->set($key, $list);
81 81
 		}
82 82
 		return $list;
83 83
 	}
84 84
 
85
-	public function executeQueryForObject($connection, $parameter, $result = null)
85
+	public function executeQueryForObject($connection, $parameter, $result=null)
86 86
 	{
87
-		$sql = $this->createCommand($connection, $parameter);
88
-		$key = $this->getCacheKey([clone($sql), $parameter]);
89
-		$object = $this->getStatement()->getCache()->get($key);
90
-		if($object === null)
87
+		$sql=$this->createCommand($connection, $parameter);
88
+		$key=$this->getCacheKey([clone($sql), $parameter]);
89
+		$object=$this->getStatement()->getCache()->get($key);
90
+		if($object===null)
91 91
 		{
92
-			$object = $this->_mappedStatement->runQueryForObject($connection, $sql, $result);
92
+			$object=$this->_mappedStatement->runQueryForObject($connection, $sql, $result);
93 93
 			$this->getStatement()->getCache()->set($key, $object);
94 94
 		}
95 95
 		return $object;
@@ -97,11 +97,11 @@  discard block
 block discarded – undo
97 97
 
98 98
 	protected function getCacheKey($object)
99 99
 	{
100
-		$cacheKey = new TSqlMapCacheKey($object);
100
+		$cacheKey=new TSqlMapCacheKey($object);
101 101
 		return $cacheKey->getHash();
102 102
 	}
103 103
 
104
-	protected function createCommand($connection, $parameter, $skip = null, $max = null)
104
+	protected function createCommand($connection, $parameter, $skip=null, $max=null)
105 105
 	{
106 106
 		return $this->_mappedStatement->getCommand()->create($this->getManager(),
107 107
 					$connection, $this->getStatement(), $parameter, $skip, $max);
Please login to merge, or discard this patch.
framework/Data/SqlMap/Statements/TMappedStatement.php 3 patches
Doc Comments   +6 added lines, -1 removed lines patch added patch discarded remove patch
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 	}
98 98
 
99 99
 	/**
100
-	 * @return TSqlMapper The SqlMap used by this MappedStatement
100
+	 * @return TSqlMapManager The SqlMap used by this MappedStatement
101 101
 	 */
102 102
 	public function getManager()
103 103
 	{
@@ -482,6 +482,7 @@  discard block
 block discarded – undo
482 482
 	 * @param IDbConnection database connection
483 483
 	 * @param mixed insert statement parameter
484 484
 	 * @param TSqlMapSelectKey select key statement
485
+	 * @param \Prado\Data\SqlMap\Configuration\TSqlMapSelectKey $selectKey
485 486
 	 * @return string last insert ID.
486 487
 	 */
487 488
 	protected function executeSelectKey($connection, $parameter, $selectKey)
@@ -582,6 +583,7 @@  discard block
 block discarded – undo
582 583
 	 * @param string result object class name
583 584
 	 * @param array a result set row retrieved from the database
584 585
 	 * @param object the result object, will create if necessary.
586
+	 * @param string $resultClass
585 587
 	 * @return object result object filled with data
586 588
 	 */
587 589
 	protected function fillResultClass($resultClass, $row, $resultObject)
@@ -604,6 +606,7 @@  discard block
 block discarded – undo
604 606
 	 * Apply the result to a TList or an array.
605 607
 	 * @param array a result set row retrieved from the database
606 608
 	 * @param object result object, array or list
609
+	 * @param \ArrayAccess $resultObject
607 610
 	 * @return object result filled with data.
608 611
 	 */
609 612
 	protected function fillResultArrayList($row, $resultObject)
@@ -646,6 +649,7 @@  discard block
 block discarded – undo
646 649
 	 * @param string result map name.
647 650
 	 * @param array a result set row retrieved from the database
648 651
 	 * @param object result object to fill, will create new instances if required.
652
+	 * @param string $parentGroup
649 653
 	 * @return object result object filled with data.
650 654
 	 */
651 655
 	protected function fillResultMap($resultMapName, $row, $parentGroup = null, &$resultObject = null)
@@ -785,6 +789,7 @@  discard block
 block discarded – undo
785 789
 	 * Converts the first array value to scalar value of given type.
786 790
 	 * @param array list of results
787 791
 	 * @param string scalar type.
792
+	 * @param string $type
788 793
 	 * @return mixed scalar value.
789 794
 	 */
790 795
 	protected function getScalarResult($result, $type)
Please login to merge, or discard this patch.
Spacing   +156 added lines, -159 removed lines patch added patch discarded remove patch
@@ -52,12 +52,12 @@  discard block
 block discarded – undo
52 52
 	/**
53 53
 	 * @var TPostSelectBinding[] post select statement queue.
54 54
 	 */
55
-	private $_selectQueue = [];
55
+	private $_selectQueue=[];
56 56
 
57 57
 	/**
58 58
 	 * @var boolean true when data is mapped to a particular row.
59 59
 	 */
60
-	private $_IsRowDataFound = false;
60
+	private $_IsRowDataFound=false;
61 61
 
62 62
 	/**
63 63
 	 * @var TSQLMapObjectCollectionTree group by object collection tree
@@ -67,17 +67,17 @@  discard block
 block discarded – undo
67 67
 	/**
68 68
 	 * @var Post select is to query for list.
69 69
 	 */
70
-	const QUERY_FOR_LIST = 0;
70
+	const QUERY_FOR_LIST=0;
71 71
 
72 72
 	/**
73 73
 	 * @var Post select is to query for list.
74 74
 	 */
75
-	const QUERY_FOR_ARRAY = 1;
75
+	const QUERY_FOR_ARRAY=1;
76 76
 
77 77
 	/**
78 78
 	 * @var Post select is to query for object.
79 79
 	 */
80
-	const QUERY_FOR_OBJECT = 2;
80
+	const QUERY_FOR_OBJECT=2;
81 81
 
82 82
 	/**
83 83
 	 * @return string Name used to identify the TMappedStatement amongst the others.
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 	 */
118 118
 	protected function initialGroupByResults()
119 119
 	{
120
-		$this->_groupBy = new TSqlMapObjectCollectionTree();
120
+		$this->_groupBy=new TSqlMapObjectCollectionTree();
121 121
 	}
122 122
 
123 123
 	/**
@@ -127,9 +127,9 @@  discard block
 block discarded – undo
127 127
 	 */
128 128
 	public function __construct(TSqlMapManager $sqlMap, TSqlMapStatement $statement)
129 129
 	{
130
-		$this->_manager = $sqlMap;
131
-		$this->_statement = $statement;
132
-		$this->_command = new TPreparedCommand();
130
+		$this->_manager=$sqlMap;
131
+		$this->_statement=$statement;
132
+		$this->_command=new TPreparedCommand();
133 133
 		$this->initialGroupByResults();
134 134
 	}
135 135
 
@@ -176,9 +176,9 @@  discard block
 block discarded – undo
176 176
 	{
177 177
 		if($max > -1 || $skip > -1)
178 178
 		{
179
-			$maxStr = $max > 0?' LIMIT ' . $max:'';
180
-			$skipStr = $skip > 0?' OFFSET ' . $skip:'';
181
-			$command->setText($command->getText() . $maxStr . $skipStr);
179
+			$maxStr=$max > 0 ? ' LIMIT '.$max : '';
180
+			$skipStr=$skip > 0 ? ' OFFSET '.$skip : '';
181
+			$command->setText($command->getText().$maxStr.$skipStr);
182 182
 		}
183 183
 		$connection->setActive(true);
184 184
 		return $command->query();
@@ -212,9 +212,9 @@  discard block
 block discarded – undo
212 212
 	 * @param callback row delegate handler
213 213
 	 * @see executeQueryForList()
214 214
 	 */
215
-	public function executeQueryForList($connection, $parameter, $result = null, $skip = -1, $max = -1, $delegate = null)
215
+	public function executeQueryForList($connection, $parameter, $result=null, $skip=-1, $max=-1, $delegate=null)
216 216
 	{
217
-		$sql = $this->_command->create($this->_manager, $connection, $this->_statement, $parameter, $skip, $max);
217
+		$sql=$this->_command->create($this->_manager, $connection, $this->_statement, $parameter, $skip, $max);
218 218
 		return $this->runQueryForList($connection, $parameter, $sql, $result, $delegate);
219 219
 	}
220 220
 
@@ -234,20 +234,19 @@  discard block
 block discarded – undo
234 234
 	 * @return array a list of result objects
235 235
 	 * @see executeQueryForList()
236 236
 	 */
237
-	public function runQueryForList($connection, $parameter, $sql, $result, $delegate = null)
237
+	public function runQueryForList($connection, $parameter, $sql, $result, $delegate=null)
238 238
 	{
239
-		$registry = $this->getManager()->getTypeHandlers();
240
-		$list = $result instanceof \ArrayAccess ? $result :
241
-							$this->_statement->createInstanceOfListClass($registry);
239
+		$registry=$this->getManager()->getTypeHandlers();
240
+		$list=$result instanceof \ArrayAccess ? $result : $this->_statement->createInstanceOfListClass($registry);
242 241
 		$connection->setActive(true);
243
-		$reader = $sql->query();
242
+		$reader=$sql->query();
244 243
 		//$reader = $this->executeSQLQueryLimit($connection, $sql, $max, $skip);
245
-		if($delegate !== null)
244
+		if($delegate!==null)
246 245
 		{
247 246
 			foreach($reader as $row)
248 247
 			{
249
-				$obj = $this->applyResultMap($row);
250
-				$param = new TResultSetListItemParameter($obj, $parameter, $list);
248
+				$obj=$this->applyResultMap($row);
249
+				$param=new TResultSetListItemParameter($obj, $parameter, $list);
251 250
 				$this->raiseRowDelegate($delegate, $param);
252 251
 			}
253 252
 		}
@@ -257,13 +256,13 @@  discard block
 block discarded – undo
257 256
 			foreach($reader as $row)
258 257
 			{
259 258
 //				var_dump($row);
260
-				$list[] = $this->applyResultMap($row);
259
+				$list[]=$this->applyResultMap($row);
261 260
 			}
262 261
 		}
263 262
 
264 263
 		if(!$this->_groupBy->isEmpty())
265 264
 		{
266
-			$list = $this->_groupBy->collect();
265
+			$list=$this->_groupBy->collect();
267 266
 			$this->initialGroupByResults();
268 267
 		}
269 268
 
@@ -285,9 +284,9 @@  discard block
 block discarded – undo
285 284
 	 * @param callback row delegate handler
286 285
 	 * @return array An array of object containing the rows keyed by keyProperty.
287 286
 	 */
288
-	public function executeQueryForMap($connection, $parameter, $keyProperty, $valueProperty = null, $skip = -1, $max = -1, $delegate = null)
287
+	public function executeQueryForMap($connection, $parameter, $keyProperty, $valueProperty=null, $skip=-1, $max=-1, $delegate=null)
289 288
 	{
290
-		$sql = $this->_command->create($this->_manager, $connection, $this->_statement, $parameter, $skip, $max);
289
+		$sql=$this->_command->create($this->_manager, $connection, $this->_statement, $parameter, $skip, $max);
291 290
 		return $this->runQueryForMap($connection, $parameter, $sql, $keyProperty, $valueProperty, $delegate);
292 291
 	}
293 292
 
@@ -309,22 +308,21 @@  discard block
 block discarded – undo
309 308
 	 * @return array An array of object containing the rows keyed by keyProperty.
310 309
 	 * @see executeQueryForMap()
311 310
 	 */
312
-	public function runQueryForMap($connection, $parameter, $command, $keyProperty, $valueProperty = null, $delegate = null)
311
+	public function runQueryForMap($connection, $parameter, $command, $keyProperty, $valueProperty=null, $delegate=null)
313 312
 	{
314
-		$map = [];
313
+		$map=[];
315 314
 		//$recordSet = $this->executeSQLQuery($connection, $sql);
316 315
 		$connection->setActive(true);
317
-		$reader = $command->query();
318
-		if($delegate !== null)
316
+		$reader=$command->query();
317
+		if($delegate!==null)
319 318
 		{
320 319
 			//while($row = $recordSet->fetchRow())
321 320
 			foreach($reader as $row)
322 321
 			{
323
-				$obj = $this->applyResultMap($row);
324
-				$key = TPropertyAccess::get($obj, $keyProperty);
325
-				$value = ($valueProperty === null) ? $obj :
326
-							TPropertyAccess::get($obj, $valueProperty);
327
-				$param = new TResultSetMapItemParameter($key, $value, $parameter, $map);
322
+				$obj=$this->applyResultMap($row);
323
+				$key=TPropertyAccess::get($obj, $keyProperty);
324
+				$value=($valueProperty===null) ? $obj : TPropertyAccess::get($obj, $valueProperty);
325
+				$param=new TResultSetMapItemParameter($key, $value, $parameter, $map);
328 326
 				$this->raiseRowDelegate($delegate, $param);
329 327
 			}
330 328
 		}
@@ -333,10 +331,9 @@  discard block
 block discarded – undo
333 331
 			//while($row = $recordSet->fetchRow())
334 332
 			foreach($reader as $row)
335 333
 			{
336
-				$obj = $this->applyResultMap($row);
337
-				$key = TPropertyAccess::get($obj, $keyProperty);
338
-				$map[$key] = ($valueProperty === null) ? $obj :
339
-								TPropertyAccess::get($obj, $valueProperty);
334
+				$obj=$this->applyResultMap($row);
335
+				$key=TPropertyAccess::get($obj, $keyProperty);
336
+				$map[$key]=($valueProperty===null) ? $obj : TPropertyAccess::get($obj, $valueProperty);
340 337
 			}
341 338
 		}
342 339
 		$this->onExecuteQuery($command);
@@ -358,15 +355,15 @@  discard block
 block discarded – undo
358 355
 		elseif(is_callable($handler, true))
359 356
 		{
360 357
 			// an array: 0 - object, 1 - method name/path
361
-			list($object, $method) = $handler;
358
+			list($object, $method)=$handler;
362 359
 			if(is_string($object))	// static method call
363 360
 				call_user_func($handler, $this, $param);
364 361
 			else
365 362
 			{
366
-				if(($pos = strrpos($method, '.')) !== false)
363
+				if(($pos=strrpos($method, '.'))!==false)
367 364
 				{
368
-					$object = $this->getSubProperty(substr($method, 0, $pos));
369
-					$method = substr($method, $pos + 1);
365
+					$object=$this->getSubProperty(substr($method, 0, $pos));
366
+					$method=substr($method, $pos + 1);
370 367
 				}
371 368
 				$object->$method($this, $param);
372 369
 			}
@@ -383,9 +380,9 @@  discard block
 block discarded – undo
383 380
 	 * @param mixed The result object.
384 381
 	 * @return ${return}
385 382
 	 */
386
-	public function executeQueryForObject($connection, $parameter, $result = null)
383
+	public function executeQueryForObject($connection, $parameter, $result=null)
387 384
 	{
388
-		$sql = $this->_command->create($this->_manager, $connection, $this->_statement, $parameter);
385
+		$sql=$this->_command->create($this->_manager, $connection, $this->_statement, $parameter);
389 386
 		return $this->runQueryForObject($connection, $sql, $result);
390 387
 	}
391 388
 
@@ -404,16 +401,16 @@  discard block
 block discarded – undo
404 401
 	 */
405 402
 	public function runQueryForObject($connection, $command, &$result)
406 403
 	{
407
-		$object = null;
404
+		$object=null;
408 405
 		$connection->setActive(true);
409 406
 		foreach($command->query() as $row)
410
-			$object = $this->applyResultMap($row, $result);
407
+			$object=$this->applyResultMap($row, $result);
411 408
 
412 409
 		if(!$this->_groupBy->isEmpty())
413 410
 		{
414
-			$list = $this->_groupBy->collect();
411
+			$list=$this->_groupBy->collect();
415 412
 			$this->initialGroupByResults();
416
-			$object = $list[0];
413
+			$object=$list[0];
417 414
 		}
418 415
 
419 416
 		$this->executePostSelect($connection);
@@ -431,14 +428,14 @@  discard block
 block discarded – undo
431 428
 	 */
432 429
 	public function executeInsert($connection, $parameter)
433 430
 	{
434
-		$generatedKey = $this->getPreGeneratedSelectKey($connection, $parameter);
431
+		$generatedKey=$this->getPreGeneratedSelectKey($connection, $parameter);
435 432
 
436
-		$command = $this->_command->create($this->_manager, $connection, $this->_statement, $parameter);
433
+		$command=$this->_command->create($this->_manager, $connection, $this->_statement, $parameter);
437 434
 //		var_dump($command,$parameter);
438
-		$result = $command->execute();
435
+		$result=$command->execute();
439 436
 
440
-		if($generatedKey === null)
441
-			$generatedKey = $this->getPostGeneratedSelectKey($connection, $parameter);
437
+		if($generatedKey===null)
438
+			$generatedKey=$this->getPostGeneratedSelectKey($connection, $parameter);
442 439
 
443 440
 		$this->executePostSelect($connection);
444 441
 		$this->onExecuteQuery($command);
@@ -455,8 +452,8 @@  discard block
 block discarded – undo
455 452
 	{
456 453
 		if($this->_statement instanceof TSqlMapInsert)
457 454
 		{
458
-			$selectKey = $this->_statement->getSelectKey();
459
-			if(($selectKey !== null) && !$selectKey->getIsAfter())
455
+			$selectKey=$this->_statement->getSelectKey();
456
+			if(($selectKey!==null) && !$selectKey->getIsAfter())
460 457
 				return $this->executeSelectKey($connection, $parameter, $selectKey);
461 458
 		}
462 459
 	}
@@ -471,8 +468,8 @@  discard block
 block discarded – undo
471 468
 	{
472 469
 		if($this->_statement instanceof TSqlMapInsert)
473 470
 		{
474
-			$selectKey = $this->_statement->getSelectKey();
475
-			if(($selectKey !== null) && $selectKey->getIsAfter())
471
+			$selectKey=$this->_statement->getSelectKey();
472
+			if(($selectKey!==null) && $selectKey->getIsAfter())
476 473
 				return $this->executeSelectKey($connection, $parameter, $selectKey);
477 474
 		}
478 475
 	}
@@ -486,10 +483,10 @@  discard block
 block discarded – undo
486 483
 	 */
487 484
 	protected function executeSelectKey($connection, $parameter, $selectKey)
488 485
 	{
489
-		$mappedStatement = $this->getManager()->getMappedStatement($selectKey->getID());
490
-		$generatedKey = $mappedStatement->executeQueryForObject(
486
+		$mappedStatement=$this->getManager()->getMappedStatement($selectKey->getID());
487
+		$generatedKey=$mappedStatement->executeQueryForObject(
491 488
 									$connection, $parameter, null);
492
-		if(strlen($prop = $selectKey->getProperty()) > 0)
489
+		if(strlen($prop=$selectKey->getProperty()) > 0)
493 490
 				TPropertyAccess::set($parameter, $prop, $generatedKey);
494 491
 		return $generatedKey;
495 492
 	}
@@ -503,8 +500,8 @@  discard block
 block discarded – undo
503 500
 	 */
504 501
 	public function executeUpdate($connection, $parameter)
505 502
 	{
506
-		$sql = $this->_command->create($this->getManager(), $connection, $this->_statement, $parameter);
507
-		$affectedRows = $sql->execute();
503
+		$sql=$this->_command->create($this->getManager(), $connection, $this->_statement, $parameter);
504
+		$affectedRows=$sql->execute();
508 505
 		//$this->executeSQLQuery($connection, $sql);
509 506
 		$this->executePostSelect($connection);
510 507
 		$this->onExecuteQuery($sql);
@@ -519,24 +516,24 @@  discard block
 block discarded – undo
519 516
 	{
520 517
 		while(count($this->_selectQueue))
521 518
 		{
522
-			$postSelect = array_shift($this->_selectQueue);
523
-			$method = $postSelect->getMethod();
524
-			$statement = $postSelect->getStatement();
525
-			$property = $postSelect->getResultProperty()->getProperty();
526
-			$keys = $postSelect->getKeys();
527
-			$resultObject = $postSelect->getResultObject();
528
-
529
-			if($method == self::QUERY_FOR_LIST || $method == self::QUERY_FOR_ARRAY)
519
+			$postSelect=array_shift($this->_selectQueue);
520
+			$method=$postSelect->getMethod();
521
+			$statement=$postSelect->getStatement();
522
+			$property=$postSelect->getResultProperty()->getProperty();
523
+			$keys=$postSelect->getKeys();
524
+			$resultObject=$postSelect->getResultObject();
525
+
526
+			if($method==self::QUERY_FOR_LIST || $method==self::QUERY_FOR_ARRAY)
530 527
 			{
531
-				$values = $statement->executeQueryForList($connection, $keys, null);
528
+				$values=$statement->executeQueryForList($connection, $keys, null);
532 529
 
533
-				if($method == self::QUERY_FOR_ARRAY)
534
-					$values = $values->toArray();
530
+				if($method==self::QUERY_FOR_ARRAY)
531
+					$values=$values->toArray();
535 532
 				TPropertyAccess::set($resultObject, $property, $values);
536 533
 			}
537
-			elseif($method == self::QUERY_FOR_OBJECT)
534
+			elseif($method==self::QUERY_FOR_OBJECT)
538 535
 			{
539
-				$value = $statement->executeQueryForObject($connection, $keys, null);
536
+				$value=$statement->executeQueryForObject($connection, $keys, null);
540 537
 				TPropertyAccess::set($resultObject, $property, $value);
541 538
 			}
542 539
 		}
@@ -557,23 +554,23 @@  discard block
 block discarded – undo
557 554
 	 * @param object the result object, will create if necessary.
558 555
 	 * @return object the result filled with data, null if not filled.
559 556
 	 */
560
-	protected function applyResultMap($row, &$resultObject = null)
557
+	protected function applyResultMap($row, &$resultObject=null)
561 558
 	{
562
-		if($row === false) return null;
559
+		if($row===false) return null;
563 560
 
564
-		$resultMapName = $this->_statement->getResultMap();
565
-		$resultClass = $this->_statement->getResultClass();
561
+		$resultMapName=$this->_statement->getResultMap();
562
+		$resultClass=$this->_statement->getResultClass();
566 563
 
567
-		$obj = null;
564
+		$obj=null;
568 565
 		if($this->getManager()->getResultMaps()->contains($resultMapName))
569
-			$obj = $this->fillResultMap($resultMapName, $row, null, $resultObject);
566
+			$obj=$this->fillResultMap($resultMapName, $row, null, $resultObject);
570 567
 		elseif(strlen($resultClass) > 0)
571
-			$obj = $this->fillResultClass($resultClass, $row, $resultObject);
568
+			$obj=$this->fillResultClass($resultClass, $row, $resultObject);
572 569
 		else
573
-			$obj = $this->fillDefaultResultMap(null, $row, $resultObject);
570
+			$obj=$this->fillDefaultResultMap(null, $row, $resultObject);
574 571
 		if(class_exists('TActiveRecord', false) && $obj instanceof TActiveRecord)
575 572
 			//Create a new clean active record.
576
-			$obj = TActiveRecord::createRecord(get_class($obj), $obj);
573
+			$obj=TActiveRecord::createRecord(get_class($obj), $obj);
577 574
 		return $obj;
578 575
 	}
579 576
 
@@ -586,10 +583,10 @@  discard block
 block discarded – undo
586 583
 	 */
587 584
 	protected function fillResultClass($resultClass, $row, $resultObject)
588 585
 	{
589
-		if($resultObject === null)
586
+		if($resultObject===null)
590 587
 		{
591
-			$registry = $this->getManager()->getTypeHandlers();
592
-			$resultObject = $this->_statement->createInstanceOfResultClass($registry, $row);
588
+			$registry=$this->getManager()->getTypeHandlers();
589
+			$resultObject=$this->_statement->createInstanceOfResultClass($registry, $row);
593 590
 		}
594 591
 
595 592
 		if($resultObject instanceof \ArrayAccess)
@@ -610,10 +607,10 @@  discard block
 block discarded – undo
610 607
 	{
611 608
 		if($resultObject instanceof TList)
612 609
 			foreach($row as $v)
613
-				$resultObject[] = $v;
610
+				$resultObject[]=$v;
614 611
 		else
615 612
 			foreach($row as $k => $v)
616
-				$resultObject[$k] = $v;
613
+				$resultObject[$k]=$v;
617 614
 		return $resultObject;
618 615
 	}
619 616
 
@@ -625,17 +622,17 @@  discard block
 block discarded – undo
625 622
 	 */
626 623
 	protected function fillResultObjectProperty($row, $resultObject)
627 624
 	{
628
-		$index = 0;
629
-		$registry = $this->getManager()->getTypeHandlers();
625
+		$index=0;
626
+		$registry=$this->getManager()->getTypeHandlers();
630 627
 		foreach($row as $k => $v)
631 628
 		{
632
-			$property = new TResultProperty;
629
+			$property=new TResultProperty;
633 630
 			if(is_string($k) && strlen($k) > 0)
634 631
 				$property->setColumn($k);
635 632
 			$property->setColumnIndex(++$index);
636
-			$type = gettype(TPropertyAccess::get($resultObject, $k));
633
+			$type=gettype(TPropertyAccess::get($resultObject, $k));
637 634
 			$property->setType($type);
638
-			$value = $property->getPropertyValue($registry, $row);
635
+			$value=$property->getPropertyValue($registry, $row);
639 636
 			TPropertyAccess::set($resultObject, $k, $value);
640 637
 		}
641 638
 		return $resultObject;
@@ -648,14 +645,14 @@  discard block
 block discarded – undo
648 645
 	 * @param object result object to fill, will create new instances if required.
649 646
 	 * @return object result object filled with data.
650 647
 	 */
651
-	protected function fillResultMap($resultMapName, $row, $parentGroup = null, &$resultObject = null)
648
+	protected function fillResultMap($resultMapName, $row, $parentGroup=null, &$resultObject=null)
652 649
 	{
653
-		$resultMap = $this->getManager()->getResultMap($resultMapName);
654
-		$registry = $this->getManager()->getTypeHandlers();
655
-		$resultMap = $resultMap->resolveSubMap($registry, $row);
650
+		$resultMap=$this->getManager()->getResultMap($resultMapName);
651
+		$registry=$this->getManager()->getTypeHandlers();
652
+		$resultMap=$resultMap->resolveSubMap($registry, $row);
656 653
 
657
-		if($resultObject === null)
658
-			$resultObject = $resultMap->createInstanceOfResult($registry);
654
+		if($resultObject===null)
655
+			$resultObject=$resultMap->createInstanceOfResult($registry);
659 656
 
660 657
 		if(is_object($resultObject))
661 658
 		{
@@ -667,7 +664,7 @@  discard block
 block discarded – undo
667 664
 		}
668 665
 		else
669 666
 		{
670
-			$resultObject = $this->fillDefaultResultMap($resultMap, $row, $resultObject);
667
+			$resultObject=$this->fillDefaultResultMap($resultMap, $row, $resultObject);
671 668
 		}
672 669
 		return $resultObject;
673 670
 	}
@@ -682,11 +679,11 @@  discard block
 block discarded – undo
682 679
 	 */
683 680
 	protected function addResultMapGroupBy($resultMap, $row, $parent, &$resultObject)
684 681
 	{
685
-		$group = $this->getResultMapGroupKey($resultMap, $row);
682
+		$group=$this->getResultMapGroupKey($resultMap, $row);
686 683
 
687 684
 		if(empty($parent))
688 685
 		{
689
-			$rootObject = ['object' => $resultObject, 'property' => null];
686
+			$rootObject=['object' => $resultObject, 'property' => null];
690 687
 			$this->_groupBy->add(null, $group, $rootObject);
691 688
 		}
692 689
 
@@ -694,23 +691,23 @@  discard block
 block discarded – undo
694 691
 		{
695 692
 			//set properties.
696 693
 			$this->setObjectProperty($resultMap, $property, $row, $resultObject);
697
-			$nested = $property->getResultMapping();
694
+			$nested=$property->getResultMapping();
698 695
 
699 696
 			//nested property
700 697
 			if($this->getManager()->getResultMaps()->contains($nested))
701 698
 			{
702
-				$nestedMap = $this->getManager()->getResultMap($nested);
703
-				$groupKey = $this->getResultMapGroupKey($nestedMap, $row);
699
+				$nestedMap=$this->getManager()->getResultMap($nested);
700
+				$groupKey=$this->getResultMapGroupKey($nestedMap, $row);
704 701
 
705 702
 				//add the node reference first
706 703
 				if(empty($parent))
707 704
 					$this->_groupBy->add($group, $groupKey, '');
708 705
 
709 706
 				//get the nested result mapping value
710
-				$value = $this->fillResultMap($nested, $row, $groupKey);
707
+				$value=$this->fillResultMap($nested, $row, $groupKey);
711 708
 
712 709
 				//add it to the object tree graph
713
-				$groupObject = ['object' => $value, 'property' => $property->getProperty()];
710
+				$groupObject=['object' => $value, 'property' => $property->getProperty()];
714 711
 				if(empty($parent))
715 712
 					$this->_groupBy->add($group, $groupKey, $groupObject);
716 713
 				else
@@ -728,11 +725,11 @@  discard block
 block discarded – undo
728 725
 	 */
729 726
 	protected function getResultMapGroupKey($resultMap, $row)
730 727
 	{
731
-		$groupBy = $resultMap->getGroupBy();
728
+		$groupBy=$resultMap->getGroupBy();
732 729
 		if(isset($row[$groupBy]))
733
-			return $resultMap->getID() . $row[$groupBy];
730
+			return $resultMap->getID().$row[$groupBy];
734 731
 		else
735
-			return $resultMap->getID() . crc32(serialize($row));
732
+			return $resultMap->getID().crc32(serialize($row));
736 733
 	}
737 734
 
738 735
 	/**
@@ -745,16 +742,16 @@  discard block
 block discarded – undo
745 742
 	 */
746 743
 	protected function fillDefaultResultMap($resultMap, $row, $resultObject)
747 744
 	{
748
-		if($resultObject === null)
749
-			$resultObject = '';
745
+		if($resultObject===null)
746
+			$resultObject='';
750 747
 
751
-		if($resultMap !== null)
752
-			$result = $this->fillArrayResultMap($resultMap, $row, $resultObject);
748
+		if($resultMap!==null)
749
+			$result=$this->fillArrayResultMap($resultMap, $row, $resultObject);
753 750
 		else
754
-			$result = $row;
751
+			$result=$row;
755 752
 
756 753
 		//if scalar result types
757
-		if(count($result) == 1 && ($type = gettype($resultObject)) != 'array')
754
+		if(count($result)==1 && ($type=gettype($resultObject))!='array')
758 755
 			return $this->getScalarResult($result, $type);
759 756
 		else
760 757
 			return $result;
@@ -769,14 +766,14 @@  discard block
 block discarded – undo
769 766
 	 */
770 767
 	protected function fillArrayResultMap($resultMap, $row, $resultObject)
771 768
 	{
772
-		$result = [];
773
-		$registry = $this->getManager()->getTypeHandlers();
769
+		$result=[];
770
+		$registry=$this->getManager()->getTypeHandlers();
774 771
 		foreach($resultMap->getColumns() as $column)
775 772
 		{
776
-			if(($column->getType() === null)
777
-				&& ($resultObject !== null) && !is_object($resultObject))
773
+			if(($column->getType()===null)
774
+				&& ($resultObject!==null) && !is_object($resultObject))
778 775
 			$column->setType(gettype($resultObject));
779
-			$result[$column->getProperty()] = $column->getPropertyValue($registry, $row);
776
+			$result[$column->getProperty()]=$column->getPropertyValue($registry, $row);
780 777
 		}
781 778
 		return $result;
782 779
 	}
@@ -789,7 +786,7 @@  discard block
 block discarded – undo
789 786
 	 */
790 787
 	protected function getScalarResult($result, $type)
791 788
 	{
792
-		$scalar = array_shift($result);
789
+		$scalar=array_shift($result);
793 790
 		settype($scalar, $type);
794 791
 		return $scalar;
795 792
 	}
@@ -803,25 +800,25 @@  discard block
 block discarded – undo
803 800
 	 */
804 801
 	protected function setObjectProperty($resultMap, $property, $row, &$resultObject)
805 802
 	{
806
-		$select = $property->getSelect();
807
-		$key = $property->getProperty();
808
-		$nested = $property->getNestedResultMap();
809
-		$registry = $this->getManager()->getTypeHandlers();
810
-		if($key === '')
803
+		$select=$property->getSelect();
804
+		$key=$property->getProperty();
805
+		$nested=$property->getNestedResultMap();
806
+		$registry=$this->getManager()->getTypeHandlers();
807
+		if($key==='')
811 808
 		{
812
-			$resultObject = $property->getPropertyValue($registry, $row);
809
+			$resultObject=$property->getPropertyValue($registry, $row);
813 810
 		}
814
-		elseif(strlen($select) == 0 && ($nested === null))
811
+		elseif(strlen($select)==0 && ($nested===null))
815 812
 		{
816
-			$value = $property->getPropertyValue($registry, $row);
813
+			$value=$property->getPropertyValue($registry, $row);
817 814
 
818
-			$this->_IsRowDataFound = $this->_IsRowDataFound || ($value != null);
815
+			$this->_IsRowDataFound=$this->_IsRowDataFound || ($value!=null);
819 816
 			if(is_array($resultObject) || is_object($resultObject))
820 817
 				TPropertyAccess::set($resultObject, $key, $value);
821 818
 			else
822
-				$resultObject = $value;
819
+				$resultObject=$value;
823 820
 		}
824
-		elseif($nested !== null)
821
+		elseif($nested!==null)
825 822
 		{
826 823
 			if($property->instanceOfListType($resultObject) || $property->instanceOfArrayType($resultObject))
827 824
 			{
@@ -832,9 +829,9 @@  discard block
 block discarded – undo
832 829
 			}
833 830
 			else
834 831
 			{
835
-				$obj = $nested->createInstanceOfResult($this->getManager()->getTypeHandlers());
836
-				if($this->fillPropertyWithResultMap($nested, $row, $obj) == false)
837
-					$obj = null;
832
+				$obj=$nested->createInstanceOfResult($this->getManager()->getTypeHandlers());
833
+				if($this->fillPropertyWithResultMap($nested, $row, $obj)==false)
834
+					$obj=null;
838 835
 				TPropertyAccess::set($resultObject, $key, $obj);
839 836
 			}
840 837
 		}
@@ -854,9 +851,9 @@  discard block
 block discarded – undo
854 851
 	 */
855 852
 	protected function enquequePostSelect($select, $resultMap, $property, $row, $resultObject)
856 853
 	{
857
-		$statement = $this->getManager()->getMappedStatement($select);
858
-		$key = $this->getPostSelectKeys($resultMap, $property, $row);
859
-		$postSelect = new TPostSelectBinding;
854
+		$statement=$this->getManager()->getMappedStatement($select);
855
+		$key=$this->getPostSelectKeys($resultMap, $property, $row);
856
+		$postSelect=new TPostSelectBinding;
860 857
 		$postSelect->setStatement($statement);
861 858
 		$postSelect->setResultObject($resultObject);
862 859
 		$postSelect->setResultProperty($property);
@@ -864,10 +861,10 @@  discard block
 block discarded – undo
864 861
 
865 862
 		if($property->instanceOfListType($resultObject))
866 863
 		{
867
-			$values = null;
864
+			$values=null;
868 865
 			if($property->getLazyLoad())
869 866
 			{
870
-				$values = TLazyLoadList::newInstance($statement, $key,
867
+				$values=TLazyLoadList::newInstance($statement, $key,
871 868
 								$resultObject, $property->getProperty());
872 869
 				TPropertyAccess::set($resultObject, $property->getProperty(), $values);
873 870
 			}
@@ -880,7 +877,7 @@  discard block
 block discarded – undo
880 877
 			$postSelect->setMethod(self::QUERY_FOR_OBJECT);
881 878
 
882 879
 		if(!$property->getLazyLoad())
883
-			$this->_selectQueue[] = $postSelect;
880
+			$this->_selectQueue[]=$postSelect;
884 881
 	}
885 882
 
886 883
 	/**
@@ -892,20 +889,20 @@  discard block
 block discarded – undo
892 889
 	 */
893 890
 	protected function getPostSelectKeys($resultMap, $property, $row)
894 891
 	{
895
-		$value = $property->getColumn();
896
-		if(is_int(strpos($value . ',', 0)) || is_int(strpos($value, '=', 0)))
892
+		$value=$property->getColumn();
893
+		if(is_int(strpos($value.',', 0)) || is_int(strpos($value, '=', 0)))
897 894
 		{
898
-			$keys = [];
895
+			$keys=[];
899 896
 			foreach(explode(',', $value) as $entry)
900 897
 			{
901
-				$pair = explode('=', $entry);
902
-				$keys[trim($pair[0])] = $row[trim($pair[1])];
898
+				$pair=explode('=', $entry);
899
+				$keys[trim($pair[0])]=$row[trim($pair[1])];
903 900
 			}
904 901
 			return $keys;
905 902
 		}
906 903
 		else
907 904
 		{
908
-			$registry = $this->getManager()->getTypeHandlers();
905
+			$registry=$this->getManager()->getTypeHandlers();
909 906
 			return $property->getPropertyValue($registry, $row);
910 907
 		}
911 908
 	}
@@ -919,28 +916,28 @@  discard block
 block discarded – undo
919 916
 	 */
920 917
 	protected function fillPropertyWithResultMap($resultMap, $row, &$resultObject)
921 918
 	{
922
-		$dataFound = false;
919
+		$dataFound=false;
923 920
 		foreach($resultMap->getColumns() as $property)
924 921
 		{
925
-			$this->_IsRowDataFound = false;
922
+			$this->_IsRowDataFound=false;
926 923
 			$this->setObjectProperty($resultMap, $property, $row, $resultObject);
927
-			$dataFound = $dataFound || $this->_IsRowDataFound;
924
+			$dataFound=$dataFound || $this->_IsRowDataFound;
928 925
 		}
929
-		$this->_IsRowDataFound = $dataFound;
926
+		$this->_IsRowDataFound=$dataFound;
930 927
 		return $dataFound;
931 928
 	}
932 929
 
933 930
 	public function __wakeup()
934 931
 	{
935
-		if (null === $this->_selectQueue) $this->_selectQueue = [];
932
+		if(null===$this->_selectQueue) $this->_selectQueue=[];
936 933
 	}
937 934
 
938 935
 	public function __sleep()
939 936
 	{
940
-		$exprops = []; $cn = __CLASS__;
941
-		if (!count($this->_selectQueue)) $exprops[] = "\0$cn\0_selectQueue";
942
-		if (null === $this->_groupBy) $exprops[] = "\0$cn\0_groupBy";
943
-		if (!$this->_IsRowDataFound) $exprops[] = "\0$cn\0_IsRowDataFound";
937
+		$exprops=[]; $cn=__CLASS__;
938
+		if(!count($this->_selectQueue)) $exprops[]="\0$cn\0_selectQueue";
939
+		if(null===$this->_groupBy) $exprops[]="\0$cn\0_groupBy";
940
+		if(!$this->_IsRowDataFound) $exprops[]="\0$cn\0_IsRowDataFound";
944 941
 		return array_diff(parent::__sleep(), $exprops);
945 942
 	}
946 943
 }
947 944
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +13 added lines, -26 removed lines patch added patch discarded remove patch
@@ -250,8 +250,7 @@  discard block
 block discarded – undo
250 250
 				$param = new TResultSetListItemParameter($obj, $parameter, $list);
251 251
 				$this->raiseRowDelegate($delegate, $param);
252 252
 			}
253
-		}
254
-		else
253
+		} else
255 254
 		{
256 255
 			//var_dump($sql,$parameter);
257 256
 			foreach($reader as $row)
@@ -327,8 +326,7 @@  discard block
 block discarded – undo
327 326
 				$param = new TResultSetMapItemParameter($key, $value, $parameter, $map);
328 327
 				$this->raiseRowDelegate($delegate, $param);
329 328
 			}
330
-		}
331
-		else
329
+		} else
332 330
 		{
333 331
 			//while($row = $recordSet->fetchRow())
334 332
 			foreach($reader as $row)
@@ -354,8 +352,7 @@  discard block
 block discarded – undo
354 352
 		if(is_string($handler))
355 353
 		{
356 354
 			call_user_func($handler, $this, $param);
357
-		}
358
-		elseif(is_callable($handler, true))
355
+		} elseif(is_callable($handler, true))
359 356
 		{
360 357
 			// an array: 0 - object, 1 - method name/path
361 358
 			list($object, $method) = $handler;
@@ -370,8 +367,7 @@  discard block
 block discarded – undo
370 367
 				}
371 368
 				$object->$method($this, $param);
372 369
 			}
373
-		}
374
-		else
370
+		} else
375 371
 			throw new TInvalidDataValueException('sqlmap_invalid_delegate', $this->getID(), $handler);
376 372
 	}
377 373
 
@@ -533,8 +529,7 @@  discard block
 block discarded – undo
533 529
 				if($method == self::QUERY_FOR_ARRAY)
534 530
 					$values = $values->toArray();
535 531
 				TPropertyAccess::set($resultObject, $property, $values);
536
-			}
537
-			elseif($method == self::QUERY_FOR_OBJECT)
532
+			} elseif($method == self::QUERY_FOR_OBJECT)
538 533
 			{
539 534
 				$value = $statement->executeQueryForObject($connection, $keys, null);
540 535
 				TPropertyAccess::set($resultObject, $property, $value);
@@ -664,8 +659,7 @@  discard block
 block discarded – undo
664 659
 			else
665 660
 				foreach($resultMap->getColumns() as $property)
666 661
 					$this->setObjectProperty($resultMap, $property, $row, $resultObject);
667
-		}
668
-		else
662
+		} else
669 663
 		{
670 664
 			$resultObject = $this->fillDefaultResultMap($resultMap, $row, $resultObject);
671 665
 		}
@@ -810,8 +804,7 @@  discard block
 block discarded – undo
810 804
 		if($key === '')
811 805
 		{
812 806
 			$resultObject = $property->getPropertyValue($registry, $row);
813
-		}
814
-		elseif(strlen($select) == 0 && ($nested === null))
807
+		} elseif(strlen($select) == 0 && ($nested === null))
815 808
 		{
816 809
 			$value = $property->getPropertyValue($registry, $row);
817 810
 
@@ -820,8 +813,7 @@  discard block
 block discarded – undo
820 813
 				TPropertyAccess::set($resultObject, $key, $value);
821 814
 			else
822 815
 				$resultObject = $value;
823
-		}
824
-		elseif($nested !== null)
816
+		} elseif($nested !== null)
825 817
 		{
826 818
 			if($property->instanceOfListType($resultObject) || $property->instanceOfArrayType($resultObject))
827 819
 			{
@@ -829,16 +821,14 @@  discard block
 block discarded – undo
829 821
 					throw new TSqlMapExecutionException(
830 822
 						'sqlmap_non_groupby_array_list_type', $resultMap->getID(),
831 823
 						get_class($resultObject), $key);
832
-			}
833
-			else
824
+			} else
834 825
 			{
835 826
 				$obj = $nested->createInstanceOfResult($this->getManager()->getTypeHandlers());
836 827
 				if($this->fillPropertyWithResultMap($nested, $row, $obj) == false)
837 828
 					$obj = null;
838 829
 				TPropertyAccess::set($resultObject, $key, $obj);
839 830
 			}
840
-		}
841
-		else //'select' ResultProperty
831
+		} else //'select' ResultProperty
842 832
 		{
843 833
 			$this->enquequePostSelect($select, $resultMap, $property, $row, $resultObject);
844 834
 		}
@@ -870,11 +860,9 @@  discard block
 block discarded – undo
870 860
 				$values = TLazyLoadList::newInstance($statement, $key,
871 861
 								$resultObject, $property->getProperty());
872 862
 				TPropertyAccess::set($resultObject, $property->getProperty(), $values);
873
-			}
874
-			else
863
+			} else
875 864
 				$postSelect->setMethod(self::QUERY_FOR_LIST);
876
-		}
877
-		elseif($property->instanceOfArrayType($resultObject))
865
+		} elseif($property->instanceOfArrayType($resultObject))
878 866
 			$postSelect->setMethod(self::QUERY_FOR_ARRAY);
879 867
 		else
880 868
 			$postSelect->setMethod(self::QUERY_FOR_OBJECT);
@@ -902,8 +890,7 @@  discard block
 block discarded – undo
902 890
 				$keys[trim($pair[0])] = $row[trim($pair[1])];
903 891
 			}
904 892
 			return $keys;
905
-		}
906
-		else
893
+		} else
907 894
 		{
908 895
 			$registry = $this->getManager()->getTypeHandlers();
909 896
 			return $property->getPropertyValue($registry, $row);
Please login to merge, or discard this patch.