Completed
Push — remove_deprecates ( 1de955 )
by Fabio
07:55
created
framework/Data/ActiveRecord/TActiveRecordManager.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -76,6 +76,7 @@  discard block
 block discarded – undo
76 76
 
77 77
 	/**
78 78
 	 * @param TDbConnection default database connection
79
+	 * @param \Prado\Data\TDbConnection $conn
79 80
 	 */
80 81
 	public function setDbConnection($conn)
81 82
 	{
@@ -91,6 +92,7 @@  discard block
 block discarded – undo
91 92
 	}
92 93
 
93 94
 	/**
95
+	 * @param \Prado\TComponent $self
94 96
 	 * @return TActiveRecordManager static instance of record manager.
95 97
 	 */
96 98
 	public static function getInstance($self=null)
@@ -153,6 +155,7 @@  discard block
 block discarded – undo
153 155
 	/**
154 156
 	 * Define the way an active record finder react if an invalid magic-finder invoked
155 157
 	 * @param TActiveRecordInvalidFinderResult
158
+	 * @param TActiveRecordInvalidFinderResult $value
156 159
 	 * @since 3.1.5
157 160
 	 * @see getInvalidFinderResult
158 161
 	 */
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -36,13 +36,13 @@  discard block
 block discarded – undo
36 36
  */
37 37
 class TActiveRecordManager extends \Prado\TComponent
