Completed
Push — prado4-sauce ( 31ba42...77d75b )
by Fabio
16:20 queued 08:27
created
framework/Data/Common/Mysql/TMysqlTableColumn.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
  */
24 24
 class TMysqlTableColumn extends TDbTableColumn
25 25
 {
26
-	private static $types = array(
26
+	private static $types=array(
27 27
 		'integer' => array('bit', 'tinyint', 'smallint', 'mediumint', 'int', 'integer', 'bigint'),
28 28
 		'boolean' => array('boolean', 'bool'),
29 29
 		'float' => array('float', 'double', 'double precision', 'decimal', 'dec', 'numeric', 'fixed')
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	 */
36 36
 	public function getPHPType()
37 37
 	{
38
-		$dbtype = trim(str_replace(array('unsigned', 'zerofill'),array('','',),strtolower($this->getDbType())));
38
+		$dbtype=trim(str_replace(array('unsigned', 'zerofill'), array('', '',), strtolower($this->getDbType())));
39 39
 		if($dbtype==='tinyint' && $this->getColumnSize()===1)
40 40
 			return 'boolean';
41 41
 		foreach(self::$types as $type => $dbtypes)
Please login to merge, or discard this patch.
framework/Data/Common/TDbTableInfo.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -31,13 +31,13 @@  discard block
 block discarded – undo
31 31
 	 * @var null|array
32 32
 	 * @since 3.1.7
33 33
 	 */
34
-	private $_names = null;
34
+	private $_names=null;
35 35
 
36 36
 	/**
37 37
 	 * Sets the database table meta data information.
38 38
 	 * @param array table column information.
39 39
 	 */
40
-	public function __construct($tableInfo=array(),$primary=array(),$foreign=array())
40
+	public function __construct($tableInfo=array(), $primary=array(), $foreign=array())
41 41
 	{
42 42
 		$this->_info=$tableInfo;
43 43
 		$this->_primaryKeys=$primary;
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 	public function createCommandBuilder($connection)
53 53
 	{
54 54
 		Prado::using('System.Data.Common.TDbCommandBuilder');
55
-		return new TDbCommandBuilder($connection,$this);
55
+		return new TDbCommandBuilder($connection, $this);
56 56
 	}
57 57
 
58 58
 	/**
@@ -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
-	protected function getInfo($name,$default=null)
63
+	protected function getInfo($name, $default=null)
64 64
 	{
65 65
 		return isset($this->_info[$name]) ? $this->_info[$name] : $default;
66 66
 	}
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 	 * @param string information array key name
70 70
 	 * @param mixed new information array value.
71 71
 	 */
72
-	protected function setInfo($name,$value)
72
+	protected function setInfo($name, $value)
73 73
 	{
74 74
 		$this->_info[$name]=$value;
75 75
 	}
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 	 */
96 96
 	public function getIsView()
97 97
 	{
98
-		return $this->getInfo('IsView',false);
98
+		return $this->getInfo('IsView', false);
99 99
 	}
100 100
 
101 101
 	/**
@@ -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
 	}
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 		{
128 128
 			$this->_names=array();
129 129
 			foreach($this->getColumns() as $column)
130
-				$this->_names[] = $column->getColumnName();
130
+				$this->_names[]=$column->getColumnName();
131 131
 		}
132 132
 		return $this->_names;
133 133
 	}
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 		{
158 158
 			$this->_lowercase=array();
159 159
 			foreach($this->getColumns()->getKeys() as $key)
160
-				$this->_lowercase[strtolower($key)] = $key;
160
+				$this->_lowercase[strtolower($key)]=$key;
161 161
 		}
162 162
 		return $this->_lowercase;
163 163
 	}
Please login to merge, or discard this patch.
Doc Comments   +2 added lines patch added patch discarded remove patch
@@ -53,6 +53,8 @@
 block discarded – undo
53 53
 	/**
54 54
 	 * @param string information array key name
55 55
 	 * @param mixed default value if information array value is null
56
+	 * @param string $name
57
+	 * @param boolean $default
56 58
 	 * @return mixed information array value.
57 59
 	 */
58 60
 	public function getInfo($name,$default=null)
Please login to merge, or discard this patch.
framework/Data/Common/Sqlite/TSqliteTableInfo.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
31 31
 	public function createCommandBuilder($connection)
32 32
 	{
33 33
 		Prado::using('System.Data.Common.Sqlite.TSqliteCommandBuilder');
34
-		return new TSqliteCommandBuilder($connection,$this);
34
+		return new TSqliteCommandBuilder($connection, $this);
35 35
 	}
36 36
 
37 37
 	/**
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
 {
30 30
 	/**
31 31
 	 * @param TDbConnection database connection.
32
-	 * @return TDbCommandBuilder new command builder
32
+	 * @return TSqliteCommandBuilder new command builder
33 33
 	 */
34 34
 	public function createCommandBuilder($connection)
35 35
 	{
Please login to merge, or discard this patch.
framework/Data/Common/Sqlite/TSqliteTableColumn.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 	/**
27 27
 	 * @TODO add sqlite types.
28 28
 	 */
29
-	private static $types = array();
29
+	private static $types=array();
30 30
 
31 31
 	/**
32 32
 	 * Overrides parent implementation, returns PHP type from the db type.
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 	 */
35 35
 	public function getPHPType()
36 36
 	{
37
-		$dbtype = strtolower($this->getDbType());
37
+		$dbtype=strtolower($this->getDbType());
38 38
 		foreach(self::$types as $type => $dbtypes)
39 39
 		{
40 40
 			if(in_array($dbtype, $dbtypes))
Please login to merge, or discard this patch.
framework/Data/ActiveRecord/TActiveRecord.php 4 patches
Braces   +7 added lines, -14 removed lines patch added patch discarded remove patch
@@ -425,14 +425,12 @@  discard block
 block discarded – undo
425 425
 				$this->_recordState = self::STATE_LOADED;
426 426
 				return true;
427 427
 			}
428
-		}
429
-		else if($this->_recordState===self::STATE_LOADED)
428
+		} else if($this->_recordState===self::STATE_LOADED)
430 429
 		{
431 430
 			$this->onUpdate($param);
432 431
 			if($param->getIsValid() && $gateway->update($this))
433 432
 				return true;
434
-		}
435
-		else
433
+		} else
436 434
 			throw new TActiveRecordException('ar_save_invalid', get_class($this));
437 435
 
438 436
 		return false;
@@ -455,8 +453,7 @@  discard block
 block discarded – undo
455 453
 				$this->_recordState=self::STATE_DELETED;
456 454
 				return true;
457 455
 			}
458
-		}
459
-		else
456
+		} else
460 457
 			throw new TActiveRecordException('ar_delete_invalid', get_class($this));
461 458
 
462 459
 		return false;
@@ -723,8 +720,7 @@  discard block
 block discarded – undo
723 720
 		{
724 721
 			$criteria = $this->getRecordCriteria(count($args)>0 ? $args[0] : null, array_slice($args,1));
725 722
 			return $context->getRelationHandler($criteria);
726
-		}
727
-		else
723
+		} else
728 724
 			return null;