38 38
 {
39
-	const DEFAULT_GATEWAY_CLASS = 'System.Data.ActiveRecord.TActiveRecordGateway';
39
+	const DEFAULT_GATEWAY_CLASS='System.Data.ActiveRecord.TActiveRecordGateway';
40 40
 
41 41
 	/**
42 42
 	 * Defaults to {@link TActiveRecordManager::DEFAULT_GATEWAY_CLASS DEFAULT_GATEWAY_CLASS}
43 43
 	 * @var string
44 44
 	 */
45
-	private $_gatewayClass = self::DEFAULT_GATEWAY_CLASS;
45
+	private $_gatewayClass=self::DEFAULT_GATEWAY_CLASS;
46 46
 
47 47
 	private $_gateway;
48 48
 	private $_meta=array();
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 	 * @var TActiveRecordInvalidFinderResult
57 57
 	 * @since 3.1.5
58 58
 	 */
59
-	private $_invalidFinderResult = TActiveRecordInvalidFinderResult::Null;
59
+	private $_invalidFinderResult=TActiveRecordInvalidFinderResult::Null;
60 60
 
61 61
 	/**
62 62
 	 * @return ICache application cache.
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 		if($self!==null)
100 100
 			$instance=$self;
101 101
 		else if($instance===null)
102
-			$instance = new self;
102
+			$instance=new self;
103 103
 		return $instance;
104 104
 	}
105 105
 
@@ -108,8 +108,8 @@  discard block
 block discarded – undo
108 108
 	 */
109 109
 	public function getRecordGateway()
110 110
 	{
111
-		if($this->_gateway === null) {
112
-			$this->_gateway = $this->createRecordGateway();
111
+		if($this->_gateway===null) {
112
+			$this->_gateway=$this->createRecordGateway();
113 113
 		}
114 114
 		return $this->_gateway;
115 115
 	}
@@ -128,8 +128,8 @@  discard block
 block discarded – undo
128 128
 	 */
129 129
 	public function setGatewayClass($value)
130 130
 	{
131
-		$this->_gateway = null;
132
-		$this->_gatewayClass = (string)$value;
131
+		$this->_gateway=null;
132
+		$this->_gatewayClass=(string) $value;
133 133
 	}
134 134
 
135 135
 	/**
@@ -158,6 +158,6 @@  discard block
 block discarded – undo
158 158
 	 */
159 159
 	public function setInvalidFinderResult($value)
160 160
 	{
161
-		$this->_invalidFinderResult = TPropertyValue::ensureEnum($value, 'Prado\\Data\\ActiveRecord\\TActiveRecordInvalidFinderResult');
161
+		$this->_invalidFinderResult=TPropertyValue::ensureEnum($value, 'Prado\\Data\\ActiveRecord\\TActiveRecordInvalidFinderResult');
162 162
 	}
163 163
 }
Please login to merge, or discard this patch.
framework/Data/Common/Mssql/TMssqlTableInfo.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@
 block discarded – undo
54 54
 
55 55
 	/**
56 56
 	 * @param TDbConnection database connection.
57
-	 * @return TDbCommandBuilder new command builder
57
+	 * @return TMssqlCommandBuilder new command builder
58 58
 	 */
59 59
 	public function createCommandBuilder($connection)
60 60
 	{
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@
 block discarded – undo
58 58
 	 */
59 59
 	public function createCommandBuilder($connection)
60 60
 	{
61
-		return new TMssqlCommandBuilder($connection,$this);
61
+		return new TMssqlCommandBuilder($connection, $this);
62 62
 	}
63 63
 }
64 64
 
Please login to merge, or discard this patch.
framework/Data/Common/Mysql/TMysqlTableInfo.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@
 block discarded – undo
48 48
 
49 49
 	/**
50 50
 	 * @param TDbConnection database connection.
51
-	 * @return TDbCommandBuilder new command builder
51
+	 * @return TMysqlCommandBuilder new command builder
52 52
 	 */
53 53
 	public function createCommandBuilder($connection)
54 54
 	{
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@
 block discarded – undo
52 52
 	 */
53 53
 	public function createCommandBuilder($connection)
54 54
 	{
55
-		return new TMysqlCommandBuilder($connection,$this);
55
+		return new TMysqlCommandBuilder($connection, $this);
56 56
 	}
57 57
 }
58 58
 
Please login to merge, or discard this patch.
framework/Data/Common/Oracle/TOracleTableInfo.php 2 patches
Doc Comments   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 
48 48
 	/**
49 49
 	 * @param TDbConnection database connection.
50
-	 * @return TDbCommandBuilder new command builder
50
+	 * @return TOracleCommandBuilder new command builder
51 51
 	 */
52 52
 	public function createCommandBuilder($connection)
53 53
 	{
@@ -57,6 +57,8 @@  discard block
 block discarded – undo
57 57
 	/**
58 58
 	 * @param string information array key name
59 59
 	 * @param mixed default value if information array value is null
60
+	 * @param string $name
61
+	 * @param boolean $default
60 62
 	 * @return mixed information array value.
61 63
 	 */
62 64
 	public function getInfo($name,$default=null)
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
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;
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 	 */
52 52
 	public function createCommandBuilder($connection)
53 53
 	{
54
-		return new TOracleCommandBuilder($connection,$this);
54
+		return new TOracleCommandBuilder($connection, $this);
55 55
 	}
56 56
 
57 57
 	/**
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 	 * @param mixed default value if information array value is null
60 60
 	 * @return mixed information array value.
61 61
 	 */
62
-	public function getInfo($name,$default=null)
62
+	public function getInfo($name, $default=null)
63 63
 	{
64 64
 		return isset($this->_info[$name]) ? $this->_info[$name] : $default;
65 65
 	}
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 	 * @param string information array key name
69 69
 	 * @param mixed new information array value.
70 70
 	 */
71
-	protected function setInfo($name,$value)
71
+	protected function setInfo($name, $value)
72 72
 	{
73 73
 		$this->_info[$name]=$value;
74 74
 	}
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 	 */
95 95
 	public function getIsView()
96 96
 	{
97
-		return $this->getInfo('IsView',false);
97
+		return $this->getInfo('IsView', false);
98 98
 	}
99 99
 
100 100
 	/**
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 	 */
112 112
 	public function getColumn($name)
113 113
 	{
114
-		if(($column = $this->_columns->itemAt($name))!==null)
114
+		if(($column=$this->_columns->itemAt($name))!==null)
115 115
 			return $column;
116 116
 		throw new TDbException('dbtableinfo_invalid_column_name', $name, $this->getTableFullName());
117 117
 	}
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 	public function getColumnNames()
124 124
 	{
125 125
 		foreach($this->getColumns() as $column)
126
-			$names[] = $column->getColumnName();
126
+			$names[]=$column->getColumnName();
127 127
 		return $names;
128 128
 	}
129 129
 
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 		{
153 153
 			$this->_lowercase=array();
154 154
 			foreach($this->getColumns()->getKeys() as $key)
155
-				$this->_lowercase[strtolower($key)] = $key;
155
+				$this->_lowercase[strtolower($key)]=$key;
156 156
 		}
157 157
 		return $this->_lowercase;
158 158
 	}
Please login to merge, or discard this patch.
framework/Data/Common/Pgsql/TPgsqlTableInfo.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@
 block discarded – undo
48 48
 
49 49
 	/**
50 50
 	 * @param TDbConnection database connection.
51
-	 * @return TDbCommandBuilder new command builder
51
+	 * @return TPgsqlCommandBuilder new command builder
52 52
 	 */
53 53
 	public function createCommandBuilder($connection)
54 54
 	{
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@
 block discarded – undo
52 52
 	 */
53 53
 	public function createCommandBuilder($connection)
54 54
 	{
55
-		return new TPgsqlCommandBuilder($connection,$this);
55
+		return new TPgsqlCommandBuilder($connection, $this);
56 56
 	}
57 57
 }
58 58
 
Please login to merge, or discard this patch.
framework/Data/Common/Sqlite/TSqliteTableInfo.php 2 patches
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.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@
 block discarded – undo
33 33
 	 */
34 34
 	public function createCommandBuilder($connection)
35 35
 	{
36
-		return new TSqliteCommandBuilder($connection,$this);
36
+		return new TSqliteCommandBuilder($connection, $this);
37 37
 	}
38 38
 
39 39
 	/**
Please login to merge, or discard this patch.
framework/Data/DataGateway/TDataGatewayCommand.php 2 patches
Doc Comments   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -84,6 +84,7 @@  discard block
 block discarded – undo
84 84
 	 * Updates the table with new data.
85 85
 	 * @param array date for update.
86 86
 	 * @param TSqlCriteria update conditions and parameters.
87
+	 * @param TSqlCriteria $criteria
87 88
 	 * @return integer number of records affected.
88 89
 	 */
89 90
 	public function update($data, $criteria)
@@ -369,7 +370,8 @@  discard block
 block discarded – undo
369 370
 	 * @param string __call method name
370 371
 	 * @param string criteria conditions
371 372
 	 * @param array method arguments
372
-	 * @return TActiveRecordCriteria criteria created from the method name and its arguments.
373
+	 * @param string $condition
374
+	 * @return TSqlCriteria criteria created from the method name and its arguments.
373 375
 	 */
374 376
 	public function createCriteriaFromString($method, $condition, $args)
375 377
 	{
Please login to merge, or discard this patch.
Spacing   +95 added lines, -95 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 	 */
44 44
 	public function __construct($builder)
45 45
 	{
46
-		$this->_builder = $builder;
46
+		$this->_builder=$builder;
47 47
 	}
48 48
 	/**
49 49
 	 * @return TDbTableInfo
@@ -73,10 +73,10 @@  discard block
 block discarded – undo
73 73
 	 */
74 74
 	public function delete($criteria)
75 75
 	{
76
-		$where = $criteria->getCondition();
77
-		$parameters = $criteria->getParameters()->toArray();
78
-		$command = $this->getBuilder()->createDeleteCommand($where, $parameters);
79
-		$this->onCreateCommand($command,$criteria);
76
+		$where=$criteria->getCondition();
77
+		$parameters=$criteria->getParameters()->toArray();
78
+		$command=$this->getBuilder()->createDeleteCommand($where, $parameters);
79
+		$this->onCreateCommand($command, $criteria);
80 80
 		$command->prepare();
81 81
 		return $command->execute();
82 82
 	}
@@ -88,10 +88,10 @@  discard block
 block discarded – undo
88 88
 	 */
89 89
 	public function update($data, $criteria)
90 90
 	{
91
-		$where = $criteria->getCondition();
92
-		$parameters = $criteria->getParameters()->toArray();
93
-		$command = $this->getBuilder()->createUpdateCommand($data,$where, $parameters);
94
-		$this->onCreateCommand($command,$criteria);
91
+		$where=$criteria->getCondition();
92
+		$parameters=$criteria->getParameters()->toArray();
93
+		$command=$this->getBuilder()->createUpdateCommand($data, $where, $parameters);
94
+		$this->onCreateCommand($command, $criteria);
95 95
 		$command->prepare();
96 96
 		return $this->onExecuteCommand($command, $command->execute());
97 97
 	}
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 	 */
103 103
 	public function updateByPk($data, $keys)
104 104
 	{
105
-		list($where, $parameters) = $this->getPrimaryKeyCondition((array)$keys);
105
+		list($where, $parameters)=$this->getPrimaryKeyCondition((array) $keys);
106 106
 		return $this->update($data, new TSqlCriteria($where, $parameters));
107 107
 	}
108 108
 	/**
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 	 */
113 113
 	public function find($criteria)
114 114
 	{
115
-		$command = $this->getFindCommand($criteria);
115
+		$command=$this->getFindCommand($criteria);
116 116
 		return $this->onExecuteCommand($command, $command->queryRow());
117 117
 	}
118 118
 	/**
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 	 */
123 123
 	public function findAll($criteria)
124 124
 	{
125
-		$command = $this->getFindCommand($criteria);
125
+		$command=$this->getFindCommand($criteria);
126 126
 		return $this->onExecuteCommand($command, $command->query());
127 127
 	}
128 128
 	/**
@@ -134,13 +134,13 @@  discard block
 block discarded – undo
134 134
 	{
135 135
 		if($criteria===null)
136 136
 			return $this->getBuilder()->createFindCommand();
137
-		$where = $criteria->getCondition();
138
-		$parameters = $criteria->getParameters()->toArray();
139
-		$ordering = $criteria->getOrdersBy();
140
-		$limit = $criteria->getLimit();
141
-		$offset = $criteria->getOffset();
142
-		$select = $criteria->getSelect();
143
-		$command = $this->getBuilder()->createFindCommand($where,$parameters,$ordering,$limit,$offset,$select);
137
+		$where=$criteria->getCondition();
138
+		$parameters=$criteria->getParameters()->toArray();
139
+		$ordering=$criteria->getOrdersBy();
140
+		$limit=$criteria->getLimit();
141
+		$offset=$criteria->getOffset();
142
+		$select=$criteria->getSelect();
143
+		$command=$this->getBuilder()->createFindCommand($where, $parameters, $ordering, $limit, $offset, $select);
144 144
 		$this->onCreateCommand($command, $criteria);
145 145
 		return $command;
146 146
 	}
@@ -152,9 +152,9 @@  discard block
 block discarded – undo
152 152
 	{
153 153
 		if($keys===null)
154 154
 			return null;
155
-		list($where, $parameters) = $this->getPrimaryKeyCondition((array)$keys);
156
-		$command = $this->getBuilder()->createFindCommand($where, $parameters);
157
-		$this->onCreateCommand($command, new TSqlCriteria($where,$parameters));
155
+		list($where, $parameters)=$this->getPrimaryKeyCondition((array) $keys);
156
+		$command=$this->getBuilder()->createFindCommand($where, $parameters);
157
+		$this->onCreateCommand($command, new TSqlCriteria($where, $parameters));
158 158
 		return $this->onExecuteCommand($command, $command->queryRow());
159 159
 	}
160 160
 	/**
@@ -163,21 +163,21 @@  discard block
 block discarded – undo
163 163
 	 */
164 164
 	public function findAllByPk($keys)
165 165
 	{
166
-		$where = $this->getCompositeKeyCondition((array)$keys);
167
-		$command = $this->getBuilder()->createFindCommand($where);
168
-		$this->onCreateCommand($command, new TSqlCriteria($where,$keys));
169
-		return $this->onExecuteCommand($command,$command->query());
166
+		$where=$this->getCompositeKeyCondition((array) $keys);
167
+		$command=$this->getBuilder()->createFindCommand($where);
168
+		$this->onCreateCommand($command, new TSqlCriteria($where, $keys));
169
+		return $this->onExecuteCommand($command, $command->query());
170 170
 	}
171
-	public function findAllByIndex($criteria,$fields,$values)
171
+	public function findAllByIndex($criteria, $fields, $values)
172 172
 	{
173
-		$index = $this->getIndexKeyCondition($this->getTableInfo(),$fields,$values);
174
-		if(strlen($where = $criteria->getCondition())>0)
173
+		$index=$this->getIndexKeyCondition($this->getTableInfo(), $fields, $values);
174
+		if(strlen($where=$criteria->getCondition()) > 0)
175 175
 			$criteria->setCondition("({$index}) AND ({$where})");
176 176
 		else
177 177
 			$criteria->setCondition($index);
178
-		$command = $this->getFindCommand($criteria);
178
+		$command=$this->getFindCommand($criteria);
179 179
 		$this->onCreateCommand($command, $criteria);
180
-		return $this->onExecuteCommand($command,$command->query());
180
+		return $this->onExecuteCommand($command, $command->query());
181 181
 	}
182 182
 
183 183
 	/**
@@ -188,22 +188,22 @@  discard block
 block discarded – undo
188 188
 	{
189 189
 		if(count($keys)==0)
190 190
 			return 0;
191
-		$where = $this->getCompositeKeyCondition((array)$keys);
192
-		$command = $this->getBuilder()->createDeleteCommand($where);
193
-		$this->onCreateCommand($command, new TSqlCriteria($where,$keys));
191
+		$where=$this->getCompositeKeyCondition((array) $keys);
192
+		$command=$this->getBuilder()->createDeleteCommand($where);
193
+		$this->onCreateCommand($command, new TSqlCriteria($where, $keys));
194 194
 		$command->prepare();
195
-		return $this->onExecuteCommand($command,$command->execute());
195
+		return $this->onExecuteCommand($command, $command->execute());
196 196
 	}
197 197
 
198
-	public function getIndexKeyCondition($table,$fields,$values)
198
+	public function getIndexKeyCondition($table, $fields, $values)
199 199
 	{
200
-		if (!count($values))
200
+		if(!count($values))
201 201
 			return 'FALSE';
202
-		$columns = array();
203
-		$tableName = $table->getTableFullName();
202
+		$columns=array();
203
+		$tableName=$table->getTableFullName();
204 204
 		foreach($fields as $field)
205
-			$columns[] = $tableName.'.'.$table->getColumn($field)->getColumnName();
206
-		return '('.implode(', ',$columns).') IN '.$this->quoteTuple($values);
205
+			$columns[]=$tableName.'.'.$table->getColumn($field)->getColumnName();
206
+		return '('.implode(', ', $columns).') IN '.$this->quoteTuple($values);
207 207
 	}
208 208
 
209 209
 	/**
@@ -213,26 +213,26 @@  discard block
 block discarded – undo
213 213
 	 */
214 214
 	protected function getCompositeKeyCondition($values)
215 215
 	{
216
-		$primary = $this->getTableInfo()->getPrimaryKeys();
217
-		$count = count($primary);
216
+		$primary=$this->getTableInfo()->getPrimaryKeys();
217
+		$count=count($primary);
218 218
 		if($count===0)
219 219
 		{
220 220
 			throw new TDbException('dbtablegateway_no_primary_key_found',
221 221
 				$this->getTableInfo()->getTableFullName());
222 222
 		}
223
-		if(!is_array($values) || count($values) === 0)
223
+		if(!is_array($values) || count($values)===0)
224 224
 		{
225 225
 			throw new TDbException('dbtablegateway_missing_pk_values',
226 226
 				$this->getTableInfo()->getTableFullName());
227 227
 		}
228
-		if($count>1 && (!isset($values[0]) || !is_array($values[0])))
229
-			$values = array($values);
230
-		if($count > 1 && count($values[0]) !== $count)
228
+		if($count > 1 && (!isset($values[0]) || !is_array($values[0])))
229
+			$values=array($values);
230
+		if($count > 1 && count($values[0])!==$count)
231 231
 		{
232 232
 			throw new TDbException('dbtablegateway_pk_value_count_mismatch',
233 233
 				$this->getTableInfo()->getTableFullName());
234 234
 		}
235
-		return $this->getIndexKeyCondition($this->getTableInfo(),$primary, $values);
235
+		return $this->getIndexKeyCondition($this->getTableInfo(), $primary, $values);
236 236
 	}
237 237
 
238 238
 	/**
@@ -242,10 +242,10 @@  discard block
 block discarded – undo
242 242
 	 */
243 243
 	protected function quoteTuple($array)
244 244
 	{
245
-		$conn = $this->getDbConnection();
246
-		$data = array();
245
+		$conn=$this->getDbConnection();
246
+		$data=array();
247 247
 		foreach($array as $k=>$v)
248
-			$data[] = is_array($v) ? $this->quoteTuple($v) : $conn->quoteString($v);
248
+			$data[]=is_array($v) ? $this->quoteTuple($v) : $conn->quoteString($v);
249 249
 		return '('.implode(', ', $data).')';
250 250
 	}
251 251
 
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 	 */
257 257
 	protected function getPrimaryKeyCondition($values)
258 258
 	{
259
-		$primary = $this->getTableInfo()->getPrimaryKeys();
259
+		$primary=$this->getTableInfo()->getPrimaryKeys();
260 260
 		if(count($primary)===0)
261 261
 		{
262 262
 			throw new TDbException('dbtablegateway_no_primary_key_found',
@@ -264,12 +264,12 @@  discard block
 block discarded – undo
264 264
 		}
265 265
 		$criteria=array();
266 266
 		$bindings=array();
267
-		$i = 0;
267
+		$i=0;
268 268
 		foreach($primary as $key)
269 269
 		{
270
-			$column = $this->getTableInfo()->getColumn($key)->getColumnName();
271
-			$criteria[] = $column.' = :'.$key;
272
-			$bindings[$key] = isset($values[$key])?$values[$key]:$values[$i++];
270
+			$column=$this->getTableInfo()->getColumn($key)->getColumnName();
271
+			$criteria[]=$column.' = :'.$key;
272
+			$bindings[$key]=isset($values[$key]) ? $values[$key] : $values[$i++];
273 273
 		}
274 274
 		return array(implode(' AND ', $criteria), $bindings);
275 275
 	}
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
 	 */
282 282
 	public function findBySql($criteria)
283 283
 	{
284
-		$command = $this->getSqlCommand($criteria);
284
+		$command=$this->getSqlCommand($criteria);
285 285
 		return $this->onExecuteCommand($command, $command->queryRow());
286 286
 	}
287 287
 
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
 	 */
293 293
 	public function findAllBySql($criteria)
294 294
 	{
295
-		$command = $this->getSqlCommand($criteria);
295
+		$command=$this->getSqlCommand($criteria);
296 296
 		return $this->onExecuteCommand($command, $command->query());
297 297
 	}
298 298
 
@@ -303,15 +303,15 @@  discard block
 block discarded – undo
303 303
 	 */
304 304
 	protected function getSqlCommand($criteria)
305 305
 	{
306
-		$sql = $criteria->getCondition();
307
-		$ordering = $criteria->getOrdersBy();
308
-		$limit = $criteria->getLimit();
309
-		$offset = $criteria->getOffset();
306
+		$sql=$criteria->getCondition();
307
+		$ordering=$criteria->getOrdersBy();
308
+		$limit=$criteria->getLimit();
309
+		$offset=$criteria->getOffset();
310 310
 		if(count($ordering) > 0)
311
-			$sql = $this->getBuilder()->applyOrdering($sql, $ordering);
312
-		if($limit>=0 || $offset>=0)
313
-			$sql = $this->getBuilder()->applyLimitOffset($sql, $limit, $offset);
314
-		$command = $this->getBuilder()->createCommand($sql);
311
+			$sql=$this->getBuilder()->applyOrdering($sql, $ordering);
312
+		if($limit >= 0 || $offset >= 0)
313
+			$sql=$this->getBuilder()->applyLimitOffset($sql, $limit, $offset);
314
+		$command=$this->getBuilder()->createCommand($sql);
315 315
 		$this->getBuilder()->bindArrayValues($command, $criteria->getParameters()->toArray());
316 316
 		$this->onCreateCommand($command, $criteria);
317 317
 		return $command;
@@ -324,15 +324,15 @@  discard block
 block discarded – undo
324 324
 	public function count($criteria)
325 325
 	{
326 326
 		if($criteria===null)
327
-			return (int)$this->getBuilder()->createCountCommand()->queryScalar();
328
-		$where = $criteria->getCondition();
329
-		$parameters = $criteria->getParameters()->toArray();
330
-		$ordering = $criteria->getOrdersBy();
331
-		$limit = $criteria->getLimit();
332
-		$offset = $criteria->getOffset();
333
-		$command = $this->getBuilder()->createCountCommand($where,$parameters,$ordering,$limit,$offset);
327
+			return (int) $this->getBuilder()->createCountCommand()->queryScalar();
328
+		$where=$criteria->getCondition();
329
+		$parameters=$criteria->getParameters()->toArray();
330
+		$ordering=$criteria->getOrdersBy();
331
+		$limit=$criteria->getLimit();
332
+		$offset=$criteria->getOffset();
333
+		$command=$this->getBuilder()->createCountCommand($where, $parameters, $ordering, $limit, $offset);
334 334
 		$this->onCreateCommand($command, $criteria);
335
-		return $this->onExecuteCommand($command, (int)$command->queryScalar());
335
+		return $this->onExecuteCommand($command, (int) $command->queryScalar());
336 336
 	}
337 337
 
338 338
 	/**
@@ -345,12 +345,12 @@  discard block
 block discarded – undo
345 345
 	public function insert($data)
346 346
 	{
347 347
 		$command=$this->getBuilder()->createInsertCommand($data);
348
-		$this->onCreateCommand($command, new TSqlCriteria(null,$data));
348
+		$this->onCreateCommand($command, new TSqlCriteria(null, $data));
349 349
 		$command->prepare();
350 350
 		if($this->onExecuteCommand($command, $command->execute()) > 0)
351 351
 		{
352
-			$value = $this->getLastInsertId();
353
-			return $value !== null ? $value : true;
352
+			$value=$this->getLastInsertId();
353
+			return $value!==null ? $value : true;
354 354
 		}
355 355
 		return false;
356 356
 	}
@@ -373,14 +373,14 @@  discard block
 block discarded – undo
373 373
 	 */
374 374
 	public function createCriteriaFromString($method, $condition, $args)
375 375
 	{
376
-		$fields = $this->extractMatchingConditions($method, $condition);
377
-		$args=count($args) === 1 && is_array($args[0]) ? $args[0] : $args;
378
-		if(count($fields)>count($args))
376
+		$fields=$this->extractMatchingConditions($method, $condition);
377
+		$args=count($args)===1 && is_array($args[0]) ? $args[0] : $args;
378
+		if(count($fields) > count($args))
379 379
 		{
380 380
 			throw new TDbException('dbtablegateway_mismatch_args_exception',
381
-				$method,count($fields),count($args));
381
+				$method, count($fields), count($args));
382 382
 		}
383
-		return new TSqlCriteria(implode(' ',$fields), $args);
383
+		return new TSqlCriteria(implode(' ', $fields), $args);
384 384
 	}
385 385
 
386 386
 	/**
@@ -392,25 +392,25 @@  discard block
 block discarded – undo
392 392
 	 */
393 393
 	protected function extractMatchingConditions($method, $condition)
394 394
 	{
395
-		$table = $this->getTableInfo();
396
-		$columns = $table->getLowerCaseColumnNames();
397
-		$regexp = '/('.implode('|', array_keys($columns)).')(and|_and_|or|_or_)?/i';
398
-		$matches = array();
399
-		if(!preg_match_all($regexp, strtolower($condition), $matches,PREG_SET_ORDER))
395
+		$table=$this->getTableInfo();
396
+		$columns=$table->getLowerCaseColumnNames();
397
+		$regexp='/('.implode('|', array_keys($columns)).')(and|_and_|or|_or_)?/i';
398
+		$matches=array();
399
+		if(!preg_match_all($regexp, strtolower($condition), $matches, PREG_SET_ORDER))
400 400
 		{
401 401
 			throw new TDbException('dbtablegateway_mismatch_column_name',
402 402
 				$method, implode(', ', $columns), $table->getTableFullName());
403 403
 		}
404 404
 
405
-		$fields = array();
405
+		$fields=array();
406 406
 		foreach($matches as $match)
407 407
 		{
408
-			$key = $columns[$match[1]];
409
-			$column = $table->getColumn($key)->getColumnName();
410
-			$sql = $column . ' = ? ';
408
+			$key=$columns[$match[1]];
409
+			$column=$table->getColumn($key)->getColumnName();
410
+			$sql=$column.' = ? ';
411 411
 			if(count($match) > 2)
412
-				$sql .= strtoupper(str_replace('_', '', $match[2]));
413
-			$fields[] = $sql;
412
+				$sql.=strtoupper(str_replace('_', '', $match[2]));
413
+			$fields[]=$sql;
414 414
 		}
415 415
 		return $fields;
416 416
 	}
@@ -425,7 +425,7 @@  discard block
 block discarded – undo
425 425
 	 */
426 426
 	public function onCreateCommand($command, $criteria)
427 427
 	{
428
-		$this->raiseEvent('OnCreateCommand', $this, new TDataGatewayEventParameter($command,$criteria));
428
+		$this->raiseEvent('OnCreateCommand', $this, new TDataGatewayEventParameter($command, $criteria));
429 429
 	}
430 430
 
431 431
 	/**
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
 	 */
440 440
 	public function onExecuteCommand($command, $result)
441 441
 	{
442
-		$parameter = new TDataGatewayResultEventParameter($command, $result);
442
+		$parameter=new TDataGatewayResultEventParameter($command, $result);
443 443
 		$this->raiseEvent('OnExecuteCommand', $this, $parameter);
444 444
 		return $parameter->getResult();
445 445
 	}
Please login to merge, or discard this patch.
framework/Data/SqlMap/Configuration/TSqlMapCacheKey.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@
 block discarded – undo
33 33
 	}
34 34
 
35 35
 	/**
36
-	 * @param string serialized object
36
+	 * @param string string object
37 37
 	 * @return string crc32 hash of the serialized object.
38 38
 	 */
39 39
 	protected function generateKey($string)
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 	 */
30 30
 	public function __construct($object)
31 31
 	{
32
-		$this->_key = $this->generateKey(serialize($object));
32
+		$this->_key=$this->generateKey(serialize($object));
33 33
 	}
34 34
 
35 35
 	/**
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 	 */
39 39
 	protected function generateKey($string)
40 40
 	{
41
-		return sprintf('%x',crc32($string));
41
+		return sprintf('%x', crc32($string));
42 42
 	}
43 43
 
44 44
 	/**
Please login to merge, or discard this patch.
framework/Data/SqlMap/Configuration/TSqlMapCacheModel.php 2 patches
Doc Comments   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -149,6 +149,7 @@  discard block
 block discarded – undo
149 149
 
150 150
 	/**
151 151
 	 * @param TSqlMapCacheKey|string cache key
152
+	 * @param string $key
152 153
 	 * @return mixed cached value.
153 154
 	 */
154 155
 	public function get($key)
@@ -167,6 +168,7 @@  discard block
 block discarded – undo
167 168
 	/**
168 169
 	 * @param TSqlMapCacheKey|string cache key
169 170
 	 * @param mixed value to be cached.
171
+	 * @param string $key
170 172
 	 */
171 173
 	public function set($key, $value)
172 174
 	{
@@ -178,7 +180,7 @@  discard block
 block discarded – undo
178 180
 	}
179 181
 
180 182
 	/**
181
-	 * @return float cache hit ratio.
183
+	 * @return integer cache hit ratio.
182 184
 	 */
183 185
 	public function getHitRatio()
184 186
 	{
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -37,18 +37,18 @@  discard block
 block discarded – undo
37 37
 class TSqlMapCacheModel extends \Prado\TComponent
38 38
 {
39 39
 	private $_cache;
40
-	private $_hits = 0;
41
-	private $_requests = 0;
40
+	private $_hits=0;
41
+	private $_requests=0;
42 42
 	private $_id;
43 43
 	private $_implementation=TSqlMapCacheTypes::Basic;
44
-	private $_properties = array();
45
-	private $_flushInterval = 0;
44
+	private $_properties=array();
45
+	private $_flushInterval=0;
46 46
 
47
-	private static $_cacheTypes = array();
47
+	private static $_cacheTypes=array();
48 48
 
49 49
 	public static function registerCacheType($type, $className)
50 50
 	{
51
-		self::$_cacheTypes[$type] = $className;
51
+		self::$_cacheTypes[$type]=$className;
52 52
 	}
53 53
 
54 54
 	/**
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 	 */
65 65
 	public function setID($value)
66 66
 	{
67
-		$this->_id = $value;
67
+		$this->_id=$value;
68 68
 	}
69 69
 
70 70
 	/**
@@ -80,10 +80,10 @@  discard block
 block discarded – undo
80 80
 	 */
81 81
 	public function setImplementation($value)
82 82
 	{
83
-		if (isset(self::$_cacheTypes[$value]))
84
-			$this->_implementation = $value;
83
+		if(isset(self::$_cacheTypes[$value]))
84
+			$this->_implementation=$value;
85 85
 		else
86
-			$this->_implementation = TPropertyValue::ensureEnum($value,'Prado\\Data\\SqlMap\\Configuration\\TSqlMapCacheTypes');
86
+			$this->_implementation=TPropertyValue::ensureEnum($value, 'Prado\\Data\\SqlMap\\Configuration\\TSqlMapCacheTypes');
87 87
 	}
88 88
 
89 89
 	/**
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 	public function initialize($cache=null)
110 110
 	{
111 111
 		if($cache===null)
112
-			$this->_cache= Prado::createComponent($this->getImplementationClass(), $this);
112
+			$this->_cache=Prado::createComponent($this->getImplementationClass(), $this);
113 113
 		else
114 114
 			$this->_cache=$cache;
115 115
 	}
@@ -119,10 +119,10 @@  discard block
 block discarded – undo
119 119
 	 */
120 120
 	public function getImplementationClass()
121 121
 	{
122
-		$implementation = $this->_implementation;
123
-		if (isset(self::$_cacheTypes[$implementation])) return self::$_cacheTypes[$implementation];
122
+		$implementation=$this->_implementation;
123
+		if(isset(self::$_cacheTypes[$implementation])) return self::$_cacheTypes[$implementation];
124 124
 
125
-		switch(TPropertyValue::ensureEnum($implementation,'Prado\\Data\\SqlMap\\Configuration\\TSqlMapCacheTypes'))
125
+		switch(TPropertyValue::ensureEnum($implementation, 'Prado\\Data\\SqlMap\\Configuration\\TSqlMapCacheTypes'))
126 126
 		{
127 127
 			case TSqlMapCacheTypes::FIFO: return '\\Prado\\Data\\SqlMap\\DataMapper\\TSqlMapFifoCache';
128 128
 			case TSqlMapCacheTypes::LRU : return '\\Prado\\Data\\SqlMap\\DataMapper\\TSqlMapLruCache';
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 	 */
137 137
 	public function registerTriggerStatement($mappedStatement)
138 138
 	{
139
-		$mappedStatement->attachEventHandler('OnExecuteQuery',array($this, 'flush'));
139
+		$mappedStatement->attachEventHandler('OnExecuteQuery', array($this, 'flush'));
140 140
 	}
141 141
 
142 142
 	/**
@@ -154,10 +154,10 @@  discard block
 block discarded – undo
154 154
 	public function get($key)
155 155
 	{
156 156
 		if($key instanceof TSqlMapCacheKey)
157
-			$key = $key->getHash();
157
+			$key=$key->getHash();
158 158
 
159 159
 		//if flush ?
160
-		$value = $this->_cache->get($key);
160
+		$value=$this->_cache->get($key);
161 161
 		$this->_requests++;
162 162
 		if($value!==null)
163 163
 			$this->_hits++;
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 	public function set($key, $value)
172 172
 	{
173 173
 		if($key instanceof TSqlMapCacheKey)
174
-			$key = $key->getHash();
174
+			$key=$key->getHash();
175 175
 
176 176
 		if($value!==null)
177 177
 			$this->_cache->set($key, $value, $this->_flushInterval);
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 	 */
183 183
 	public function getHitRatio()
184 184
 	{
185
-		if($this->_requests != 0)
185
+		if($this->_requests!=0)
186 186
 			return $this->_hits / $this->_requests;
187 187
 		else
188 188
 			return 0;
Please login to merge, or discard this patch.