729 725
 	}
730 726
 
@@ -743,8 +739,7 @@  discard block
 block discarded – undo
743 739
 		{
744 740
 			list($property, $relation) = $definition;
745 741
 			return new TActiveRecordRelationContext($this,$property,$relation);
746
-		}
747
-		else
742
+		} else
748 743
 			return null;
749 744
 	}
750 745
 
@@ -827,8 +822,7 @@  discard block
 block discarded – undo
827 822
 		{
828 823
 			$property= $method[4]==='_' ? substr($method,5) : substr($method,4);
829 824
 			return $this->getRelationHandler($property, $args);
830
-		}
831
-		else if($findOne=strncasecmp($method,'findby',6)===0)
825
+		} else if($findOne=strncasecmp($method,'findby',6)===0)
832 826
 			$condition = $method[6]==='_' ? substr($method,7) : substr($method,6);
833 827
 		else if(strncasecmp($method,'findallby',9)===0)
834 828
 			$condition = $method[9]==='_' ? substr($method,10) : substr($method,9);
@@ -894,8 +888,7 @@  discard block
 block discarded – undo
894 888
 		{
895 889
 			$useArgs = !is_array($parameters) && is_array($args);
896 890
 			return new TActiveRecordCriteria($criteria,$useArgs ? $args : $parameters);
897
-		}
898
-		else if($criteria instanceof TSqlCriteria)
891
+		} else if($criteria instanceof TSqlCriteria)
899 892
 			return $criteria;
900 893
 		else
901 894
 			return new TActiveRecordCriteria();
Please login to merge, or discard this patch.
Doc Comments   +10 added lines, -2 removed lines patch added patch discarded remove patch
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
 	/**
325 325
 	 * Gets the current Db connection, the connection object is obtained from
326 326
 	 * the TActiveRecordManager if connection is currently null.
327
-	 * @return TDbConnection current db connection for this object.
327
+	 * @return \Prado\Data\TDbConnection current db connection for this object.
328 328
 	 */
329 329
 	public function getDbConnection()
330 330
 	{
@@ -511,6 +511,7 @@  discard block
 block discarded – undo
511 511
 	 * Delete multiple records using a criteria.
512 512
 	 * @param string|TActiveRecordCriteria SQL condition or criteria object.
513 513
 	 * @param mixed parameter values.
514
+	 * @param TSqlCriteria $criteria
514 515
 	 * @return int number of records deleted.
515 516
 	 */
516 517
 	public function deleteAll($criteria=null, $parameters=array())
@@ -577,6 +578,7 @@  discard block
 block discarded – undo
577 578
 	 *
578 579
 	 * @param string|TActiveRecordCriteria SQL condition or criteria object.
579 580
 	 * @param mixed parameter values.
581
+	 * @param TSqlCriteria $criteria
580 582
 	 * @return TActiveRecord matching record object. Null if no result is found.
581 583
 	 */
582 584
 	public function find($criteria,$parameters=array())
@@ -593,6 +595,7 @@  discard block
 block discarded – undo
593 595
 	 *
594 596
 	 * @param string|TActiveRecordCriteria SQL condition or criteria object.
595 597
 	 * @param mixed parameter values.
598
+	 * @param TSqlCriteria $criteria
596 599
 	 * @return array matching record objects. Empty array if no result is found.
597 600
 	 */
598 601
 	public function findAll($criteria=null,$parameters=array())
@@ -706,6 +709,7 @@  discard block
 block discarded – undo
706 709
 	 * Find the number of records.
707 710
 	 * @param string|TActiveRecordCriteria SQL condition or criteria object.
708 711
 	 * @param mixed parameter values.
712
+	 * @param TActiveRecordCriteria $criteria
709 713
 	 * @return int number of records.
710 714
 	 */
711 715
 	public function count($criteria=null,$parameters=array())
@@ -721,6 +725,7 @@  discard block
 block discarded – undo
721 725
 	 * value equal to the $property value.
722 726
 	 * @param string relationship/property name corresponding to keys in $RELATION array.
723 727
 	 * @param array method call arguments.
728
+	 * @param string $name
724 729
 	 * @return TActiveRecordRelation, null if the context or the handler doesn't exist
725 730
 	 */
726 731
 	protected function getRelationHandler($name,$args=array())
@@ -945,6 +950,7 @@  discard block
 block discarded – undo
945 950
 	 * Raised before the record attempt to insert its data into the database.
946 951
 	 * To prevent the insert operation, set the TActiveRecordChangeEventParameter::IsValid parameter to false.
947 952
 	 * @param TActiveRecordChangeEventParameter event parameter to be passed to the event handlers
953
+	 * @param TActiveRecordChangeEventParameter $param
948 954
 	 */
949 955
 	public function onInsert($param)
950 956
 	{
@@ -955,6 +961,7 @@  discard block
 block discarded – undo
955 961
 	 * Raised before the record attempt to delete its data from the database.
956 962
 	 * To prevent the delete operation, set the TActiveRecordChangeEventParameter::IsValid parameter to false.
957 963
 	 * @param TActiveRecordChangeEventParameter event parameter to be passed to the event handlers
964
+	 * @param TActiveRecordChangeEventParameter $param
958 965
 	 */
959 966
 	public function onDelete($param)
960 967
 	{
@@ -965,6 +972,7 @@  discard block
 block discarded – undo
965 972
 	 * Raised before the record attempt to update its data in the database.
966 973
 	 * To prevent the update operation, set the TActiveRecordChangeEventParameter::IsValid parameter to false.
967 974
 	 * @param TActiveRecordChangeEventParameter event parameter to be passed to the event handlers
975
+	 * @param TActiveRecordChangeEventParameter $param
968 976
 	 */
969 977
 	public function onUpdate($param)
970 978
 	{
@@ -1048,7 +1056,7 @@  discard block
 block discarded – undo
1048 1056
     
1049 1057
     	/**
1050 1058
      	* Return record data as JSON
1051
-     	* @return JSON
1059
+     	* @return string
1052 1060
      	* @since 3.2.4
1053 1061
      	*/
1054 1062
     	public function toJSON(){
Please login to merge, or discard this patch.
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -1032,26 +1032,26 @@
 block discarded – undo
1032 1032
 		return isset(self::$_relations[get_class($this)][strtolower($property)]);
1033 1033
 	}
1034 1034
 	
1035
-        /**
1036
-        * Return record data as array
1037
-        * @return array of column name and column values
1038
-        * @since 3.2.4
1039
-        */
1040
-        public function toArray(){
1041
-        	$result=array();
1042
-        	foreach($this->getRecordTableInfo()->getLowerCaseColumnNames() as $columnName){
1043
-            		$result[$columnName]=$this->getColumnValue($columnName);
1044
-           	}
1035
+		/**
1036
+		 * Return record data as array
1037
+		 * @return array of column name and column values
1038
+		 * @since 3.2.4
1039
+		 */
1040
+		public function toArray(){
1041
+			$result=array();
1042
+			foreach($this->getRecordTableInfo()->getLowerCaseColumnNames() as $columnName){
1043
+					$result[$columnName]=$this->getColumnValue($columnName);
1044
+		   	}
1045 1045
         
1046
-        	return $result;
1047
-    	}
1046
+			return $result;
1047
+		}
1048 1048
     
1049
-    	/**
1050
-     	* Return record data as JSON
1051
-     	* @return JSON
1052
-     	* @since 3.2.4
1053
-     	*/
1054
-    	public function toJSON(){
1055
-        	return json_encode($this->toArray());
1056
-    	}
1049
+		/**
1050
+		 * Return record data as JSON
1051
+		 * @return JSON
1052
+		 * @since 3.2.4
1053
+		 */
1054
+		public function toJSON(){
1055
+			return json_encode($this->toArray());
1056
+		}
1057 1057
 }
1058 1058
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +83 added lines, -83 removed lines patch added patch discarded remove patch
@@ -200,14 +200,14 @@  discard block
 block discarded – undo
200 200
 	 * @var TActiveRecordInvalidFinderResult
201 201
 	 * @since 3.1.5
202 202
 	 */
203
-	protected $_invalidFinderResult = null; // use protected so that serialization is fine
203
+	protected $_invalidFinderResult=null; // use protected so that serialization is fine
204 204
 
205 205
 	/**
206 206
 	 * Prevent __call() method creating __sleep() when serializing.
207 207
 	 */
208 208
 	public function __sleep()
209 209
 	{
210
-		return array_diff(parent::__sleep(),array("\0*\0_connection"));
210
+		return array_diff(parent::__sleep(), array("\0*\0_connection"));
211 211
 	}
212 212
 
213 213
 	/**
@@ -262,12 +262,12 @@  discard block
 block discarded – undo
262 262
 	 * @param mixed property value.
263 263
 	 * @since 3.1.2
264 264
 	 */
265
-	public function __set($name,$value)
265
+	public function __set($name, $value)
266 266
 	{
267 267
 		if($this->hasRecordRelation($name) && !$this->canSetProperty($name))
268 268
 			$this->$name=$value;
269 269
 		else
270
-			parent::__set($name,$value);
270
+			parent::__set($name, $value);
271 271
 	}
272 272
 
273 273
 	/**
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
 			$class=new ReflectionClass($className);
295 295
 			$relations=array();
296 296
 			foreach($class->getStaticPropertyValue('RELATIONS') as $key=>$value)
297
-				$relations[strtolower($key)]=array($key,$value);
297
+				$relations[strtolower($key)]=array($key, $value);
298 298
 			self::$_relations[$className]=$relations;
299 299
 		}
300 300
 	}
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
 		if(!is_array($data))
311 311
 			throw new TActiveRecordException('ar_data_invalid', get_class($this));
312 312
 		foreach($data as $name=>$value)
313
-			$this->setColumnValue($name,$value);
313
+			$this->setColumnValue($name, $value);
314 314
 	}
315 315
 
316 316
 
@@ -361,16 +361,16 @@  discard block
 block discarded – undo
361 361
 	{
362 362
 		if($record===null || get_class($this)!==get_class($record))
363 363
 			return false;
364
-		$tableInfo = $this->getRecordTableInfo();
365
-		$pks = $tableInfo->getPrimaryKeys();
366
-		$properties = count($pks) > 0 ? $pks : $tableInfo->getColumns()->getKeys();
364
+		$tableInfo=$this->getRecordTableInfo();
365
+		$pks=$tableInfo->getPrimaryKeys();
366
+		$properties=count($pks) > 0 ? $pks : $tableInfo->getColumns()->getKeys();
367 367
 		$equals=true;
368 368
 		foreach($properties as $prop)
369 369
 		{
370 370
 			if($strict)
371
-				$equals = $equals && $this->getColumnValue($prop) === $record->getColumnValue($prop);
371
+				$equals=$equals && $this->getColumnValue($prop)===$record->getColumnValue($prop);
372 372
 			else
373
-				$equals = $equals && $this->getColumnValue($prop) == $record->getColumnValue($prop);
373
+				$equals=$equals && $this->getColumnValue($prop)==$record->getColumnValue($prop);
374 374
 			if(!$equals)
375 375
 				return false;
376 376
 		}
@@ -388,10 +388,10 @@  discard block
 block discarded – undo
388 388
 	 */
389 389
 	public static function finder($className=__CLASS__)
390 390
 	{
391
-		static $finders = array();
391
+		static $finders=array();
392 392
 		if(!isset($finders[$className]))
393 393
 		{
394
-			$f = Prado::createComponent($className);
394
+			$f=Prado::createComponent($className);
395 395
 			$finders[$className]=$f;
396 396
 		}
397 397
 		return $finders[$className];
@@ -421,14 +421,14 @@  discard block
 block discarded – undo
421 421
 	 */
422 422
 	public function save()
423 423
 	{
424
-		$gateway = $this->getRecordGateway();
425
-		$param = new TActiveRecordChangeEventParameter();
424
+		$gateway=$this->getRecordGateway();
425
+		$param=new TActiveRecordChangeEventParameter();
426 426
 		if($this->_recordState===self::STATE_NEW)
427 427
 		{
428 428
 			$this->onInsert($param);
429 429
 			if($param->getIsValid() && $gateway->insert($this))
430 430
 			{
431
-				$this->_recordState = self::STATE_LOADED;
431
+				$this->_recordState=self::STATE_LOADED;
432 432
 				return true;
433 433
 			}
434 434
 		}
@@ -453,8 +453,8 @@  discard block
 block discarded – undo
453 453
 	{
454 454
 		if($this->_recordState===self::STATE_LOADED)
455 455
 		{
456
-			$gateway = $this->getRecordGateway();
457
-			$param = new TActiveRecordChangeEventParameter();
456
+			$gateway=$this->getRecordGateway();
457
+			$param=new TActiveRecordChangeEventParameter();
458 458
 			$this->onDelete($param);
459 459
 			if($param->getIsValid() && $gateway->delete($this))
460 460
 			{
@@ -494,8 +494,8 @@  discard block
 block discarded – undo
494 494
 	public function deleteByPk($keys)
495 495
 	{
496 496
 		if(func_num_args() > 1)
497
-			$keys = func_get_args();
498
-		return $this->getRecordGateway()->deleteRecordsByPk($this,(array)$keys);
497
+			$keys=func_get_args();
498
+		return $this->getRecordGateway()->deleteRecordsByPk($this, (array) $keys);
499 499
 	}
500 500
 
501 501
 	/**
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
 	public function deleteAllByPks($keys)
505 505
 	{
506 506
 		if(func_num_args() > 1)
507
-			$keys = func_get_args();
507
+			$keys=func_get_args();
508 508
 		return $this->deleteByPk($keys);
509 509
 	}
510 510
 	/**
@@ -515,8 +515,8 @@  discard block
 block discarded – undo
515 515
 	 */
516 516
 	public function deleteAll($criteria=null, $parameters=array())
517 517
 	{
518
-		$args = func_num_args() > 1 ? array_slice(func_get_args(),1) : null;
519
-		$criteria = $this->getRecordCriteria($criteria,$parameters, $args);
518
+		$args=func_num_args() > 1 ? array_slice(func_get_args(), 1) : null;
519
+		$criteria=$this->getRecordCriteria($criteria, $parameters, $args);
520 520
 		return $this->getRecordGateway()->deleteRecordsByCriteria($this, $criteria);
521 521
 	}
522 522
 
@@ -540,7 +540,7 @@  discard block
 block discarded – undo
540 540
 	{
541 541
 		$result=array();
542 542
 		foreach($reader as $data)
543
-			$result[] = $this->populateObject($data);
543
+			$result[]=$this->populateObject($data);
544 544
 		return $result;
545 545
 	}
546 546
 
@@ -579,12 +579,12 @@  discard block
 block discarded – undo
579 579
 	 * @param mixed parameter values.
580 580
 	 * @return TActiveRecord matching record object. Null if no result is found.
581 581
 	 */
582
-	public function find($criteria,$parameters=array())
582
+	public function find($criteria, $parameters=array())
583 583
 	{
584
-		$args = func_num_args() > 1 ? array_slice(func_get_args(),1) : null;
585
-		$criteria = $this->getRecordCriteria($criteria,$parameters, $args);
584
+		$args=func_num_args() > 1 ? array_slice(func_get_args(), 1) : null;
585
+		$criteria=$this->getRecordCriteria($criteria, $parameters, $args);
586 586
 		$criteria->setLimit(1);
587
-		$data = $this->getRecordGateway()->findRecordsByCriteria($this,$criteria);
587
+		$data=$this->getRecordGateway()->findRecordsByCriteria($this, $criteria);
588 588
 		return $this->populateObject($data);
589 589
 	}
590 590
 
@@ -595,12 +595,12 @@  discard block
 block discarded – undo
595 595
 	 * @param mixed parameter values.
596 596
 	 * @return array matching record objects. Empty array if no result is found.
597 597
 	 */
598
-	public function findAll($criteria=null,$parameters=array())
598
+	public function findAll($criteria=null, $parameters=array())
599 599
 	{
600
-		$args = func_num_args() > 1 ? array_slice(func_get_args(),1) : null;
600
+		$args=func_num_args() > 1 ? array_slice(func_get_args(), 1) : null;
601 601
 		if($criteria!==null)
602
-			$criteria = $this->getRecordCriteria($criteria,$parameters, $args);
603
-		$result = $this->getRecordGateway()->findRecordsByCriteria($this,$criteria,true);
602
+			$criteria=$this->getRecordCriteria($criteria, $parameters, $args);
603
+		$result=$this->getRecordGateway()->findRecordsByCriteria($this, $criteria, true);
604 604
 		return $this->populateObjects($result);
605 605
 	}
606 606
 
@@ -618,11 +618,11 @@  discard block
 block discarded – undo
618 618
 	 */
619 619
 	public function findByPk($keys)
620 620
 	{
621
-		if($keys === null)
621
+		if($keys===null)
622 622
 			return null;
623 623
 		if(func_num_args() > 1)
624
-			$keys = func_get_args();
625
-		$data = $this->getRecordGateway()->findRecordByPK($this,$keys);
624
+			$keys=func_get_args();
625
+		$data=$this->getRecordGateway()->findRecordByPK($this, $keys);
626 626
 		return $this->populateObject($data);
627 627
 	}
628 628
 
@@ -646,8 +646,8 @@  discard block
 block discarded – undo
646 646
 	public function findAllByPks($keys)
647 647
 	{
648 648
 		if(func_num_args() > 1)
649
-			$keys = func_get_args();
650
-		$result = $this->getRecordGateway()->findRecordsByPks($this,(array)$keys);
649
+			$keys=func_get_args();
650
+		$result=$this->getRecordGateway()->findRecordsByPks($this, (array) $keys);
651 651
 		return $this->populateObjects($result);
652 652
 	}
653 653
 
@@ -659,12 +659,12 @@  discard block
 block discarded – undo
659 659
 	 * @param array $parameters
660 660
 	 * @return TActiveRecord, null if no result is returned.
661 661
 	 */
662
-	public function findBySql($sql,$parameters=array())
662
+	public function findBySql($sql, $parameters=array())
663 663
 	{
664
-		$args = func_num_args() > 1 ? array_slice(func_get_args(),1) : null;
665
-		$criteria = $this->getRecordCriteria($sql,$parameters, $args);
664
+		$args=func_num_args() > 1 ? array_slice(func_get_args(), 1) : null;
665
+		$criteria=$this->getRecordCriteria($sql, $parameters, $args);
666 666
 		$criteria->setLimit(1);
667
-		$data = $this->getRecordGateway()->findRecordBySql($this,$criteria);
667
+		$data=$this->getRecordGateway()->findRecordBySql($this, $criteria);
668 668
 		return $this->populateObject($data);
669 669
 	}
670 670
 
@@ -676,11 +676,11 @@  discard block
 block discarded – undo
676 676
 	 * @param array $parameters
677 677
 	 * @return array matching active records. Empty array is returned if no result is found.
678 678
 	 */
679
-	public function findAllBySql($sql,$parameters=array())
679
+	public function findAllBySql($sql, $parameters=array())
680 680
 	{
681
-		$args = func_num_args() > 1 ? array_slice(func_get_args(),1) : null;
682
-		$criteria = $this->getRecordCriteria($sql,$parameters, $args);
683
-		$result = $this->getRecordGateway()->findRecordsBySql($this,$criteria);
681
+		$args=func_num_args() > 1 ? array_slice(func_get_args(), 1) : null;
682
+		$criteria=$this->getRecordCriteria($sql, $parameters, $args);
683
+		$result=$this->getRecordGateway()->findRecordsBySql($this, $criteria);
684 684
 		return $this->populateObjects($result);
685 685
 	}
686 686
 
@@ -696,9 +696,9 @@  discard block
 block discarded – undo
696 696
 	 * @param array matching field values.
697 697
 	 * @return array matching active records. Empty array is returned if no result is found.
698 698
 	 */
699
-	public function findAllByIndex($criteria,$fields,$values)
699
+	public function findAllByIndex($criteria, $fields, $values)
700 700
 	{
701
-		$result = $this->getRecordGateway()->findRecordsByIndex($this,$criteria,$fields,$values);
701
+		$result=$this->getRecordGateway()->findRecordsByIndex($this, $criteria, $fields, $values);
702 702
 		return $this->populateObjects($result);
703 703
 	}
704 704
 
@@ -708,12 +708,12 @@  discard block
 block discarded – undo
708 708
 	 * @param mixed parameter values.
709 709
 	 * @return int number of records.
710 710
 	 */
711
-	public function count($criteria=null,$parameters=array())
711
+	public function count($criteria=null, $parameters=array())
712 712
 	{
713
-		$args = func_num_args() > 1 ? array_slice(func_get_args(),1) : null;
713
+		$args=func_num_args() > 1 ? array_slice(func_get_args(), 1) : null;
714 714
 		if($criteria!==null)
715
-			$criteria = $this->getRecordCriteria($criteria,$parameters, $args);
716
-		return $this->getRecordGateway()->countRecords($this,$criteria);
715
+			$criteria=$this->getRecordCriteria($criteria, $parameters, $args);
716
+		return $this->getRecordGateway()->countRecords($this, $criteria);
717 717
 	}
718 718
 
719 719
 	/**
@@ -723,11 +723,11 @@  discard block
 block discarded – undo
723 723
 	 * @param array method call arguments.
724 724
 	 * @return TActiveRecordRelation, null if the context or the handler doesn't exist
725 725
 	 */
726
-	protected function getRelationHandler($name,$args=array())
726
+	protected function getRelationHandler($name, $args=array())
727 727
 	{
728
-		if(($context=$this->createRelationContext($name)) !== null)
728
+		if(($context=$this->createRelationContext($name))!==null)
729 729
 		{
730
-			$criteria = $this->getRecordCriteria(count($args)>0 ? $args[0] : null, array_slice($args,1));
730
+			$criteria=$this->getRecordCriteria(count($args) > 0 ? $args[0] : null, array_slice($args, 1));
731 731
 			return $context->getRelationHandler($criteria);
732 732
 		}
733 733
 		else
@@ -747,8 +747,8 @@  discard block
 block discarded – undo
747 747
 	{
748 748
 		if(($definition=$this->getRecordRelation($name))!==null)
749 749
 		{
750
-			list($property, $relation) = $definition;
751
-			return new TActiveRecordRelationContext($this,$property,$relation);
750
+			list($property, $relation)=$definition;
751
+			return new TActiveRecordRelationContext($this, $property, $relation);
752 752
 		}
753 753
 		else
754 754
 			return null;
@@ -791,7 +791,7 @@  discard block
 block discarded – undo
791 791
 	 */
792 792
 	protected function fetchResultsFor($property)
793 793
 	{
794
-		if( ($context=$this->createRelationContext($property)) !== null)
794
+		if(($context=$this->createRelationContext($property))!==null)
795 795
 			return $context->getRelationHandler()->fetchResultsInto($this);
796 796
 		else
797 797
 			return false;
@@ -826,31 +826,31 @@  discard block
 block discarded – undo
826 826
 	 * @return mixed single record if method name starts with "findBy", 0 or more records
827 827
 	 * if method name starts with "findAllBy"
828 828
 	 */
829
-	public function __call($method,$args)
829
+	public function __call($method, $args)
830 830
 	{
831
-		$delete =false;
832
-		if(strncasecmp($method,'with',4)===0)
831
+		$delete=false;
832
+		if(strncasecmp($method, 'with', 4)===0)
833 833
 		{
834
-			$property= $method[4]==='_' ? substr($method,5) : substr($method,4);
834
+			$property=$method[4]==='_' ? substr($method, 5) : substr($method, 4);
835 835
 			return $this->getRelationHandler($property, $args);
836 836
 		}
837
-		else if($findOne=strncasecmp($method,'findby',6)===0)
838
-			$condition = $method[6]==='_' ? substr($method,7) : substr($method,6);
839
-		else if(strncasecmp($method,'findallby',9)===0)
840
-			$condition = $method[9]==='_' ? substr($method,10) : substr($method,9);
841
-		else if($delete=strncasecmp($method,'deleteby',8)===0)
842
-			$condition = $method[8]==='_' ? substr($method,9) : substr($method,8);
843
-		else if($delete=strncasecmp($method,'deleteallby',11)===0)
844
-			$condition = $method[11]==='_' ? substr($method,12) : substr($method,11);
837
+		else if($findOne=strncasecmp($method, 'findby', 6)===0)
838
+			$condition=$method[6]==='_' ? substr($method, 7) : substr($method, 6);
839
+		else if(strncasecmp($method, 'findallby', 9)===0)
840
+			$condition=$method[9]==='_' ? substr($method, 10) : substr($method, 9);
841
+		else if($delete=strncasecmp($method, 'deleteby', 8)===0)
842
+			$condition=$method[8]==='_' ? substr($method, 9) : substr($method, 8);
843
+		else if($delete=strncasecmp($method, 'deleteallby', 11)===0)
844
+			$condition=$method[11]==='_' ? substr($method, 12) : substr($method, 11);
845 845
 		else
846 846
 		{
847
-			if($this->getInvalidFinderResult() == TActiveRecordInvalidFinderResult::Exception)
848
-				throw new TActiveRecordException('ar_invalid_finder_method',$method);
847
+			if($this->getInvalidFinderResult()==TActiveRecordInvalidFinderResult::Exception)
848
+				throw new TActiveRecordException('ar_invalid_finder_method', $method);
849 849
 			else
850 850
 				return null;
851 851
 		}
852 852
 
853
-		$criteria = $this->getRecordGateway()->getCommand($this)->createCriteriaFromString($method, $condition, $args);
853
+		$criteria=$this->getRecordGateway()->getCommand($this)->createCriteriaFromString($method, $condition, $args);
854 854
 		if($delete)
855 855
 			return $this->deleteAll($criteria);
856 856
 		else
@@ -864,7 +864,7 @@  discard block
 block discarded – undo
864 864
 	 */
865 865
 	public function getInvalidFinderResult()
866 866
 	{
867
-		if($this->_invalidFinderResult !== null)
867
+		if($this->_invalidFinderResult!==null)
868 868
 			return $this->_invalidFinderResult;
869 869
 
870 870
 		return self::getRecordManager()->getInvalidFinderResult();
@@ -879,10 +879,10 @@  discard block
 block discarded – undo
879 879
 	 */
880 880
 	public function setInvalidFinderResult($value)
881 881
 	{
882
-		if($value === null)
883
-			$this->_invalidFinderResult = null;
882
+		if($value===null)
883
+			$this->_invalidFinderResult=null;
884 884
 		else
885
-			$this->_invalidFinderResult = TPropertyValue::ensureEnum($value, 'Prado\\Data\\ActiveRecord\\TActiveRecordInvalidFinderResult');
885
+			$this->_invalidFinderResult=TPropertyValue::ensureEnum($value, 'Prado\\Data\\ActiveRecord\\TActiveRecordInvalidFinderResult');
886 886
 	}
887 887
 
888 888
 	/**
@@ -898,8 +898,8 @@  discard block
 block discarded – undo
898 898
 	{
899 899
 		if(is_string($criteria))
900 900
 		{
901
-			$useArgs = !is_array($parameters) && is_array($args);
902
-			return new TActiveRecordCriteria($criteria,$useArgs ? $args : $parameters);
901
+			$useArgs=!is_array($parameters) && is_array($args);
902
+			return new TActiveRecordCriteria($criteria, $useArgs ? $args : $parameters);
903 903
 		}
904 904
 		else if($criteria instanceof TSqlCriteria)
905 905
 			return $criteria;
@@ -993,7 +993,7 @@  discard block
 block discarded – undo
993 993
 	 * @param mixed the corresponding column value
994 994
 	 * @since 3.1.1
995 995
 	 */
996
-	public function setColumnValue($columnName,$value)
996
+	public function setColumnValue($columnName, $value)
997 997
 	{
998 998
 		$className=get_class($this);
999 999
 		if(isset(self::$_columnMapping[$className][$columnName]))
@@ -1010,7 +1010,7 @@  discard block
 block discarded – undo
1010 1010
 	{
1011 1011
 		$className=get_class($this);
1012 1012
 		$property=strtolower($property);
1013
-		return isset(self::$_relations[$className][$property])?self::$_relations[$className][$property]:null;
1013
+		return isset(self::$_relations[$className][$property]) ? self::$_relations[$className][$property] : null;
1014 1014
 	}
1015 1015
 
1016 1016
 	/**
@@ -1037,9 +1037,9 @@  discard block
 block discarded – undo
1037 1037
         * @return array of column name and column values
1038 1038
         * @since 3.2.4
1039 1039
         */
1040
-        public function toArray(){
1040
+        public function toArray() {
1041 1041
         	$result=array();
1042
-        	foreach($this->getRecordTableInfo()->getLowerCaseColumnNames() as $columnName){
1042
+        	foreach($this->getRecordTableInfo()->getLowerCaseColumnNames() as $columnName) {
1043 1043
             		$result[$columnName]=$this->getColumnValue($columnName);
1044 1044
            	}
1045 1045
         
@@ -1051,7 +1051,7 @@  discard block
 block discarded – undo
1051 1051
      	* @return JSON
1052 1052
      	* @since 3.2.4
1053 1053
      	*/
1054
-    	public function toJSON(){
1054
+    	public function toJSON() {
1055 1055
         	return json_encode($this->toArray());
1056 1056
     	}
1057 1057
 }
1058 1058
\ No newline at end of file
Please login to merge, or discard this patch.
framework/Data/ActiveRecord/Relations/TActiveRecordBelongsTo.php 2 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -77,13 +77,13 @@  discard block
 block discarded – undo
77 77
 	 */
78 78
 	protected function collectForeignObjects(&$results)
79 79
 	{
80
-		$fkeys = $this->getRelationForeignKeys();
80
+		$fkeys=$this->getRelationForeignKeys();
81 81
 
82
-		$properties = array_keys($fkeys);
83
-		$fields = array_values($fkeys);
84
-		$indexValues = $this->getIndexValues($properties, $results);
85
-		$fkObjects = $this->findForeignObjects($fields, $indexValues);
86
-		$this->populateResult($results,$properties,$fkObjects,$fields);
82
+		$properties=array_keys($fkeys);
83
+		$fields=array_values($fkeys);
84
+		$indexValues=$this->getIndexValues($properties, $results);
85
+		$fkObjects=$this->findForeignObjects($fields, $indexValues);
86
+		$this->populateResult($results, $properties, $fkObjects, $fields);
87 87
 	}
88 88
 
89 89
 	/**
@@ -92,8 +92,8 @@  discard block
 block discarded – undo
92 92
 	 */
93 93
 	public function getRelationForeignKeys()
94 94
 	{
95
-		$fkObject = $this->getContext()->getForeignRecordFinder();
96
-		return $this->findForeignKeys($this->getSourceRecord(),$fkObject);
95
+		$fkObject=$this->getContext()->getForeignRecordFinder();
96
+		return $this->findForeignKeys($this->getSourceRecord(), $fkObject);
97 97
 	}
98 98
 
99 99
 	/**
@@ -103,8 +103,8 @@  discard block
 block discarded – undo
103 103
 	 */
104 104
 	protected function setObjectProperty($source, $properties, &$collections)
105 105
 	{
106
-		$hash = $this->getObjectHash($source, $properties);
107
-		$prop = $this->getContext()->getProperty();
106
+		$hash=$this->getObjectHash($source, $properties);
107
+		$prop=$this->getContext()->getProperty();
108 108
 		if(isset($collections[$hash]) && count($collections[$hash]) > 0)
109 109
 		{
110 110
 			if(count($collections[$hash]) > 1)
@@ -121,13 +121,13 @@  discard block
 block discarded – undo
121 121
 	 */
122 122
 	public function updateAssociatedRecords()
123 123
 	{
124
-		$obj = $this->getContext()->getSourceRecord();
125
-		$fkObject = $obj->getColumnValue($this->getContext()->getProperty());
124
+		$obj=$this->getContext()->getSourceRecord();
125
+		$fkObject=$obj->getColumnValue($this->getContext()->getProperty());
126 126
 		if($fkObject!==null)
127 127
 		{
128 128
 			$fkObject->save();
129
-			$source = $this->getSourceRecord();
130
-			$fkeys = $this->findForeignKeys($source, $fkObject);
129
+			$source=$this->getSourceRecord();
130
+			$fkeys=$this->findForeignKeys($source, $fkObject);
131 131
 			foreach($fkeys as $srcKey => $fKey)
132 132
 				$source->setColumnValue($srcKey, $fkObject->getColumnValue($fKey));
133 133
 			return true;
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -58,8 +58,7 @@
 block discarded – undo
58 58
 		if ($this->sourcepath === NULL)
59 59
 		{
60 60
 			$this->sourcepath = $sourcepath;
61
-		}
62
-		else
61
+		} else
63 62
 		{
64 63
 			$this->sourcepath->append($sourcepath);
65 64
 		}
Please login to merge, or discard this patch.
framework/Data/ActiveRecord/Relations/TActiveRecordRelationContext.php 2 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 
49 49
 	public function getPropertyValue()
50 50
 	{
51
-		$obj = $this->getSourceRecord();
51
+		$obj=$this->getSourceRecord();
52 52
 		return $obj->getColumnValue($this->getProperty());
53 53
 	}
54 54
 
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 	 */
112 112
 	public function getCondition()
113 113
 	{
114
-		return isset($this->_relation[3])?$this->_relation[3]:null;
114
+		return isset($this->_relation[3]) ? $this->_relation[3] : null;
115 115
 	}
116 116
 
117 117
 	/**
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 	 */
121 121
 	public function getParameters()
122 122
 	{
123
-		return isset($this->_relation[4])?$this->_relation[4]:array();
123
+		return isset($this->_relation[4]) ? $this->_relation[4] : array();
124 124
 	}
125 125
 
126 126
 	/**
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 	 */
130 130
 	public function hasFkField()
131 131
 	{
132
-		$notManyToMany = $this->getRelationType() !== TActiveRecord::MANY_TO_MANY;
132
+		$notManyToMany=$this->getRelationType()!==TActiveRecord::MANY_TO_MANY;
133 133
 		return $notManyToMany && isset($this->_relation[2]) && !empty($this->_relation[2]);
134 134
 	}
135 135
 
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 	 */
147 147
 	public function hasAssociationTable()
148 148
 	{
149
-		$isManyToMany = $this->getRelationType() === TActiveRecord::MANY_TO_MANY;
149
+		$isManyToMany=$this->getRelationType()===TActiveRecord::MANY_TO_MANY;
150 150
 		return $isManyToMany && isset($this->_relation[2]) && !empty($this->_relation[2]);
151 151
 	}
152 152
 
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 				$this->_property, get_class($this->_record), 'RELATIONS');
175 175
 		}
176 176
 		if($criteria===null)
177
-			$criteria = new TActiveRecordCriteria($this->getCondition(), $this->getParameters());
177
+			$criteria=new TActiveRecordCriteria($this->getCondition(), $this->getParameters());
178 178
 		switch($this->getRelationType())
179 179
 		{
180 180
 			case TActiveRecord::HAS_MANY:
@@ -202,15 +202,15 @@  discard block
 block discarded – undo
202 202
 		$success=true;
203 203
 		foreach($this->_record->getRecordRelations() as $data)
204 204
 		{
205
-			list($property, $relation) = $data;
206
-			$belongsTo = $relation[0]==TActiveRecord::BELONGS_TO;
205
+			list($property, $relation)=$data;
206
+			$belongsTo=$relation[0]==TActiveRecord::BELONGS_TO;
207 207
 			if(($updateBelongsTo && $belongsTo) || (!$updateBelongsTo && !$belongsTo))
208 208
 			{
209
-				$obj = $this->getSourceRecord();
209
+				$obj=$this->getSourceRecord();
210 210
 				if(!$this->isEmptyFkObject($obj->getColumnValue($property)))
211 211
 				{
212
-					$context = new TActiveRecordRelationContext($this->getSourceRecord(),$property,$relation);
213
-					$success = $context->getRelationHandler()->updateAssociatedRecords() && $success;
212
+					$context=new TActiveRecordRelationContext($this->getSourceRecord(), $property, $relation);
213
+					$success=$context->getRelationHandler()->updateAssociatedRecords() && $success;
214 214
 				}
215 215
 			}
216 216
 		}
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 	protected function isEmptyFkObject($obj)
221 221
 	{
222 222
 		if(is_object($obj))
223
-			return $obj instanceof TList ? $obj->count() === 0 : false;
223
+			return $obj instanceof TList ? $obj->count()===0 : false;
224 224
 		else if(is_array($obj))
225 225
 			return count($obj)===0;
226 226
 		else
Please login to merge, or discard this patch.
Doc Comments   +5 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,6 +35,9 @@  discard block
 block discarded – undo
35 35
 	private $_relation; //data from an entry of TActiveRecord::$RELATION
36 36
 	private $_fkeys;
37 37
 
38
+	/**
39
+	 * @param TActiveRecord $record
40
+	 */
38 41
 	public function __construct($record, $property=null, $relation=null)
39 42
 	{
40 43
 		$this->_record=$record;
@@ -168,6 +171,7 @@  discard block
 block discarded – undo
168 171
 	 * An instance of TActiveRecordHasOne, TActiveRecordBelongsTo, TActiveRecordHasMany,
169 172
 	 * or TActiveRecordHasManyAssocation will be returned.
170 173
 	 * @param TActiveRecordCriteria search criteria
174
+	 * @param \Prado\Data\DataGateway\TSqlCriteria $criteria
171 175
 	 * @return TActiveRecordRelation record relationship handler instnace.
172 176
 	 * @throws TActiveRecordException if property is not defined or missing.
173 177
 	 */
@@ -196,7 +200,7 @@  discard block
 block discarded – undo
196 200
 	}
197 201
 
198 202
 	/**
199
-	 * @return TActiveRecordRelationCommand
203
+	 * @return boolean
200 204
 	 */
201 205
 	public function updateAssociatedRecords($updateBelongsTo=false)
202 206
 	{
Please login to merge, or discard this patch.
framework/Data/ActiveRecord/Relations/TActiveRecordHasMany.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -75,14 +75,14 @@  discard block
 block discarded – undo
75 75
 	 */
76 76
 	protected function collectForeignObjects(&$results)
77 77
 	{
78
-		$fkeys = $this->getRelationForeignKeys();
78
+		$fkeys=$this->getRelationForeignKeys();
79 79
 
80
-		$properties = array_values($fkeys);
81
-		$fields = array_keys($fkeys);
80
+		$properties=array_values($fkeys);
81
+		$fields=array_keys($fkeys);
82 82
 
83
-		$indexValues = $this->getIndexValues($properties, $results);
84
-		$fkObjects = $this->findForeignObjects($fields,$indexValues);
85
-		$this->populateResult($results,$properties,$fkObjects,$fields);
83
+		$indexValues=$this->getIndexValues($properties, $results);
84
+		$fkObjects=$this->findForeignObjects($fields, $indexValues);
85
+		$this->populateResult($results, $properties, $fkObjects, $fields);
86 86
 	}
87 87
 
88 88
 	/**
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 	 */
92 92
 	public function getRelationForeignKeys()
93 93
 	{
94
-		$fkObject = $this->getContext()->getForeignRecordFinder();
94
+		$fkObject=$this->getContext()->getForeignRecordFinder();
95 95
 		return $this->findForeignKeys($fkObject, $this->getSourceRecord());
96 96
 	}
97 97
 
@@ -101,18 +101,18 @@  discard block
 block discarded – undo
101 101
 	 */
102 102
 	public function updateAssociatedRecords()
103 103
 	{
104
-		$obj = $this->getContext()->getSourceRecord();
105
-		$fkObjects = &$obj->{$this->getContext()->getProperty()};
104
+		$obj=$this->getContext()->getSourceRecord();
105
+		$fkObjects=&$obj->{$this->getContext()->getProperty()};
106 106
 		$success=true;
107
-		if(($total = count($fkObjects))> 0)
107
+		if(($total=count($fkObjects)) > 0)
108 108
 		{
109
-			$source = $this->getSourceRecord();
110
-			$fkeys = $this->findForeignKeys($fkObjects[0], $source);
111
-			for($i=0;$i<$total;$i++)
109
+			$source=$this->getSourceRecord();
110
+			$fkeys=$this->findForeignKeys($fkObjects[0], $source);
111
+			for($i=0; $i < $total; $i++)
112 112
 			{
113 113
 				foreach($fkeys as $fKey => $srcKey)
114 114
 					$fkObjects[$i]->setColumnValue($fKey, $source->getColumnValue($srcKey));
115
-				$success = $fkObjects[$i]->save() && $success;
115
+				$success=$fkObjects[$i]->save() && $success;
116 116
 			}
117 117
 		}
118 118
 		return $success;
Please login to merge, or discard this patch.
framework/Data/ActiveRecord/Relations/TActiveRecordHasOne.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -92,13 +92,13 @@  discard block
 block discarded – undo
92 92
 	 */
93 93
 	protected function collectForeignObjects(&$results)
94 94
 	{
95
-		$fkeys = $this->getRelationForeignKeys();
96
-		$properties = array_values($fkeys);
97
-		$fields = array_keys($fkeys);
95
+		$fkeys=$this->getRelationForeignKeys();
96
+		$properties=array_values($fkeys);
97
+		$fields=array_keys($fkeys);
98 98
 
99
-		$indexValues = $this->getIndexValues($properties, $results);
100
-		$fkObjects = $this->findForeignObjects($fields,$indexValues);
101
-		$this->populateResult($results,$properties,$fkObjects,$fields);
99
+		$indexValues=$this->getIndexValues($properties, $results);
100
+		$fkObjects=$this->findForeignObjects($fields, $indexValues);
101
+		$this->populateResult($results, $properties, $fkObjects, $fields);
102 102
 	}
103 103
 
104 104
 	/**
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 	 */
108 108
 	public function getRelationForeignKeys()
109 109
 	{
110
-		$fkObject = $this->getContext()->getForeignRecordFinder();
110
+		$fkObject=$this->getContext()->getForeignRecordFinder();
111 111
 		return $this->findForeignKeys($fkObject, $this->getSourceRecord());
112 112
 	}
113 113
 
@@ -118,8 +118,8 @@  discard block
 block discarded – undo
118 118
 	 */
119 119
 	protected function setObjectProperty($source, $properties, &$collections)
120 120
 	{
121
-		$hash = $this->getObjectHash($source, $properties);
122
-		$prop = $this->getContext()->getProperty();
121
+		$hash=$this->getObjectHash($source, $properties);
122
+		$prop=$this->getContext()->getProperty();
123 123
 		if(isset($collections[$hash]) && count($collections[$hash]) > 0)
124 124
 		{
125 125
 			if(count($collections[$hash]) > 1)
@@ -134,9 +134,9 @@  discard block
 block discarded – undo
134 134
 	 */
135 135
 	public function updateAssociatedRecords()
136 136
 	{
137
-		$fkObject = $this->getContext()->getPropertyValue();
138
-		$source = $this->getSourceRecord();
139
-		$fkeys = $this->findForeignKeys($fkObject, $source);
137
+		$fkObject=$this->getContext()->getPropertyValue();
138
+		$source=$this->getSourceRecord();
139
+		$fkeys=$this->findForeignKeys($fkObject, $source);
140 140
 		foreach($fkeys as $fKey => $srcKey)
141 141
 			$fkObject->setColumnValue($fKey, $source->getColumnValue($srcKey));
142 142
 		return $fkObject->save();
Please login to merge, or discard this patch.