Completed
Push — prado-3.3 ( e90646...0b76d5 )
by Fabio
23:37 queued 03:01
created
framework/Data/ActiveRecord/Scaffold/InputBuilder/TScaffoldInputBase.php 2 patches
Doc Comments   +9 added lines patch added patch discarded remove patch
@@ -46,6 +46,10 @@  discard block
 block discarded – undo
46 46
 		}
47 47
 	}
48 48
 
49
+	/**
50
+	 * @param TScaffoldEditView $parent
51
+	 * @param TActiveRecord $record
52
+	 */
49 53
 	public function createScaffoldInput($parent, $item, $column, $record)
50 54
 	{
51 55
 		$this->_parent=$parent;
@@ -62,6 +66,11 @@  discard block
 block discarded – undo
62 66
 		$label->setForControl(self::DEFAULT_ID);
63 67
 	}
64 68
 
69
+	/**
70
+	 * @param TScaffoldEditView $parent
71
+	 * @param TDbTableColumn $column
72
+	 * @param TActiveRecord $record
73
+	 */
65 74
 	public function loadScaffoldInput($parent, $item, $column, $record)
66 75
 	{
67 76
 		$this->_parent=$parent;
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -21,51 +21,51 @@  discard block
 block discarded – undo
21 21
 	{
22 22
 		$record->getDbConnection()->setActive(true); //must be connected before retrieving driver name!
23 23
 		$driver = $record->getDbConnection()->getDriverName();
24
-		switch(strtolower($driver))
24
+		switch (strtolower($driver))
25 25
 		{
26 26
 			case 'sqlite': //sqlite 3
27 27
 			case 'sqlite2': //sqlite 2
28
-				require_once(dirname(__FILE__).'/TSqliteScaffoldInput.php');
28
+				require_once(dirname(__FILE__) . '/TSqliteScaffoldInput.php');
29 29
 				return new TSqliteScaffoldInput($conn);
30 30
 			case 'mysqli':
31 31
 			case 'mysql':
32
-				require_once(dirname(__FILE__).'/TMysqlScaffoldInput.php');
32
+				require_once(dirname(__FILE__) . '/TMysqlScaffoldInput.php');
33 33
 				return new TMysqlScaffoldInput($conn);
34 34
 			case 'pgsql':
35
-				require_once(dirname(__FILE__).'/TPgsqlScaffoldInput.php');
35
+				require_once(dirname(__FILE__) . '/TPgsqlScaffoldInput.php');
36 36
 				return new TPgsqlScaffoldInput($conn);
37 37
 			case 'mssql':
38
-				require_once(dirname(__FILE__).'/TMssqlScaffoldInput.php');
38
+				require_once(dirname(__FILE__) . '/TMssqlScaffoldInput.php');
39 39
 				return new TMssqlScaffoldInput($conn);
40 40
 			case 'ibm':
41
-				require_once(dirname(__FILE__).'/TIbmScaffoldInput.php');
41
+				require_once(dirname(__FILE__) . '/TIbmScaffoldInput.php');
42 42
 				return new TIbmScaffoldInput($conn);
43 43
 			default:
44 44
 				throw new TConfigurationException(
45
-					'scaffold_invalid_database_driver',$driver);
45
+					'scaffold_invalid_database_driver', $driver);
46 46
 		}
47 47
 	}
48 48
 
49 49
 	public function createScaffoldInput($parent, $item, $column, $record)
50 50
 	{
51
-		$this->_parent=$parent;
51
+		$this->_parent = $parent;
52 52
 		$item->setCustomData($column->getColumnId());
53 53
 		$this->createControl($item->_input, $column, $record);
54
-		if($item->_input->findControl(self::DEFAULT_ID))
54
+		if ($item->_input->findControl(self::DEFAULT_ID))
55 55
 			$this->createControlLabel($item->_label, $column, $record);
56 56
 	}
57 57
 
58 58
 	protected function createControlLabel($label, $column, $record)
59 59
 	{
60
-		$fieldname = ucwords(str_replace('_', ' ', $column->getColumnId())).':';
60
+		$fieldname = ucwords(str_replace('_', ' ', $column->getColumnId())) . ':';
61 61
 		$label->setText($fieldname);
62 62
 		$label->setForControl(self::DEFAULT_ID);
63 63
 	}
64 64
 
65 65
 	public function loadScaffoldInput($parent, $item, $column, $record)
66 66
 	{
67
-		$this->_parent=$parent;
68
-		if($this->getIsEnabled($column, $record))
67
+		$this->_parent = $parent;
68
+		if ($this->getIsEnabled($column, $record))
69 69
 		{
70 70
 			$prop = $column->getColumnId();
71 71
 			$record->setColumnValue($prop, $this->getControlValue($item->_input, $column, $record));
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 	protected function getRecordPropertyValue($column, $record)
82 82
 	{
83 83
 		$value = $record->getColumnValue($column->getColumnId());
84
-		if($column->getDefaultValue()!==TDbTableColumn::UNDEFINED_VALUE && $value===null)
84
+		if ($column->getDefaultValue() !== TDbTableColumn::UNDEFINED_VALUE && $value === null)
85 85
 			return $column->getDefaultValue();
86 86
 		else
87 87
 			return $value;
Please login to merge, or discard this patch.
framework/Data/ActiveRecord/Scaffold/InputBuilder/TScaffoldInputCommon.php 3 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -47,6 +47,9 @@
 block discarded – undo
47 47
 		return $control;
48 48
 	}
49 49
 
50
+	/**
51
+	 * @return string
52
+	 */
50 53
 	protected function getDefaultControlValue($container,$column, $record)
51 54
 	{
52 55
 		$control = $container->findControl(self::DEFAULT_ID);
Please login to merge, or discard this patch.
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 	protected function setNotNullProperty($container, $control, $column, $record)
22 22
 	{
23 23
 		$this->setDefaultProperty($container, $control, $column, $record);
24
-		if(!$column->getAllowNull() && !$column->hasSequence())
24
+		if (!$column->getAllowNull() && !$column->hasSequence())
25 25
 			$this->createRequiredValidator($container, $column, $record);
26 26
 	}
27 27
 
@@ -41,18 +41,18 @@  discard block
 block discarded – undo
41 41
 		$control = new TTextBox();
42 42
 		$control->setText($value);
43 43
 		$control->setCssClass('default-textbox scaffold_input');
44
-		if(($len=$column->getColumnSize())!==null)
44
+		if (($len = $column->getColumnSize()) !== null)
45 45
 			$control->setMaxLength($len);
46 46
 		$this->setNotNullProperty($container, $control, $column, $record);
47 47
 		return $control;
48 48
 	}
49 49
 
50
-	protected function getDefaultControlValue($container,$column, $record)
50
+	protected function getDefaultControlValue($container, $column, $record)
51 51
 	{
52 52
 		$control = $container->findControl(self::DEFAULT_ID);
53
-		if($control instanceof TCheckBox)
53
+		if ($control instanceof TCheckBox)
54 54
 			return $control->getChecked();
55
-		else if($control instanceof TControl)
55
+		else if ($control instanceof TControl)
56 56
 			return $control->getText();
57 57
 	}
58 58
 
@@ -73,8 +73,8 @@  discard block
 block discarded – undo
73 73
 		$control = new TDropDownList();
74 74
 		$years = array();
75 75
 		$current = intval(@date('Y'));
76
-		$from = $current-10; $to=$current+10;
77
-		for($i = $from; $i <= $to; $i++)
76
+		$from = $current - 10; $to = $current + 10;
77
+		for ($i = $from; $i <= $to; $i++)
78 78
 			$years[$i] = $i;
79 79
 		$control->setDataSource($years);
80 80
 		$control->setSelectedValue(empty($value) ? $current : $value);
@@ -98,13 +98,13 @@  discard block
 block discarded – undo
98 98
 		$val = $this->createTypeValidator($container, $column, $record);
99 99
 		$val->setDataType(TValidationDataType::Float);
100 100
 		$val->setErrorMessage('Please entery a decimal number.');
101
-		if(($max= $column->getMaxiumNumericConstraint())!==null)
101
+		if (($max = $column->getMaxiumNumericConstraint()) !== null)
102 102
 		{
103
-			$val = $this->createRangeValidator($container,$column,$record);
103
+			$val = $this->createRangeValidator($container, $column, $record);
104 104
 			$val->setDataType(TValidationDataType::Float);
105 105
 			$val->setMaxValue($max);
106 106
 			$val->setStrictComparison(true);
107
-			$val->setErrorMessage('Please entery a decimal number strictly less than '.$max.'.');
107
+			$val->setErrorMessage('Please entery a decimal number strictly less than ' . $max . '.');
108 108
 		}
109 109
 		return $control;
110 110
 	}
@@ -149,22 +149,22 @@  discard block
 block discarded – undo
149 149
 	protected function createTimeControl($container, $column, $record)
150 150
 	{
151 151
 		$value = $this->getRecordPropertyValue($column, $record);
152
-		$hours=array();
153
-		for($i=0;$i<24;$i++) $hours[] = str_pad($i,2,'0',STR_PAD_LEFT);
154
-		$mins=array();
155
-		for($i=0;$i<60;$i++) $mins[] = str_pad($i,2,'0',STR_PAD_LEFT);
152
+		$hours = array();
153
+		for ($i = 0; $i < 24; $i++) $hours[] = str_pad($i, 2, '0', STR_PAD_LEFT);
154
+		$mins = array();
155
+		for ($i = 0; $i < 60; $i++) $mins[] = str_pad($i, 2, '0', STR_PAD_LEFT);
156 156
 		$hour = intval(@date('H'));
157 157
 		$min = intval(@date('i'));
158 158
 		$sec = intval(@date('s'));
159
-		if(!empty($value))
159
+		if (!empty($value))
160 160
 		{
161
-			$match=array();
162
-			if(preg_match('/(\d+):(\d+):?(\d+)?/', $value, $match))
161
+			$match = array();
162
+			if (preg_match('/(\d+):(\d+):?(\d+)?/', $value, $match))
163 163
 			{
164 164
 				$hour = $match[1];
165 165
 				$min = $match[2];
166
-				if(isset($match[3]))
167
-					$sec=$match[3];
166
+				if (isset($match[3]))
167
+					$sec = $match[3];
168 168
 			}
169 169
 		}
170 170
 
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 		$scontrol->setSelectedValue(intval($sec));
192 192
 		$container->Controls[] = $scontrol;
193 193
 
194
-		return array($hcontrol,$mcontrol,$scontrol);
194
+		return array($hcontrol, $mcontrol, $scontrol);
195 195
 	}
196 196
 
197 197
 
@@ -202,8 +202,8 @@  discard block
 block discarded – undo
202 202
 		$control->setFromYear(1900);
203 203
 		$control->setInputMode(TDatePickerInputMode::DropDownList);
204 204
 		$control->setDateFormat('yyyy-MM-dd');
205
-		if(!empty($value))
206
-			$control->setDate(substr($value,0,10));
205
+		if (!empty($value))
206
+			$control->setDate(substr($value, 0, 10));
207 207
 		$control->setCssClass('date-dropdown');
208 208
 		$this->setNotNullProperty($container, $control, $column, $record);
209 209
 		return $control;
@@ -215,14 +215,14 @@  discard block
 block discarded – undo
215 215
 		$control = $this->createDateControl($container, $column, $record);
216 216
 		$container->Controls[] = ' @ ';
217 217
 		$time = $this->createTimeControl($container, $column, $record);
218
-		if(!empty($value))
218
+		if (!empty($value))
219 219
 		{
220
-			$match=array();
221
-			if(preg_match('/(\d+):(\d+):?(\d+)?/', substr($value, 11), $match))
220
+			$match = array();
221
+			if (preg_match('/(\d+):(\d+):?(\d+)?/', substr($value, 11), $match))
222 222
 			{
223 223
 				$time[0]->setSelectedValue(intval($match[1]));
224 224
 				$time[1]->setSelectedValue(intval($match[2]));
225
-				if(isset($match[3]))
225
+				if (isset($match[3]))
226 226
 					$time[2]->setSelectedValue(intval($match[3]));
227 227
 			}
228 228
 		}
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 		$values = $column->getDbTypeValues();
256 256
 		$control->setDataSource($values);
257 257
 		$control->dataBind();
258
-		$control->setSelectedIndices($this->getMatchingIndices($values,$selectedValues));
258
+		$control->setSelectedIndices($this->getMatchingIndices($values, $selectedValues));
259 259
 		$control->setID(self::DEFAULT_ID);
260 260
 		$control->setCssClass('set-checkboxes');
261 261
 		$this->setNotNullProperty($container, $control, $column, $record);
@@ -264,10 +264,10 @@  discard block
 block discarded – undo
264 264
 
265 265
 	protected function getMatchingIndices($checks, $values)
266 266
 	{
267
-		$index=array();
268
-		for($i=0, $k=count($checks); $i<$k; $i++)
267
+		$index = array();
268
+		for ($i = 0, $k = count($checks); $i < $k; $i++)
269 269
 		{
270
-			if(in_array($checks[$i], $values))
270
+			if (in_array($checks[$i], $values))
271 271
 				$index[] = $i;
272 272
 		}
273 273
 		return $index;
@@ -281,8 +281,8 @@  discard block
 block discarded – undo
281 281
 		$values = $column->getDbTypeValues();
282 282
 		$control->setDataSource($values);
283 283
 		$control->dataBind();
284
-		$index = $this->getMatchingIndices($values,$selectedValues);
285
-		if(count($index) > 0)
284
+		$index = $this->getMatchingIndices($values, $selectedValues);
285
+		if (count($index) > 0)
286 286
 			$control->setSelectedIndex($index[0]);
287 287
 		$control->setID(self::DEFAULT_ID);
288 288
 		$control->setCssClass('enum-radio-buttons');
@@ -292,10 +292,10 @@  discard block
 block discarded – undo
292 292
 
293 293
 	protected function getSetValue($container, $column, $record)
294 294
 	{
295
-		$value=array();
296
-		foreach($container->findControl(self::DEFAULT_ID)->getItems() as $item)
295
+		$value = array();
296
+		foreach ($container->findControl(self::DEFAULT_ID)->getItems() as $item)
297 297
 		{
298
-			if($item->getSelected())
298
+			if ($item->getSelected())
299 299
 				$value[] = $item->getText();
300 300
 		}
301 301
 		return implode(',', $value);
Please login to merge, or discard this patch.
Braces   +9 added lines, -4 removed lines patch added patch discarded remove patch
@@ -74,8 +74,9 @@  discard block
 block discarded – undo
74 74
 		$years = array();
75 75
 		$current = intval(@date('Y'));
76 76
 		$from = $current-10; $to=$current+10;
77
-		for($i = $from; $i <= $to; $i++)
78
-			$years[$i] = $i;
77
+		for($i = $from; $i <= $to; $i++) {
78
+					$years[$i] = $i;
79
+		}
79 80
 		$control->setDataSource($years);
80 81
 		$control->setSelectedValue(empty($value) ? $current : $value);
81 82
 		$control->setCssClass('year-dropdown');
@@ -150,9 +151,13 @@  discard block
 block discarded – undo
150 151
 	{
151 152
 		$value = $this->getRecordPropertyValue($column, $record);
152 153
 		$hours=array();
153
-		for($i=0;$i<24;$i++) $hours[] = str_pad($i,2,'0',STR_PAD_LEFT);
154
+		for($i=0;$i<24;$i++) {
155
+			$hours[] = str_pad($i,2,'0',STR_PAD_LEFT);
156
+		}
154 157
 		$mins=array();
155
-		for($i=0;$i<60;$i++) $mins[] = str_pad($i,2,'0',STR_PAD_LEFT);
158
+		for($i=0;$i<60;$i++) {
159
+			$mins[] = str_pad($i,2,'0',STR_PAD_LEFT);
160
+		}
156 161
 		$hour = intval(@date('H'));
157 162
 		$min = intval(@date('i'));
158 163
 		$sec = intval(@date('s'));
Please login to merge, or discard this patch.
framework/Data/ActiveRecord/Scaffold/TScaffoldEditView.php 3 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -129,6 +129,8 @@  discard block
 block discarded – undo
129 129
 	 * Instantiate the external edit renderer.
130 130
 	 * @param TActiveRecord record to be edited
131 131
 	 * @param string external edit renderer class name.
132
+	 * @param TActiveRecord $record
133
+	 * @param string $classPath
132 134
 	 * @throws TConfigurationException raised when renderer is not an
133 135
 	 * instance of IScaffoldEditRenderer.
134 136
 	 */
@@ -260,6 +262,7 @@  discard block
 block discarded – undo
260 262
 	/**
261 263
 	 * Create the default scaffold editor control factory.
262 264
 	 * @param TActiveRecord record instance.
265
+	 * @param TActiveRecord $record
263 266
 	 * @return TScaffoldInputBase scaffold editor control factory.
264 267
 	 */
265 268
 	protected function getScaffoldInputBuilder($record)
@@ -300,6 +303,7 @@  discard block
 block discarded – undo
300 303
 	/**
301 304
 	 * This method should update the record with the user input data.
302 305
 	 * @param TActiveRecord record to be saved.
306
+	 * @param TActiveRecord $record
303 307
 	 */
304 308
 	public function updateRecord($record);
305 309
 }
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 	 */
58 58
 	public function onLoad($param)
59 59
 	{
60
-		if($this->getVisible())
60
+		if ($this->getVisible())
61 61
 			$this->initializeEditForm();
62 62
 	}
63 63
 
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 	{
111 111
 		$record = $this->getCurrentRecord();
112 112
 		$classPath = $this->getEditRenderer();
113
-		if($classPath === '')
113
+		if ($classPath === '')
114 114
 		{
115 115
 			$columns = $this->getTableInfo()->getColumns();
116 116
 			$this->getInputRepeater()->setDataSource($columns);
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 		}
119 119
 		else
120 120
 		{
121
-			if($this->_editRenderer===null)
121
+			if ($this->_editRenderer === null)
122 122
 				$this->createEditRenderer($record, $classPath);
123 123
 			else
124 124
 				$this->_editRenderer->setData($record);
@@ -135,10 +135,10 @@  discard block
 block discarded – undo
135 135
 	protected function createEditRenderer($record, $classPath)
136 136
 	{
137 137
 		$this->_editRenderer = Prado::createComponent($classPath);
138
-		if($this->_editRenderer instanceof IScaffoldEditRenderer)
138
+		if ($this->_editRenderer instanceof IScaffoldEditRenderer)
139 139
 		{
140 140
 			$index = $this->getControls()->remove($this->getInputRepeater());
141
-			$this->getControls()->insertAt($index,$this->_editRenderer);
141
+			$this->getControls()->insertAt($index, $this->_editRenderer);
142 142
 			$this->_editRenderer->setData($record);
143 143
 		}
144 144
 		else
@@ -154,11 +154,11 @@  discard block
 block discarded – undo
154 154
 	protected function createRepeaterEditItem($sender, $param)
155 155
 	{
156 156
 		$type = $param->getItem()->getItemType();
157
-		if($type==TListItemType::Item || $type==TListItemType::AlternatingItem)
157
+		if ($type == TListItemType::Item || $type == TListItemType::AlternatingItem)
158 158
 		{
159 159
 			$item = $param->getItem();
160 160
 			$column = $item->getDataItem();
161
-			if($column===null)
161
+			if ($column === null)
162 162
 				return;
163 163
 
164 164
 			$record = $this->getCurrentRecord();
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 	 */
174 174
 	public function bubbleEvent($sender, $param)
175 175
 	{
176
-		switch(strtolower($param->getCommandName()))
176
+		switch (strtolower($param->getCommandName()))
177 177
 		{
178 178
 			case 'save':
179 179
 				return $this->doSave() ? false : true;
@@ -192,14 +192,14 @@  discard block
 block discarded – undo
192 192
 	 */
193 193
 	protected function doSave()
194 194
 	{
195
-		if($this->getPage()->getIsValid())
195
+		if ($this->getPage()->getIsValid())
196 196
 		{
197 197
 			$record = $this->getCurrentRecord();
198
-			if($this->_editRenderer===null)
198
+			if ($this->_editRenderer === null)
199 199
 			{
200 200
 				$table = $this->getTableInfo();
201 201
 				$builder = $this->getScaffoldInputBuilder($record);
202
-				foreach($this->getInputRepeater()->getItems() as $item)
202
+				foreach ($this->getInputRepeater()->getItems() as $item)
203 203
 				{
204 204
 					$column = $table->getColumn($item->getCustomData());
205 205
 					$builder->loadScaffoldInput($this, $item, $column, $record);
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 			$record->save();
213 213
 			return true;
214 214
 		}
215
-		else if($this->_editRenderer!==null)
215
+		else if ($this->_editRenderer !== null)
216 216
 		{
217 217
 			//preserve the form data.
218 218
 			$this->_editRenderer->updateRecord($this->getCurrentRecord());
@@ -264,9 +264,9 @@  discard block
 block discarded – undo
264 264
 	 */
265 265
 	protected function getScaffoldInputBuilder($record)
266 266
 	{
267
-		static $_builders=array();
267
+		static $_builders = array();
268 268
 		$class = get_class($record);
269
-		if(!isset($_builders[$class]))
269
+		if (!isset($_builders[$class]))
270 270
 		{
271 271
 			Prado::using('System.Data.ActiveRecord.Scaffold.InputBuilder.TScaffoldInputBase');
272 272
 			$_builders[$class] = TScaffoldInputBase::createInputBuilder($record);
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 	 */
280 280
 	public function getValidationGroup()
281 281
 	{
282
-		return 'group_'.$this->getUniqueID();
282
+		return 'group_' . $this->getUniqueID();
283 283
 	}
284 284
 }
285 285
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -115,8 +115,7 @@  discard block
 block discarded – undo
115 115
 			$columns = $this->getTableInfo()->getColumns();
116 116
 			$this->getInputRepeater()->setDataSource($columns);
117 117
 			$this->getInputRepeater()->dataBind();
118
-		}
119
-		else
118
+		} else
120 119
 		{
121 120
 			if($this->_editRenderer===null)
122 121
 				$this->createEditRenderer($record, $classPath);
@@ -140,8 +139,7 @@  discard block
 block discarded – undo
140 139
 			$index = $this->getControls()->remove($this->getInputRepeater());
141 140
 			$this->getControls()->insertAt($index,$this->_editRenderer);
142 141
 			$this->_editRenderer->setData($record);
143
-		}
144
-		else
142
+		} else
145 143
 		{
146 144
 			throw new TConfigurationException(
147 145
 				'scaffold_invalid_edit_renderer', $this->getID(), get_class($record));
@@ -204,15 +202,13 @@  discard block
 block discarded – undo
204 202
 					$column = $table->getColumn($item->getCustomData());
205 203
 					$builder->loadScaffoldInput($this, $item, $column, $record);
206 204
 				}
207
-			}
208
-			else
205
+			} else
209 206
 			{
210 207
 				$this->_editRenderer->updateRecord($record);
211 208
 			}
212 209
 			$record->save();
213 210
 			return true;
214
-		}
215
-		else if($this->_editRenderer!==null)
211
+		} else if($this->_editRenderer!==null)
216 212
 		{
217 213
 			//preserve the form data.
218 214
 			$this->_editRenderer->updateRecord($this->getCurrentRecord());
Please login to merge, or discard this patch.
framework/Data/ActiveRecord/Scaffold/TScaffoldListView.php 2 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -121,6 +121,7 @@
 block discarded – undo
121 121
 
122 122
 	/**
123 123
 	 * @param string search condition, the SQL string after the WHERE clause.
124
+	 * @param string|null $value
124 125
 	 */
125 126
 	public function setSearchCondition($value)
126 127
 	{
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -54,14 +54,14 @@  discard block
 block discarded – undo
54 54
 	protected function initializeSort()
55 55
 	{
56 56
 		$table = $this->getTableInfo();
57
-		$sorts = array('Sort By', str_repeat('-',15));
57
+		$sorts = array('Sort By', str_repeat('-', 15));
58 58
 		$headers = array();
59
-		foreach($table->getColumns() as $name=>$colum)
59
+		foreach ($table->getColumns() as $name=>$colum)
60 60
 		{
61 61
 			$fname = ucwords(str_replace('_', ' ', $name));
62
-			$sorts[$name.' ASC'] = $fname .' Ascending';
63
-			$sorts[$name.' DESC'] = $fname .' Descending';
64
-			$headers[] = $fname ;
62
+			$sorts[$name . ' ASC'] = $fname . ' Ascending';
63
+			$sorts[$name . ' DESC'] = $fname . ' Descending';
64
+			$headers[] = $fname;
65 65
 		}
66 66
 		$this->_sort->setDataSource($sorts);
67 67
 		$this->_sort->dataBind();
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 	public function onPreRender($param)
76 76
 	{
77 77
 		parent::onPreRender($param);
78
-		if(!$this->getPage()->getIsPostBack() || $this->getViewState('CurrentClass')!=$this->getRecordClass())
78
+		if (!$this->getPage()->getIsPostBack() || $this->getViewState('CurrentClass') != $this->getRecordClass())
79 79
 		{
80 80
 			$this->initializeSort();
81 81
 			$this->setViewState('CurrentClass', $this->getRecordClass());
@@ -103,18 +103,18 @@  discard block
 block discarded – undo
103 103
 	{
104 104
 		$total = $this->_list->getVirtualItemCount();
105 105
 		$limit = $this->_list->getPageSize();
106
-		$offset = $this->_list->getCurrentPageIndex()*$limit;
107
-		if($offset + $limit > $total)
106
+		$offset = $this->_list->getCurrentPageIndex() * $limit;
107
+		if ($offset + $limit > $total)
108 108
 			$limit = $total - $offset;
109 109
 		$criteria = new TActiveRecordCriteria($this->getSearchCondition(), $this->getSearchParameters());
110
-		if($limit > 0)
110
+		if ($limit > 0)
111 111
 		{
112 112
 			$criteria->setLimit($limit);
113
-			if($offset <= $total)
113
+			if ($offset <= $total)
114 114
 				$criteria->setOffset($offset);
115 115
 		}
116
-		$order = explode(' ',$this->_sort->getSelectedValue(), 2);
117
-		if(is_array($order) && count($order) === 2)
116
+		$order = explode(' ', $this->_sort->getSelectedValue(), 2);
117
+		if (is_array($order) && count($order) === 2)
118 118
 			$criteria->OrdersBy[$order[0]] = $order[1];
119 119
 		return $criteria;
120 120
 	}
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 	 */
141 141
 	public function setSearchParameters($value)
142 142
 	{
143
-		$this->setViewState('SearchParameters', TPropertyValue::ensureArray($value),array());
143
+		$this->setViewState('SearchParameters', TPropertyValue::ensureArray($value), array());
144 144
 	}
145 145
 
146 146
 	/**
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 	 */
157 157
 	public function bubbleEvent($sender, $param)
158 158
 	{
159
-		switch(strtolower($param->getCommandName()))
159
+		switch (strtolower($param->getCommandName()))
160 160
 		{
161 161
 			case 'delete':
162 162
 				return $this->deleteRecord($sender, $param);
@@ -172,9 +172,9 @@  discard block
 block discarded – undo
172 172
 	 */
173 173
 	protected function initializeEdit($sender, $param)
174 174
 	{
175
-		if(($ctrl=$this->getEditViewControl())!==null)
175
+		if (($ctrl = $this->getEditViewControl()) !== null)
176 176
 		{
177
-			if($param instanceof TRepeaterCommandEventParameter)
177
+			if ($param instanceof TRepeaterCommandEventParameter)
178 178
 			{
179 179
 				$pk = $param->getItem()->getCustomData();
180 180
 				$ctrl->setRecordPk($pk);
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 	 */
189 189
 	protected function deleteRecord($sender, $param)
190 190
 	{
191
-		if($param instanceof TRepeaterCommandEventParameter)
191
+		if ($param instanceof TRepeaterCommandEventParameter)
192 192
 		{
193 193
 			$pk = $param->getItem()->getCustomData();
194 194
 			$this->getRecordFinder()->deleteByPk($pk);
@@ -201,10 +201,10 @@  discard block
 block discarded – undo
201 201
 	protected function listItemCreated($sender, $param)
202 202
 	{
203 203
 		$item = $param->getItem();
204
-		if($item instanceof IItemDataRenderer)
204
+		if ($item instanceof IItemDataRenderer)
205 205
 		{
206 206
 			$type = $item->getItemType();
207
-			if($type==TListItemType::Item || $type==TListItemType::AlternatingItem)
207
+			if ($type == TListItemType::Item || $type == TListItemType::AlternatingItem)
208 208
 				$this->populateField($sender, $param);
209 209
 		}
210 210
 	}
@@ -216,10 +216,10 @@  discard block
 block discarded – undo
216 216
 	protected function populateField($sender, $param)
217 217
 	{
218 218
 		$item = $param->getItem();
219
-		if(($data = $item->getData()) !== null)
219
+		if (($data = $item->getData()) !== null)
220 220
 		{
221 221
 			$item->setCustomData($this->getRecordPkValues($data));
222
-			if(($prop = $item->findControl('_properties'))!==null)
222
+			if (($prop = $item->findControl('_properties')) !== null)
223 223
 			{
224 224
 				$item->_properties->setDataSource($this->getRecordPropertyValues($data));
225 225
 				$item->_properties->dataBind();
@@ -292,10 +292,10 @@  discard block
 block discarded – undo
292 292
 	 */
293 293
 	protected function getEditViewControl()
294 294
 	{
295
-		if(($id=$this->getEditViewID())!==null)
295
+		if (($id = $this->getEditViewID()) !== null)
296 296
 		{
297 297
 			$ctrl = $this->getParent()->findControl($id);
298
-			if($ctrl===null)
298
+			if ($ctrl === null)
299 299
 				throw new TConfigurationException('scaffold_unable_to_find_edit_view', $id);
300 300
 			return $ctrl;
301 301
 		}
Please login to merge, or discard this patch.
framework/Data/ActiveRecord/TActiveRecordGateway.php 3 patches
Doc Comments   +7 added lines, -3 removed lines patch added patch discarded remove patch
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 	 * Returns records matching the list of given primary keys.
202 202
 	 * @param TActiveRecord active record instance.
203 203
 	 * @param array list of primary name value pairs
204
-	 * @return array matching data.
204
+	 * @return TDbDataReader matching data.
205 205
 	 */
206 206
 	public function findRecordsByPks(TActiveRecord $record, $keys)
207 207
 	{
@@ -227,7 +227,8 @@  discard block
 block discarded – undo
227 227
 	 * Return record data from sql query.
228 228
 	 * @param TActiveRecord active record finder instance.
229 229
 	 * @param TActiveRecordCriteria sql query
230
-	 * @return array result.
230
+	 * @param TSqlCriteria $criteria
231
+	 * @return TDbDataReader result.
231 232
 	 */
232 233
 	public function findRecordBySql(TActiveRecord $record, $criteria)
233 234
 	{
@@ -238,6 +239,7 @@  discard block
 block discarded – undo
238 239
 	 * Return record data from sql query.
239 240
 	 * @param TActiveRecord active record finder instance.
240 241
 	 * @param TActiveRecordCriteria sql query
242
+	 * @param TSqlCriteria $criteria
241 243
 	 * @return TDbDataReader result iterator.
242 244
 	 */
243 245
 	public function findRecordsBySql(TActiveRecord $record, $criteria)
@@ -264,7 +266,7 @@  discard block
 block discarded – undo
264 266
 	/**
265 267
 	 * Insert a new record.
266 268
 	 * @param TActiveRecord new record.
267
-	 * @return int number of rows affected.
269
+	 * @return string|boolean number of rows affected.
268 270
 	 */
269 271
 	public function insert(TActiveRecord $record)
270 272
 	{
@@ -279,6 +281,7 @@  discard block
 block discarded – undo
279 281
 	/**
280 282
 	 * Sets the last insert ID to the corresponding property of the record if available.
281 283
 	 * @param TActiveRecord record for insertion
284
+	 * @param TActiveRecord $record
282 285
 	 */
283 286
 	protected function updatePostInsert($record)
284 287
 	{
@@ -396,6 +399,7 @@  discard block
 block discarded – undo
396 399
 	 * Delete multiple records by criteria.
397 400
 	 * @param TActiveRecord active record finder instance.
398 401
 	 * @param TActiveRecordCriteria search criteria
402
+	 * @param TSqlCriteria $criteria
399 403
 	 * @return int number of records.
400 404
 	 */
401 405
 	public function deleteRecordsByCriteria(TActiveRecord $record, $criteria)
Please login to merge, or discard this patch.
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -20,19 +20,19 @@  discard block
 block discarded – undo
20 20
 class TActiveRecordGateway extends TComponent
21 21
 {
22 22
 	private $_manager;
23
-	private $_tables=array(); //table cache
24
-	private $_meta=array(); //meta data cache.
25
-	private $_commandBuilders=array();
23
+	private $_tables = array(); //table cache
24
+	private $_meta = array(); //meta data cache.
25
+	private $_commandBuilders = array();
26 26
 	private $_currentRecord;
27 27
 
28 28
 	/**
29 29
 	 * Constant name for specifying optional table name in TActiveRecord.
30 30
 	 */
31
-	const TABLE_CONST='TABLE';
31
+	const TABLE_CONST = 'TABLE';
32 32
 	/**
33 33
 	 * Method name for returning optional table name in in TActiveRecord
34 34
 	 */
35
-	const TABLE_METHOD='table';
35
+	const TABLE_METHOD = 'table';
36 36
 
37 37
 	/**
38 38
 	 * Record gateway constructor.
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 	 */
41 41
 	public function __construct(TActiveRecordManager $manager)
42 42
 	{
43
-		$this->_manager=$manager;
43
+		$this->_manager = $manager;
44 44
 	}
45 45
 
46 46
 	/**
@@ -60,20 +60,20 @@  discard block
 block discarded – undo
60 60
 	protected function getRecordTableName(TActiveRecord $record)
61 61
 	{
62 62
 		$class = new ReflectionClass($record);
63
-		if($class->hasConstant(self::TABLE_CONST))
63
+		if ($class->hasConstant(self::TABLE_CONST))
64 64
 		{
65 65
 			$value = $class->getConstant(self::TABLE_CONST);
66
-			if(empty($value))
66
+			if (empty($value))
67 67
 				throw new TActiveRecordException('ar_invalid_tablename_property',
68
-					get_class($record),self::TABLE_CONST);
68
+					get_class($record), self::TABLE_CONST);
69 69
 			return $value;
70 70
 		}
71 71
 		elseif ($class->hasMethod(self::TABLE_METHOD))
72 72
 		{
73 73
 			$value = $record->{self::TABLE_METHOD}();
74
-			if(empty($value))
74
+			if (empty($value))
75 75
 				throw new TActiveRecordException('ar_invalid_tablename_method',
76
-					get_class($record),self::TABLE_METHOD);
76
+					get_class($record), self::TABLE_METHOD);
77 77
 			return $value;
78 78
 		}
79 79
 		else
@@ -100,24 +100,24 @@  discard block
 block discarded – undo
100 100
 	public function getTableInfo(TDbConnection $connection, $tableName)
101 101
 	{
102 102
 		$connStr = $connection->getConnectionString();
103
-		$key = $connStr.$tableName;
104
-		if(!isset($this->_tables[$key]))
103
+		$key = $connStr . $tableName;
104
+		if (!isset($this->_tables[$key]))
105 105
 		{
106 106
 			//call this first to ensure that unserializing the cache
107 107
 			//will find the correct driver dependent classes.
108
-			if(!isset($this->_meta[$connStr]))
108
+			if (!isset($this->_meta[$connStr]))
109 109
 			{
110 110
 				Prado::using('System.Data.Common.TDbMetaData');
111 111
 				$this->_meta[$connStr] = TDbMetaData::getInstance($connection);
112 112
 			}
113 113
 
114 114
 			$tableInfo = null;
115
-			if(($cache=$this->getManager()->getCache())!==null)
115
+			if (($cache = $this->getManager()->getCache()) !== null)
116 116
 				$tableInfo = $cache->get($key);
117
-			if(empty($tableInfo))
117
+			if (empty($tableInfo))
118 118
 			{
119 119
 				$tableInfo = $this->_meta[$connStr]->getTableInfo($tableName);
120
-				if($cache!==null)
120
+				if ($cache !== null)
121 121
 					$cache->set($key, $tableInfo);
122 122
 			}
123 123
 			$this->_tables[$key] = $tableInfo;
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 		$conn = $record->getDbConnection();
135 135
 		$connStr = $conn->getConnectionString();
136 136
 		$tableInfo = $this->getRecordTableInfo($record);
137
-		if(!isset($this->_commandBuilders[$connStr]))
137
+		if (!isset($this->_commandBuilders[$connStr]))
138 138
 		{
139 139
 			$builder = $tableInfo->createCommandBuilder($record->getDbConnection());
140 140
 			Prado::using('System.Data.DataGateway.TDataGatewayCommand');
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 
146 146
 		}
147 147
 		$this->_commandBuilders[$connStr]->getBuilder()->setTableInfo($tableInfo);
148
-		$this->_currentRecord=$record;
148
+		$this->_currentRecord = $record;
149 149
 		return $this->_commandBuilders[$connStr];
150 150
 	}
151 151
 
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 	public function onCreateCommand($sender, $param)
163 163
 	{
164 164
 		$this->raiseEvent('OnCreateCommand', $this, $param);
165
-		if($this->_currentRecord!==null)
165
+		if ($this->_currentRecord !== null)
166 166
 			$this->_currentRecord->onCreateCommand($param);
167 167
 	}
168 168
 
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 	public function onExecuteCommand($sender, $param)
181 181
 	{
182 182
 		$this->raiseEvent('OnExecuteCommand', $this, $param);
183
-		if($this->_currentRecord!==null)
183
+		if ($this->_currentRecord !== null)
184 184
 			$this->_currentRecord->onExecuteCommand($param);
185 185
 	}
186 186
 
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 	 * @param array primary name value pairs
192 192
 	 * @return array record data
193 193
 	 */
194
-	public function findRecordByPK(TActiveRecord $record,$keys)
194
+	public function findRecordByPK(TActiveRecord $record, $keys)
195 195
 	{
196 196
 		$command = $this->getCommand($record);
197 197
 		return $command->findByPk($keys);
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 	 * @param boolean true to return multiple rows as iterator, false returns first row.
218 218
 	 * @return mixed matching data.
219 219
 	 */
220
-	public function findRecordsByCriteria(TActiveRecord $record, $criteria, $iterator=false)
220
+	public function findRecordsByCriteria(TActiveRecord $record, $criteria, $iterator = false)
221 221
 	{
222 222
 		$command = $this->getCommand($record);
223 223
 		return $iterator ? $command->findAll($criteria) : $command->find($criteria);
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
 
248 248
 	public function findRecordsByIndex(TActiveRecord $record, $criteria, $fields, $values)
249 249
 	{
250
-		return $this->getCommand($record)->findAllByIndex($criteria,$fields,$values);
250
+		return $this->getCommand($record)->findAllByIndex($criteria, $fields, $values);
251 251
 	}
252 252
 
253 253
 	/**
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 	{
271 271
 		//$this->updateAssociatedRecords($record,true);
272 272
 		$result = $this->getCommand($record)->insert($this->getInsertValues($record));
273
-		if($result)
273
+		if ($result)
274 274
 			$this->updatePostInsert($record);
275 275
 		//$this->updateAssociatedRecords($record);
276 276
 		return $result;
@@ -284,10 +284,10 @@  discard block
 block discarded – undo
284 284
 	{
285 285
 		$command = $this->getCommand($record);
286 286
 		$tableInfo = $command->getTableInfo();
287
-		foreach($tableInfo->getColumns() as $name => $column)
287
+		foreach ($tableInfo->getColumns() as $name => $column)
288 288
 		{
289
-			if($column->hasSequence())
290
-				$record->setColumnValue($name,$command->getLastInsertID($column->getSequenceName()));
289
+			if ($column->hasSequence())
290
+				$record->setColumnValue($name, $command->getLastInsertID($column->getSequenceName()));
291 291
 		}
292 292
 	}
293 293
 
@@ -297,20 +297,20 @@  discard block
 block discarded – undo
297 297
 	 */
298 298
 	protected function getInsertValues(TActiveRecord $record)
299 299
 	{
300
-		$values=array();
300
+		$values = array();
301 301
 		$tableInfo = $this->getCommand($record)->getTableInfo();
302
-		foreach($tableInfo->getColumns() as $name=>$column)
302
+		foreach ($tableInfo->getColumns() as $name=>$column)
303 303
 		{
304
-			if($column->getIsExcluded())
304
+			if ($column->getIsExcluded())
305 305
 				continue;
306 306
 			$value = $record->getColumnValue($name);
307
-			if(!$column->getAllowNull() && $value===null && !$column->hasSequence() && ($column->getDefaultValue() === TDbTableColumn::UNDEFINED_VALUE))
307
+			if (!$column->getAllowNull() && $value === null && !$column->hasSequence() && ($column->getDefaultValue() === TDbTableColumn::UNDEFINED_VALUE))
308 308
 			{
309 309
 				throw new TActiveRecordException(
310 310
 					'ar_value_must_not_be_null', get_class($record),
311 311
 					$tableInfo->getTableFullName(), $name);
312 312
 			}
313
-			if($value!==null)
313
+			if ($value !== null)
314 314
 				$values[$name] = $value;
315 315
 		}
316 316
 		return $values;
@@ -332,29 +332,29 @@  discard block
 block discarded – undo
332 332
 
333 333
 	protected function getUpdateValues(TActiveRecord $record)
334 334
 	{
335
-		$values=array();
335
+		$values = array();
336 336
 		$tableInfo = $this->getCommand($record)->getTableInfo();
337
-		$primary=array();
338
-		foreach($tableInfo->getColumns() as $name=>$column)
337
+		$primary = array();
338
+		foreach ($tableInfo->getColumns() as $name=>$column)
339 339
 		{
340
-			if($column->getIsExcluded())
340
+			if ($column->getIsExcluded())
341 341
 				continue;
342 342
 			$value = $record->getColumnValue($name);
343
-			if(!$column->getAllowNull() && $value===null && ($column->getDefaultValue() === TDbTableColumn::UNDEFINED_VALUE))
343
+			if (!$column->getAllowNull() && $value === null && ($column->getDefaultValue() === TDbTableColumn::UNDEFINED_VALUE))
344 344
 			{
345 345
 				throw new TActiveRecordException(
346 346
 					'ar_value_must_not_be_null', get_class($record),
347 347
 					$tableInfo->getTableFullName(), $name);
348 348
 			}
349
-			if($column->getIsPrimaryKey())
349
+			if ($column->getIsPrimaryKey())
350 350
 				$primary[$name] = $value;
351 351
 			else
352 352
 				$values[$name] = $value;
353 353
 		}
354
-		return array($values,$primary);
354
+		return array($values, $primary);
355 355
 	}
356 356
 
357
-	protected function updateAssociatedRecords(TActiveRecord $record,$updateBelongsTo=false)
357
+	protected function updateAssociatedRecords(TActiveRecord $record, $updateBelongsTo = false)
358 358
 	{
359 359
 		$context = new TActiveRecordRelationContext($record);
360 360
 		return $context->updateAssociatedRecords($updateBelongsTo);
@@ -373,10 +373,10 @@  discard block
 block discarded – undo
373 373
 	protected function getPrimaryKeyValues(TActiveRecord $record)
374 374
 	{
375 375
 		$tableInfo = $this->getCommand($record)->getTableInfo();
376
-		$primary=array();
377
-		foreach($tableInfo->getColumns() as $name=>$column)
376
+		$primary = array();
377
+		foreach ($tableInfo->getColumns() as $name=>$column)
378 378
 		{
379
-			if($column->getIsPrimaryKey())
379
+			if ($column->getIsPrimaryKey())
380 380
 				$primary[$name] = $record->getColumnValue($name);
381 381
 		}
382 382
 		return $primary;
@@ -410,11 +410,11 @@  discard block
 block discarded – undo
410 410
 	 * @param TActiveRecord active record
411 411
 	 * @param TActiveRecordCriteria data for the command.
412 412
 	 */
413
-	protected function raiseCommandEvent($event,$command,$record,$criteria)
413
+	protected function raiseCommandEvent($event, $command, $record, $criteria)
414 414
 	{
415
-		if(!($criteria instanceof TSqlCriteria))
416
-			$criteria = new TActiveRecordCriteria(null,$criteria);
417
-		$param = new TActiveRecordEventParameter($command,$record,$criteria);
415
+		if (!($criteria instanceof TSqlCriteria))
416
+			$criteria = new TActiveRecordCriteria(null, $criteria);
417
+		$param = new TActiveRecordEventParameter($command, $record, $criteria);
418 418
 		$manager = $record->getRecordManager();
419 419
 		$manager->{$event}($param);
420 420
 		$record->{$event}($param);
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -67,16 +67,14 @@
 block discarded – undo
67 67
 				throw new TActiveRecordException('ar_invalid_tablename_property',
68 68
 					get_class($record),self::TABLE_CONST);
69 69
 			return $value;
70
-		}
71
-		elseif ($class->hasMethod(self::TABLE_METHOD))
70
+		} elseif ($class->hasMethod(self::TABLE_METHOD))
72 71
 		{
73 72
 			$value = $record->{self::TABLE_METHOD}();
74 73
 			if(empty($value))
75 74
 				throw new TActiveRecordException('ar_invalid_tablename_method',
76 75
 					get_class($record),self::TABLE_METHOD);
77 76
 			return $value;
78
-		}
79
-		else
77
+		} else
80 78
 			return strtolower(get_class($record));
81 79
 	}
82 80
 
Please login to merge, or discard this patch.
framework/Data/Common/Mssql/TMssqlMetaData.php 5 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -123,6 +123,7 @@
 block discarded – undo
123 123
 	/**
124 124
 	 * @param TMssqlTableInfo table information.
125 125
 	 * @param array column information.
126
+	 * @param TMssqlTableInfo $tableInfo
126 127
 	 */
127 128
 	protected function processColumn($tableInfo, $col)
128 129
 	{
Please login to merge, or discard this patch.
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -259,15 +259,15 @@
 block discarded – undo
259 259
 		return false;
260 260
 	}
261 261
 
262
-        /**
263
-	 * Returns all table names in the database.
264
-	 * @param string $schema the schema of the tables. Defaults to empty string, meaning the current or default schema.
265
-	 * If not empty, the returned table names will be prefixed with the schema name.
266
-	 * @return array all table names in the database.
267
-	 */
262
+		/**
263
+		 * Returns all table names in the database.
264
+		 * @param string $schema the schema of the tables. Defaults to empty string, meaning the current or default schema.
265
+		 * If not empty, the returned table names will be prefixed with the schema name.
266
+		 * @return array all table names in the database.
267
+		 */
268 268
 	public function findTableNames($schema='dbo')
269 269
 	{
270
-                $condition="TABLE_TYPE='BASE TABLE'";
270
+				$condition="TABLE_TYPE='BASE TABLE'";
271 271
 		$sql=<<<EOD
272 272
 SELECT TABLE_NAME, TABLE_SCHEMA FROM [INFORMATION_SCHEMA].[TABLES]
273 273
 WHERE TABLE_SCHEMA=:schema AND $condition
Please login to merge, or discard this patch.
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 	 */
70 70
 	protected function createTableInfo($table)
71 71
 	{
72
-		list($catalogName,$schemaName,$tableName) = $this->getCatalogSchemaTableName($table);
72
+		list($catalogName, $schemaName, $tableName) = $this->getCatalogSchemaTableName($table);
73 73
 		$this->getDbConnection()->setActive(true);
74 74
 		$sql = <<<EOD
75 75
 				SELECT t.*,
@@ -80,26 +80,26 @@  discard block
 block discarded – undo
80 80
 									WHERE t.table_name = c.table_name
81 81
 										AND t.table_name = :table
82 82
 EOD;
83
-		if($schemaName!==null)
83
+		if ($schemaName !== null)
84 84
 			$sql .= ' AND t.table_schema = :schema';
85
-		if($catalogName!==null)
85
+		if ($catalogName !== null)
86 86
 			$sql .= ' AND t.table_catalog = :catalog';
87 87
 
88 88
 		$command = $this->getDbConnection()->createCommand($sql);
89 89
 		$command->bindValue(':table', $tableName);
90
-		if($schemaName!==null)
90
+		if ($schemaName !== null)
91 91
 			$command->bindValue(':schema', $schemaName);
92
-		if($catalogName!==null)
92
+		if ($catalogName !== null)
93 93
 			$command->bindValue(':catalog', $catalogName);
94 94
 
95
-		$tableInfo=null;
96
-		foreach($command->query() as $col)
95
+		$tableInfo = null;
96
+		foreach ($command->query() as $col)
97 97
 		{
98
-			if($tableInfo===null)
98
+			if ($tableInfo === null)
99 99
 				$tableInfo = $this->createNewTableInfo($col);
100
-			$this->processColumn($tableInfo,$col);
100
+			$this->processColumn($tableInfo, $col);
101 101
 		}
102
-		if($tableInfo===null)
102
+		if ($tableInfo === null)
103 103
 			throw new TDbException('dbmetadata_invalid_table_view', $table);
104 104
 		return $tableInfo;
105 105
 	}
@@ -112,12 +112,12 @@  discard block
 block discarded – undo
112 112
 	{
113 113
 		//remove possible delimiters
114 114
 		$result = explode('.', preg_replace('/\[|\]|"/', '', $table));
115
-		if(count($result)===1)
116
-			return array(null,null,$result[0]);
117
-		if(count($result)===2)
118
-			return array(null,$result[0],$result[1]);
119
-		if(count($result)>2)
120
-			return array($result[0],$result[1],$result[2]);
115
+		if (count($result) === 1)
116
+			return array(null, null, $result[0]);
117
+		if (count($result) === 2)
118
+			return array(null, $result[0], $result[1]);
119
+		if (count($result) > 2)
120
+			return array($result[0], $result[1], $result[2]);
121 121
 	}
122 122
 
123 123
 	/**
@@ -130,25 +130,25 @@  discard block
 block discarded – undo
130 130
 
131 131
 		$info['ColumnName'] = "[$columnId]"; //quote the column names!
132 132
 		$info['ColumnId'] = $columnId;
133
-		$info['ColumnIndex'] = intval($col['ORDINAL_POSITION'])-1; //zero-based index
134
-		if($col['IS_NULLABLE']!=='NO')
133
+		$info['ColumnIndex'] = intval($col['ORDINAL_POSITION']) - 1; //zero-based index
134
+		if ($col['IS_NULLABLE'] !== 'NO')
135 135
 			$info['AllowNull'] = true;
136
-		if($col['COLUMN_DEFAULT']!==null)
136
+		if ($col['COLUMN_DEFAULT'] !== null)
137 137
 			$info['DefaultValue'] = $col['COLUMN_DEFAULT'];
138 138
 
139
-		if(in_array($columnId, $tableInfo->getPrimaryKeys()))
139
+		if (in_array($columnId, $tableInfo->getPrimaryKeys()))
140 140
 			$info['IsPrimaryKey'] = true;
141
-		if($this->isForeignKeyColumn($columnId, $tableInfo))
141
+		if ($this->isForeignKeyColumn($columnId, $tableInfo))
142 142
 			$info['IsForeignKey'] = true;
143 143
 
144
-		if($col['IsIdentity']==='1')
144
+		if ($col['IsIdentity'] === '1')
145 145
 			$info['AutoIncrement'] = true;
146 146
 		$info['DbType'] = $col['DATA_TYPE'];
147
-		if($col['CHARACTER_MAXIMUM_LENGTH']!==null)
147
+		if ($col['CHARACTER_MAXIMUM_LENGTH'] !== null)
148 148
 			$info['ColumnSize'] = intval($col['CHARACTER_MAXIMUM_LENGTH']);
149
-		if($col['NUMERIC_PRECISION'] !== null)
149
+		if ($col['NUMERIC_PRECISION'] !== null)
150 150
 			$info['NumericPrecision'] = intval($col['NUMERIC_PRECISION']);
151
-		if($col['NUMERIC_SCALE']!==null)
151
+		if ($col['NUMERIC_SCALE'] !== null)
152 152
 			$info['NumericScale'] = intval($col['NUMERIC_SCALE']);
153 153
 		$tableInfo->Columns[$columnId] = new TMssqlTableColumn($info);
154 154
 	}
@@ -163,11 +163,11 @@  discard block
 block discarded – undo
163 163
 		$info['CatalogName'] = $col['TABLE_CATALOG'];
164 164
 		$info['SchemaName'] = $col['TABLE_SCHEMA'];
165 165
 		$info['TableName'] = $col['TABLE_NAME'];
166
-		if($col['TABLE_TYPE']==='VIEW')
166
+		if ($col['TABLE_TYPE'] === 'VIEW')
167 167
 			$info['IsView'] = true;
168 168
 		list($primary, $foreign) = $this->getConstraintKeys($col);
169 169
 		$class = $this->getTableInfoClass();
170
-		return new $class($info,$primary,$foreign);
170
+		return new $class($info, $primary, $foreign);
171 171
 	}
172 172
 
173 173
 	/**
@@ -192,10 +192,10 @@  discard block
 block discarded – undo
192 192
 		$command = $this->getDbConnection()->createCommand($sql);
193 193
 		$command->bindValue(':table', $col['TABLE_NAME']);
194 194
 		$primary = array();
195
-		foreach($command->query()->readAll() as $field)
195
+		foreach ($command->query()->readAll() as $field)
196 196
 			$primary[] = $field['field_name'];
197 197
 		$foreign = $this->getForeignConstraints($col);
198
-		return array($primary,$foreign);
198
+		return array($primary, $foreign);
199 199
 	}
200 200
 
201 201
 	/**
@@ -234,9 +234,9 @@  discard block
 block discarded – undo
234 234
 EOD;
235 235
 		$command = $this->getDbConnection()->createCommand($sql);
236 236
 		$command->bindValue(':table', $col['TABLE_NAME']);
237
-		$fkeys=array();
237
+		$fkeys = array();
238 238
 		$catalogSchema = "[{$col['TABLE_CATALOG']}].[{$col['TABLE_SCHEMA']}]";
239
-		foreach($command->query() as $info)
239
+		foreach ($command->query() as $info)
240 240
 		{
241 241
 			$fkeys[$info['FK_CONSTRAINT_NAME']]['keys'][$info['FK_COLUMN_NAME']] = $info['UQ_COLUMN_NAME'];
242 242
 			$fkeys[$info['FK_CONSTRAINT_NAME']]['table'] = $info['UQ_TABLE_NAME'];
@@ -251,9 +251,9 @@  discard block
 block discarded – undo
251 251
 	 */
252 252
 	protected function isForeignKeyColumn($columnId, $tableInfo)
253 253
 	{
254
-		foreach($tableInfo->getForeignKeys() as $fk)
254
+		foreach ($tableInfo->getForeignKeys() as $fk)
255 255
 		{
256
-			if(in_array($columnId, array_keys($fk['keys'])))
256
+			if (in_array($columnId, array_keys($fk['keys'])))
257 257
 				return true;
258 258
 		}
259 259
 		return false;
@@ -265,23 +265,23 @@  discard block
 block discarded – undo
265 265
 	 * If not empty, the returned table names will be prefixed with the schema name.
266 266
 	 * @return array all table names in the database.
267 267
 	 */
268
-	public function findTableNames($schema='dbo')
268
+	public function findTableNames($schema = 'dbo')
269 269
 	{
270
-                $condition="TABLE_TYPE='BASE TABLE'";
271
-		$sql=<<<EOD
270
+                $condition = "TABLE_TYPE='BASE TABLE'";
271
+		$sql = <<<EOD
272 272
 SELECT TABLE_NAME, TABLE_SCHEMA FROM [INFORMATION_SCHEMA].[TABLES]
273 273
 WHERE TABLE_SCHEMA=:schema AND $condition
274 274
 EOD;
275
-		$command=$this->getDbConnection()->createCommand($sql);
275
+		$command = $this->getDbConnection()->createCommand($sql);
276 276
 		$command->bindParam(":schema", $schema);
277
-		$rows=$command->queryAll();
278
-		$names=array();
277
+		$rows = $command->queryAll();
278
+		$names = array();
279 279
 		foreach ($rows as $row)
280 280
 		{
281 281
 			if ($schema == self::DEFAULT_SCHEMA)
282
-				$names[]=$row['TABLE_NAME'];
282
+				$names[] = $row['TABLE_NAME'];
283 283
 			else
284
-				$names[]=$schema.'.'.$row['TABLE_SCHEMA'].'.'.$row['TABLE_NAME'];
284
+				$names[] = $schema . '.' . $row['TABLE_SCHEMA'] . '.' . $row['TABLE_NAME'];
285 285
 		}
286 286
 
287 287
 		return $names;
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -192,8 +192,9 @@
 block discarded – undo
192 192
 		$command = $this->getDbConnection()->createCommand($sql);
193 193
 		$command->bindValue(':table', $col['TABLE_NAME']);
194 194
 		$primary = array();
195
-		foreach($command->query()->readAll() as $field)
196
-			$primary[] = $field['field_name'];
195
+		foreach($command->query()->readAll() as $field) {
196
+					$primary[] = $field['field_name'];
197
+		}
197 198
 		$foreign = $this->getForeignConstraints($col);
198 199
 		return array($primary,$foreign);
199 200
 	}
Please login to merge, or discard this patch.
Upper-Lower-Casing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 												INFORMATION_SCHEMA.COLUMNS c
80 80
 									WHERE t.table_name = c.table_name
81 81
 										AND t.table_name = :table
82
-EOD;
82
+eod;
83 83
 		if($schemaName!==null)
84 84
 			$sql .= ' AND t.table_schema = :schema';
85 85
 		if($catalogName!==null)
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 		AND
189 189
 			c.constraint_type ='PRIMARY KEY'
190 190
 				AND k.table_name = :table
191
-EOD;
191
+eod;
192 192
 		$command = $this->getDbConnection()->createCommand($sql);
193 193
 		$command->bindValue(':table', $col['TABLE_NAME']);
194 194
 		$primary = array();
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 		RC.UNIQUE_CONSTRAINT_NAME
232 232
 			AND KCU2.ORDINAL_POSITION = KCU1.ORDINAL_POSITION
233 233
 		WHERE KCU1.TABLE_NAME = :table
234
-EOD;
234
+eod;
235 235
 		$command = $this->getDbConnection()->createCommand($sql);
236 236
 		$command->bindValue(':table', $col['TABLE_NAME']);
237 237
 		$fkeys=array();
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
 		$sql=<<<EOD
272 272
 SELECT TABLE_NAME, TABLE_SCHEMA FROM [INFORMATION_SCHEMA].[TABLES]
273 273
 WHERE TABLE_SCHEMA=:schema AND $condition
274
-EOD;
274
+eod;
275 275
 		$command=$this->getDbConnection()->createCommand($sql);
276 276
 		$command->bindParam(":schema", $schema);
277 277
 		$rows=$command->queryAll();
Please login to merge, or discard this patch.
framework/Data/Common/Mysql/TMysqlMetaData.php 5 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -114,6 +114,7 @@
 block discarded – undo
114 114
 	/**
115 115
 	 * @param TMysqlTableInfo table information.
116 116
 	 * @param array column information.
117
+	 * @param TMysqlTableInfo $tableInfo
117 118
 	 */
118 119
 	protected function processColumn($tableInfo, $col)
119 120
 	{
Please login to merge, or discard this patch.
Spacing   +67 added lines, -67 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
  */
28 28
 class TMysqlMetaData extends TDbMetaData
29 29
 {
30
-	private $_serverVersion=0;
30
+	private $_serverVersion = 0;
31 31
 
32 32
 	/**
33 33
 	 * @return string TDbTableInfo class name.
@@ -74,24 +74,24 @@  discard block
 block discarded – undo
74 74
 	 */
75 75
 	protected function createTableInfo($table)
76 76
 	{
77
-		list($schemaName,$tableName) = $this->getSchemaTableName($table);
78
-		$find = $schemaName===null ? "`{$tableName}`" : "`{$schemaName}`.`{$tableName}`";
77
+		list($schemaName, $tableName) = $this->getSchemaTableName($table);
78
+		$find = $schemaName === null ? "`{$tableName}`" : "`{$schemaName}`.`{$tableName}`";
79 79
 		$colCase = $this->getDbConnection()->getColumnCase();
80
-		if($colCase != TDbColumnCaseMode::Preserved)
80
+		if ($colCase != TDbColumnCaseMode::Preserved)
81 81
 			$this->getDbConnection()->setColumnCase('Preserved');
82 82
 		$this->getDbConnection()->setActive(true);
83 83
 		$sql = "SHOW FULL FIELDS FROM {$find}";
84 84
 		$command = $this->getDbConnection()->createCommand($sql);
85 85
 		$tableInfo = $this->createNewTableInfo($table);
86
-		$index=0;
87
-		foreach($command->query() as $col)
86
+		$index = 0;
87
+		foreach ($command->query() as $col)
88 88
 		{
89 89
 			$col['index'] = $index++;
90
-			$this->processColumn($tableInfo,$col);
90
+			$this->processColumn($tableInfo, $col);
91 91
 		}
92
-		if($index===0)
92
+		if ($index === 0)
93 93
 			throw new TDbException('dbmetadata_invalid_table_view', $table);
94
-		if($colCase != TDbColumnCaseMode::Preserved)
94
+		if ($colCase != TDbColumnCaseMode::Preserved)
95 95
 			$this->getDbConnection()->setColumnCase($colCase);
96 96
 		return $tableInfo;
97 97
 	}
@@ -101,12 +101,12 @@  discard block
 block discarded – undo
101 101
 	 */
102 102
 	protected function getServerVersion()
103 103
 	{
104
-		if(!$this->_serverVersion)
104
+		if (!$this->_serverVersion)
105 105
 		{
106 106
 			$version = $this->getDbConnection()->getAttribute(PDO::ATTR_SERVER_VERSION);
107
-			$digits=array();
107
+			$digits = array();
108 108
 			preg_match('/(\d+)\.(\d+)\.(\d+)/', $version, $digits);
109
-			$this->_serverVersion=floatval($digits[1].'.'.$digits[2].$digits[3]);
109
+			$this->_serverVersion = floatval($digits[1] . '.' . $digits[2] . $digits[3]);
110 110
 		}
111 111
 		return $this->_serverVersion;
112 112
 	}
@@ -122,37 +122,37 @@  discard block
 block discarded – undo
122 122
 		$info['ColumnName'] = "`$columnId`"; //quote the column names!
123 123
 		$info['ColumnId'] = $columnId;
124 124
 		$info['ColumnIndex'] = $col['index'];
125
-		if($col['Null']==='YES')
125
+		if ($col['Null'] === 'YES')
126 126
 			$info['AllowNull'] = true;
127
-		if(is_int(strpos(strtolower($col['Extra']), 'auto_increment')))
128
-			$info['AutoIncrement']=true;
129
-		if($col['Default']!=="")
127
+		if (is_int(strpos(strtolower($col['Extra']), 'auto_increment')))
128
+			$info['AutoIncrement'] = true;
129
+		if ($col['Default'] !== "")
130 130
 			$info['DefaultValue'] = $col['Default'];
131 131
 
132
-		if($col['Key']==='PRI' || in_array($columnId, $tableInfo->getPrimaryKeys()))
132
+		if ($col['Key'] === 'PRI' || in_array($columnId, $tableInfo->getPrimaryKeys()))
133 133
 			$info['IsPrimaryKey'] = true;
134
-		if($this->isForeignKeyColumn($columnId, $tableInfo))
134
+		if ($this->isForeignKeyColumn($columnId, $tableInfo))
135 135
 			$info['IsForeignKey'] = true;
136 136
 
137 137
 		$info['DbType'] = $col['Type'];
138
-		$match=array();
138
+		$match = array();
139 139
 		//find SET/ENUM values, column size, precision, and scale
140
-		if(preg_match('/\((.*)\)/', $col['Type'], $match))
140
+		if (preg_match('/\((.*)\)/', $col['Type'], $match))
141 141
 		{
142
-			$info['DbType']= preg_replace('/\(.*\)/', '', $col['Type']);
142
+			$info['DbType'] = preg_replace('/\(.*\)/', '', $col['Type']);
143 143
 
144 144
 			//find SET/ENUM values
145
-			if($this->isEnumSetType($info['DbType']))
145
+			if ($this->isEnumSetType($info['DbType']))
146 146
 				$info['DbTypeValues'] = preg_split("/[',]/S", $match[1], -1, PREG_SPLIT_NO_EMPTY);
147 147
 
148 148
 			//find column size, precision and scale
149 149
 			$pscale = array();
150
-			if(preg_match('/(\d+)(?:,(\d+))?+/', $match[1], $pscale))
150
+			if (preg_match('/(\d+)(?:,(\d+))?+/', $match[1], $pscale))
151 151
 			{
152
-				if($this->isPrecisionType($info['DbType']))
152
+				if ($this->isPrecisionType($info['DbType']))
153 153
 				{
154 154
 					$info['NumericPrecision'] = intval($pscale[1]);
155
-					if(count($pscale) > 2)
155
+					if (count($pscale) > 2)
156 156
 						$info['NumericScale'] = intval($pscale[2]);
157 157
 				}
158 158
 				else
@@ -169,9 +169,9 @@  discard block
 block discarded – undo
169 169
 	protected function isPrecisionType($type)
170 170
 	{
171 171
 		$type = strtolower(trim($type));
172
-		return $type==='decimal' || $type==='dec'
173
-				|| $type==='float' || $type==='double'
174
-				|| $type==='double precision' || $type==='real';
172
+		return $type === 'decimal' || $type === 'dec'
173
+				|| $type === 'float' || $type === 'double'
174
+				|| $type === 'double precision' || $type === 'real';
175 175
 	}
176 176
 
177 177
 	/**
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 	protected function isEnumSetType($type)
181 181
 	{
182 182
 		$type = strtolower(trim($type));
183
-		return $type==='set' || $type==='enum';
183
+		return $type === 'set' || $type === 'enum';
184 184
 	}
185 185
 
186 186
 	/**
@@ -192,9 +192,9 @@  discard block
 block discarded – undo
192 192
 	{
193 193
 		//remove the back ticks and separate out the "database.table"
194 194
 		$result = explode('.', str_replace('`', '', $table));
195
-		foreach($result as $name)
195
+		foreach ($result as $name)
196 196
 		{
197
-			if(!$this->isValidIdentifier($name))
197
+			if (!$this->isValidIdentifier($name))
198 198
 			{
199 199
 				$ref = 'http://dev.mysql.com/doc/refman/5.0/en/identifiers.html';
200 200
 				throw new TDbException('dbcommon_invalid_identifier_name', $table, $ref);
@@ -220,14 +220,14 @@  discard block
 block discarded – undo
220 220
 	 */
221 221
 	protected function createNewTableInfo($table)
222 222
 	{
223
-		list($schemaName,$tableName) = $this->getSchemaTableName($table);
223
+		list($schemaName, $tableName) = $this->getSchemaTableName($table);
224 224
 		$info['SchemaName'] = $schemaName;
225 225
 		$info['TableName'] = $tableName;
226
-		if($this->getIsView($schemaName,$tableName))
226
+		if ($this->getIsView($schemaName, $tableName))
227 227
 			$info['IsView'] = true;
228 228
 		list($primary, $foreign) = $this->getConstraintKeys($schemaName, $tableName);
229 229
 		$class = $this->getTableInfoClass();
230
-		return new $class($info,$primary,$foreign);
230
+		return new $class($info, $primary, $foreign);
231 231
 	}
232 232
 
233 233
 	/**
@@ -240,11 +240,11 @@  discard block
 block discarded – undo
240 240
 	 * @return boolean true if is view, false otherwise.
241 241
 	 * @throws TDbException if table or view does not exist.
242 242
 	 */
243
-	protected function getIsView($schemaName,$tableName)
243
+	protected function getIsView($schemaName, $tableName)
244 244
 	{
245
-		if($this->getServerVersion()<5.01)
245
+		if ($this->getServerVersion() < 5.01)
246 246
 			return false;
247
-		if($schemaName!==null)
247
+		if ($schemaName !== null)
248 248
 			$sql = "SHOW FULL TABLES FROM `{$schemaName}` LIKE :table";
249 249
 		else
250 250
 			$sql = "SHOW FULL TABLES LIKE :table";
@@ -253,12 +253,12 @@  discard block
 block discarded – undo
253 253
 		$command->bindValue(':table', $tableName);
254 254
 		try
255 255
 		{
256
-			return count($result = $command->queryRow()) > 0 && $result['Table_type']==='VIEW';
256
+			return count($result = $command->queryRow()) > 0 && $result['Table_type'] === 'VIEW';
257 257
 		}
258
-		catch(TDbException $e)
258
+		catch (TDbException $e)
259 259
 		{
260
-			$table = $schemaName===null?$tableName:$schemaName.'.'.$tableName;
261
-			throw new TDbException('dbcommon_invalid_table_name',$table,$e->getMessage());
260
+			$table = $schemaName === null ? $tableName : $schemaName . '.' . $tableName;
261
+			throw new TDbException('dbcommon_invalid_table_name', $table, $e->getMessage());
262 262
 		}
263 263
 	}
264 264
 
@@ -270,22 +270,22 @@  discard block
 block discarded – undo
270 270
 	 */
271 271
 	protected function getConstraintKeys($schemaName, $tableName)
272 272
 	{
273
-		$table = $schemaName===null ? "`{$tableName}`" : "`{$schemaName}`.`{$tableName}`";
273
+		$table = $schemaName === null ? "`{$tableName}`" : "`{$schemaName}`.`{$tableName}`";
274 274
 		$sql = "SHOW INDEX FROM {$table}";
275 275
 		$command = $this->getDbConnection()->createCommand($sql);
276 276
 		$primary = array();
277
-		foreach($command->query() as $row)
277
+		foreach ($command->query() as $row)
278 278
 		{
279
-			if($row['Key_name']==='PRIMARY')
279
+			if ($row['Key_name'] === 'PRIMARY')
280 280
 				$primary[] = $row['Column_name'];
281 281
 		}
282 282
 				// MySQL version was increased to >=5.1.21 instead of 5.x
283 283
 				// due to a MySQL bug (http://bugs.mysql.com/bug.php?id=19588)
284
-		if($this->getServerVersion() >= 5.121)
285
-			$foreign = $this->getForeignConstraints($schemaName,$tableName);
284
+		if ($this->getServerVersion() >= 5.121)
285
+			$foreign = $this->getForeignConstraints($schemaName, $tableName);
286 286
 		else
287
-			$foreign = $this->findForeignConstraints($schemaName,$tableName);
288
-		return array($primary,$foreign);
287
+			$foreign = $this->findForeignConstraints($schemaName, $tableName);
288
+		return array($primary, $foreign);
289 289
 	}
290 290
 
291 291
 	/**
@@ -313,10 +313,10 @@  discard block
 block discarded – undo
313 313
 EOD;
314 314
 		$command = $this->getDbConnection()->createCommand($sql);
315 315
 		$command->bindValue(':table', $tableName);
316
-		if($schemaName!==null)
316
+		if ($schemaName !== null)
317 317
 			$command->bindValue(':schema', $schemaName);
318
-		$fkeys=array();
319
-		foreach($command->query() as $col)
318
+		$fkeys = array();
319
+		foreach ($command->query() as $col)
320 320
 		{
321 321
 			$fkeys[$col['con']]['keys'][$col['col']] = $col['fkcol'];
322 322
 			$fkeys[$col['con']]['table'] = $col['fktable'];
@@ -332,12 +332,12 @@  discard block
 block discarded – undo
332 332
 	 */
333 333
 	protected function getShowCreateTable($schemaName, $tableName)
334 334
 	{
335
-		if(version_compare(PHP_VERSION,'5.1.3','<'))
335
+		if (version_compare(PHP_VERSION, '5.1.3', '<'))
336 336
 			throw new TDbException('dbmetadata_requires_php_version', 'Mysql 4.1.x', '5.1.3');
337 337
 
338 338
 		//See http://netevil.org/node.php?nid=795&SC=1
339 339
 		$this->getDbConnection()->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
340
-		if($schemaName!==null)
340
+		if ($schemaName !== null)
341 341
 			$sql = "SHOW CREATE TABLE `{$schemaName}`.`{$tableName}`";
342 342
 		else
343 343
 			$sql = "SHOW CREATE TABLE `{$tableName}`";
@@ -355,16 +355,16 @@  discard block
 block discarded – undo
355 355
 	protected function findForeignConstraints($schemaName, $tableName)
356 356
 	{
357 357
 		$sql = $this->getShowCreateTable($schemaName, $tableName);
358
-		$matches =array();
358
+		$matches = array();
359 359
 		$regexp = '/FOREIGN KEY\s+\(([^\)]+)\)\s+REFERENCES\s+`?([^`]+)`?\s\(([^\)]+)\)/mi';
360
-		preg_match_all($regexp,$sql,$matches,PREG_SET_ORDER);
360
+		preg_match_all($regexp, $sql, $matches, PREG_SET_ORDER);
361 361
 		$foreign = array();
362
-		foreach($matches as $match)
362
+		foreach ($matches as $match)
363 363
 		{
364
-			$fields = array_map('trim',explode(',',str_replace('`','',$match[1])));
365
-			$fk_fields = array_map('trim',explode(',',str_replace('`','',$match[3])));
366
-			$keys=array();
367
-			foreach($fields as $k=>$v)
364
+			$fields = array_map('trim', explode(',', str_replace('`', '', $match[1])));
365
+			$fk_fields = array_map('trim', explode(',', str_replace('`', '', $match[3])));
366
+			$keys = array();
367
+			foreach ($fields as $k=>$v)
368 368
 				$keys[$v] = $fk_fields[$k];
369 369
 			$foreign[] = array('keys' => $keys, 'table' => trim($match[2]));
370 370
 		}
@@ -378,9 +378,9 @@  discard block
 block discarded – undo
378 378
 	 */
379 379
 	protected function isForeignKeyColumn($columnId, $tableInfo)
380 380
 	{
381
-		foreach($tableInfo->getForeignKeys() as $fk)
381
+		foreach ($tableInfo->getForeignKeys() as $fk)
382 382
 		{
383
-			if(in_array($columnId, array_keys($fk['keys'])))
383
+			if (in_array($columnId, array_keys($fk['keys'])))
384 384
 				return true;
385 385
 		}
386 386
 		return false;
@@ -392,13 +392,13 @@  discard block
 block discarded – undo
392 392
 	 * If not empty, the returned table names will be prefixed with the schema name.
393 393
 	 * @return array all table names in the database.
394 394
 	 */
395
-	public function findTableNames($schema='')
395
+	public function findTableNames($schema = '')
396 396
 	{
397
-		if($schema==='')
397
+		if ($schema === '')
398 398
 			return $this->getDbConnection()->createCommand('SHOW TABLES')->queryColumn();
399
-		$names=$this->getDbConnection()->createCommand('SHOW TABLES FROM '.$this->quoteTableName($schema))->queryColumn();
400
-		foreach($names as &$name)
401
-			$name=$schema.'.'.$name;
399
+		$names = $this->getDbConnection()->createCommand('SHOW TABLES FROM ' . $this->quoteTableName($schema))->queryColumn();
400
+		foreach ($names as &$name)
401
+			$name = $schema . '.' . $name;
402 402
 		return $names;
403 403
 	}
404 404
 }
Please login to merge, or discard this patch.
Braces   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -154,8 +154,7 @@  discard block
 block discarded – undo
154 154
 					$info['NumericPrecision'] = intval($pscale[1]);
155 155
 					if(count($pscale) > 2)
156 156
 						$info['NumericScale'] = intval($pscale[2]);
157
-				}
158
-				else
157
+				} else
159 158
 					$info['ColumnSize'] = intval($pscale[1]);
160 159
 			}
161 160
 		}
@@ -254,8 +253,7 @@  discard block
 block discarded – undo
254 253
 		try
255 254
 		{
256 255
 			return count($result = $command->queryRow()) > 0 && $result['Table_type']==='VIEW';
257
-		}
258
-		catch(TDbException $e)
256
+		} catch(TDbException $e)
259 257
 		{
260 258
 			$table = $schemaName===null?$tableName:$schemaName.'.'.$tableName;
261 259
 			throw new TDbException('dbcommon_invalid_table_name',$table,$e->getMessage());
@@ -364,8 +362,9 @@  discard block
 block discarded – undo
364 362
 			$fields = array_map('trim',explode(',',str_replace('`','',$match[1])));
365 363
 			$fk_fields = array_map('trim',explode(',',str_replace('`','',$match[3])));
366 364
 			$keys=array();
367
-			foreach($fields as $k=>$v)
368
-				$keys[$v] = $fk_fields[$k];
365
+			foreach($fields as $k=>$v) {
366
+							$keys[$v] = $fk_fields[$k];
367
+			}
369 368
 			$foreign[] = array('keys' => $keys, 'table' => trim($match[2]));
370 369
 		}
371 370
 		return $foreign;
@@ -397,8 +396,9 @@  discard block
 block discarded – undo
397 396
 		if($schema==='')
398 397
 			return $this->getDbConnection()->createCommand('SHOW TABLES')->queryColumn();
399 398
 		$names=$this->getDbConnection()->createCommand('SHOW TABLES FROM '.$this->quoteTableName($schema))->queryColumn();
400
-		foreach($names as &$name)
401
-			$name=$schema.'.'.$name;
399
+		foreach($names as &$name) {
400
+					$name=$schema.'.'.$name;
401
+		}
402 402
 		return $names;
403 403
 	}
404 404
 }
Please login to merge, or discard this patch.
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -335,12 +335,12 @@
 block discarded – undo
335 335
 		return false;
336 336
 	}
337 337
 
338
-        /**
339
-	 * Returns all table names in the database.
340
-	 * @param string $schema the schema of the tables. Defaults to empty string, meaning the current or default schema.
341
-	 * If not empty, the returned table names will be prefixed with the schema name.
342
-	 * @return array all table names in the database.
343
-	 */
338
+		/**
339
+		 * Returns all table names in the database.
340
+		 * @param string $schema the schema of the tables. Defaults to empty string, meaning the current or default schema.
341
+		 * If not empty, the returned table names will be prefixed with the schema name.
342
+		 * @return array all table names in the database.
343
+		 */
344 344
 	public function findTableNames($schema='')
345 345
 	{
346 346
 		if($schema==='')
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -310,7 +310,7 @@
 block discarded – undo
310 310
 				REFERENCED_TABLE_NAME IS NOT NULL
311 311
 				AND TABLE_NAME LIKE :table
312 312
 				$andSchema
313
-EOD;
313
+eod;
314 314
 		$command = $this->getDbConnection()->createCommand($sql);
315 315
 		$command->bindValue(':table', $tableName);
316 316
 		if($schemaName!==null)
Please login to merge, or discard this patch.
framework/Data/Common/Oracle/TOracleMetaData.php 5 patches
Doc Comments   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 	/**
146 146
 	 * @param string table schema name
147 147
 	 * @param string table name.
148
-	 * @return boolean true if the table is a view.
148
+	 * @return integer true if the table is a view.
149 149
 	 */
150 150
 	protected function getIsView($schemaName,$tableName)
151 151
 	{
@@ -167,6 +167,7 @@  discard block
 block discarded – undo
167 167
 	/**
168 168
 	 * @param TOracleTableInfo table information.
169 169
 	 * @param array column information.
170
+	 * @param TOracleTableInfo $tableInfo
170 171
 	 */
171 172
 	protected function processColumn($tableInfo, $col)
172 173
 	{
@@ -322,6 +323,7 @@  discard block
 block discarded – undo
322 323
 	/**
323 324
 	 * @param string column name.
324 325
 	 * @param TOracleTableInfo table information.
326
+	 * @param string $columnId
325 327
 	 * @return boolean true if column is a foreign key.
326 328
 	 */
327 329
 	protected function isForeignKeyColumn($columnId, $tableInfo)
Please login to merge, or discard this patch.
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -335,12 +335,12 @@
 block discarded – undo
335 335
 		return false;
336 336
 	}
337 337
 
338
-        /**
339
-	 * Returns all table names in the database.
340
-	 * @param string $schema the schema of the tables. Defaults to empty string, meaning the current or default schema.
341
-	 * If not empty, the returned table names will be prefixed with the schema name.
342
-	 * @return array all table names in the database.
343
-	 */
338
+		/**
339
+		 * Returns all table names in the database.
340
+		 * @param string $schema the schema of the tables. Defaults to empty string, meaning the current or default schema.
341
+		 * If not empty, the returned table names will be prefixed with the schema name.
342
+		 * @return array all table names in the database.
343
+		 */
344 344
 	public function findTableNames($schema='')
345 345
 	{
346 346
 		if($schema==='')
Please login to merge, or discard this patch.
Spacing   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	 */
42 42
 	public function setDefaultSchema($schema)
43 43
 	{
44
-		$this->_defaultSchema=$schema;
44
+		$this->_defaultSchema = $schema;
45 45
 	}
46 46
 
47 47
 	/**
@@ -58,10 +58,10 @@  discard block
 block discarded – undo
58 58
 	 */
59 59
 	protected function getSchemaTableName($table)
60 60
 	{
61
-		if(count($parts= explode('.', str_replace('"','',$table))) > 1)
61
+		if (count($parts = explode('.', str_replace('"', '', $table))) > 1)
62 62
 			return array($parts[0], $parts[1]);
63 63
 		else
64
-			return array($this->getDefaultSchema(),$parts[0]);
64
+			return array($this->getDefaultSchema(), $parts[0]);
65 65
 	}
66 66
 
67 67
 	/**
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 	 */
72 72
 	protected function createTableInfo($table)
73 73
 	{
74
-		list($schemaName,$tableName) = $this->getSchemaTableName($table);
74
+		list($schemaName, $tableName) = $this->getSchemaTableName($table);
75 75
 
76 76
 		// This query is made much more complex by the addition of the 'attisserial' field.
77 77
 		// The subquery to get that field checks to see if there is an internally dependent
@@ -100,13 +100,13 @@  discard block
 block discarded – undo
100 100
 		//$command->bindValue(':table', $tableName);
101 101
 		//$command->bindValue(':schema', $schemaName);
102 102
 		$tableInfo = $this->createNewTableInfo($schemaName, $tableName);
103
-		$index=0;
104
-		foreach($command->query() as $col)
103
+		$index = 0;
104
+		foreach ($command->query() as $col)
105 105
 		{
106 106
 			$col['index'] = $index++;
107 107
 			$this->processColumn($tableInfo, $col);
108 108
 		}
109
-		if($index===0)
109
+		if ($index === 0)
110 110
 			throw new TDbException('dbmetadata_invalid_table_view', $table);
111 111
 		return $tableInfo;
112 112
 	}
@@ -116,15 +116,15 @@  discard block
 block discarded – undo
116 116
 	 * @param string table name.
117 117
 	 * @return TOracleTableInfo
118 118
 	 */
119
-	protected function createNewTableInfo($schemaName,$tableName)
119
+	protected function createNewTableInfo($schemaName, $tableName)
120 120
 	{
121 121
 		$info['SchemaName'] = $this->assertIdentifier($schemaName);
122
-		$info['TableName']	= $this->assertIdentifier($tableName);
123
-		$info['IsView'] 	= false;
124
-		if($this->getIsView($schemaName,$tableName)) $info['IsView'] = true;
122
+		$info['TableName'] = $this->assertIdentifier($tableName);
123
+		$info['IsView'] = false;
124
+		if ($this->getIsView($schemaName, $tableName)) $info['IsView'] = true;
125 125
 		list($primary, $foreign) = $this->getConstraintKeys($schemaName, $tableName);
126 126
 		$class = $this->getTableInfoClass();
127
-		return new $class($info,$primary,$foreign);
127
+		return new $class($info, $primary, $foreign);
128 128
 	}
129 129
 
130 130
 	/**
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 	 */
135 135
 	protected function assertIdentifier($name)
136 136
 	{
137
-		if(strpos($name, '"')!==false)
137
+		if (strpos($name, '"') !== false)
138 138
 		{
139 139
 			$ref = 'http://www.oracle.com';
140 140
 			throw new TDbException('dbcommon_invalid_identifier_name', $name, $ref);
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 	 * @param string table name.
148 148
 	 * @return boolean true if the table is a view.
149 149
 	 */
150
-	protected function getIsView($schemaName,$tableName)
150
+	protected function getIsView($schemaName, $tableName)
151 151
 	{
152 152
 		$this->getDbConnection()->setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER);
153 153
 		$sql =
@@ -173,14 +173,14 @@  discard block
 block discarded – undo
173 173
 		$columnId = strtolower($col['attname']); //use column name as column Id
174 174
 
175 175
 		//$info['ColumnName'] 	= '"'.$columnId.'"'; //quote the column names!
176
-		$info['ColumnName'] 	= $columnId; //NOT quote the column names!
177
-		$info['ColumnId'] 		= $columnId;
178
-		$info['ColumnIndex'] 	= $col['index'];
179
-		if(! (bool)$col['attnotnull'] ) $info['AllowNull'] = true;
180
-		if(in_array($columnId, $tableInfo->getPrimaryKeys())) $info['IsPrimaryKey'] = true;
181
-		if($this->isForeignKeyColumn($columnId, $tableInfo)) $info['IsForeignKey'] = true;
182
-		if( (int)$col['atttypmod'] > 0 ) $info['ColumnSize'] =  $col['atttypmod']; // - 4;
183
-		if( (bool)$col['atthasdef'] ) $info['DefaultValue'] = $col['adsrc'];
176
+		$info['ColumnName'] = $columnId; //NOT quote the column names!
177
+		$info['ColumnId'] = $columnId;
178
+		$info['ColumnIndex'] = $col['index'];
179
+		if (!(bool) $col['attnotnull']) $info['AllowNull'] = true;
180
+		if (in_array($columnId, $tableInfo->getPrimaryKeys())) $info['IsPrimaryKey'] = true;
181
+		if ($this->isForeignKeyColumn($columnId, $tableInfo)) $info['IsForeignKey'] = true;
182
+		if ((int) $col['atttypmod'] > 0) $info['ColumnSize'] = $col['atttypmod']; // - 4;
183
+		if ((bool) $col['atthasdef']) $info['DefaultValue'] = $col['adsrc'];
184 184
 		//
185 185
 		// For a while Oracle Tables has no  associated AutoIncrement Triggers
186 186
 		//
@@ -195,13 +195,13 @@  discard block
 block discarded – undo
195 195
 		}
196 196
 		*/
197 197
 		$matches = array();
198
-		if(preg_match('/\((\d+)(?:,(\d+))?+\)/', $col['type'], $matches))
198
+		if (preg_match('/\((\d+)(?:,(\d+))?+\)/', $col['type'], $matches))
199 199
 		{
200
-			$info['DbType'] = preg_replace('/\(\d+(?:,\d+)?\)/','',$col['type']);
201
-			if($this->isPrecisionType($info['DbType']))
200
+			$info['DbType'] = preg_replace('/\(\d+(?:,\d+)?\)/', '', $col['type']);
201
+			if ($this->isPrecisionType($info['DbType']))
202 202
 			{
203 203
 				$info['NumericPrecision'] = intval($matches[1]);
204
-				if(count($matches) > 2)
204
+				if (count($matches) > 2)
205 205
 					$info['NumericScale'] = intval($matches[2]);
206 206
 			}
207 207
 			else
@@ -215,15 +215,15 @@  discard block
 block discarded – undo
215 215
 	/**
216 216
 	 * @return string serial name if found, null otherwise.
217 217
 	 */
218
-	protected function getSequenceName($tableInfo,$src)
218
+	protected function getSequenceName($tableInfo, $src)
219 219
 	{
220 220
 		$matches = array();
221
-		if(preg_match('/nextval\([^\']*\'([^\']+)\'[^\)]*\)/i',$src,$matches))
221
+		if (preg_match('/nextval\([^\']*\'([^\']+)\'[^\)]*\)/i', $src, $matches))
222 222
 		{
223
-			if(is_int(strpos($matches[1], '.')))
223
+			if (is_int(strpos($matches[1], '.')))
224 224
 				return $matches[1];
225 225
 			else
226
-				return $tableInfo->getSchemaName().'.'.$matches[1];
226
+				return $tableInfo->getSchemaName() . '.' . $matches[1];
227 227
 		}
228 228
 	}
229 229
 
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 	protected function isPrecisionType($type)
234 234
 	{
235 235
 		$type = strtolower(trim($type));
236
-		return $type==='number'; // || $type==='interval' || strpos($type, 'time')===0;
236
+		return $type === 'number'; // || $type==='interval' || strpos($type, 'time')===0;
237 237
 	}
238 238
 
239 239
 	/**
@@ -262,19 +262,19 @@  discard block
 block discarded – undo
262 262
 		//$command->bindValue(':schema', $schemaName);
263 263
 		$primary = array();
264 264
 		$foreign = array();
265
-		foreach($command->query() as $row)
265
+		foreach ($command->query() as $row)
266 266
 		{
267
-			switch( strtolower( $row['contype'] ) )
267
+			switch (strtolower($row['contype']))
268 268
 			{
269 269
 				case 'p':
270
-					$primary = array_merge( $primary, array(strtolower( $row['consrc'] )) );
270
+					$primary = array_merge($primary, array(strtolower($row['consrc'])));
271 271
 					/*
272 272
 					$arr = $this->getPrimaryKeys($row['consrc']);
273 273
 					$primary = array_merge( $primary, array(strtolower( $arr[0] )) );
274 274
 					*/
275 275
 					break;
276 276
 				case 'r':
277
-					$foreign = array_merge( $foreign, array(strtolower( $row['consrc'] )) );
277
+					$foreign = array_merge($foreign, array(strtolower($row['consrc'])));
278 278
 					/*
279 279
 					// if(($fkey = $this->getForeignKeys($row['consrc']))!==null)
280 280
 					$fkey = $this->getForeignKeys( $row['consrc'] );
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 					break;
284 284
 			}
285 285
 		}
286
-		return array($primary,$foreign);
286
+		return array($primary, $foreign);
287 287
 	}
288 288
 
289 289
 	/**
@@ -294,8 +294,8 @@  discard block
 block discarded – undo
294 294
 	protected function getPrimaryKeys($src)
295 295
 	{
296 296
 		$matches = array();
297
-		if(preg_match('/PRIMARY\s+KEY\s+\(([^\)]+)\)/i', $src, $matches))
298
-			return preg_split('/,\s+/',$matches[1]);
297
+		if (preg_match('/PRIMARY\s+KEY\s+\(([^\)]+)\)/i', $src, $matches))
298
+			return preg_split('/,\s+/', $matches[1]);
299 299
 		return array();
300 300
 	}
301 301
 
@@ -309,13 +309,13 @@  discard block
 block discarded – undo
309 309
 		$matches = array();
310 310
 		$brackets = '\(([^\)]+)\)';
311 311
 		$find = "/FOREIGN\s+KEY\s+{$brackets}\s+REFERENCES\s+([^\(]+){$brackets}/i";
312
-		if(preg_match($find, $src, $matches))
312
+		if (preg_match($find, $src, $matches))
313 313
 		{
314 314
 			$keys = preg_split('/,\s+/', $matches[1]);
315 315
 			$fkeys = array();
316
-			foreach(preg_split('/,\s+/', $matches[3]) as $i => $fkey)
316
+			foreach (preg_split('/,\s+/', $matches[3]) as $i => $fkey)
317 317
 				$fkeys[$keys[$i]] = $fkey;
318
-			return array('table' => str_replace('"','',$matches[2]), 'keys' => $fkeys);
318
+			return array('table' => str_replace('"', '', $matches[2]), 'keys' => $fkeys);
319 319
 		}
320 320
 	}
321 321
 
@@ -326,9 +326,9 @@  discard block
 block discarded – undo
326 326
 	 */
327 327
 	protected function isForeignKeyColumn($columnId, $tableInfo)
328 328
 	{
329
-		foreach($tableInfo->getForeignKeys() as $fk)
329
+		foreach ($tableInfo->getForeignKeys() as $fk)
330 330
 		{
331
-			if( $fk==$columnId )
331
+			if ($fk == $columnId)
332 332
 			//if(in_array($columnId, array_keys($fk['keys'])))
333 333
 				return true;
334 334
 		}
@@ -341,33 +341,33 @@  discard block
 block discarded – undo
341 341
 	 * If not empty, the returned table names will be prefixed with the schema name.
342 342
 	 * @return array all table names in the database.
343 343
 	 */
344
-	public function findTableNames($schema='')
344
+	public function findTableNames($schema = '')
345 345
 	{
346
-		if($schema==='')
346
+		if ($schema === '')
347 347
 		{
348
-			$sql=<<<EOD
348
+			$sql = <<<EOD
349 349
 SELECT table_name, '{$schema}' as table_schema FROM user_tables
350 350
 EOD;
351
-			$command=$this->getDbConnection()->createCommand($sql);
351
+			$command = $this->getDbConnection()->createCommand($sql);
352 352
 		}
353 353
 		else
354 354
 		{
355
-			$sql=<<<EOD
355
+			$sql = <<<EOD
356 356
 SELECT object_name as table_name, owner as table_schema FROM all_objects
357 357
 WHERE object_type = 'TABLE' AND owner=:schema
358 358
 EOD;
359
-			$command=$this->getDbConnection()->createCommand($sql);
360
-			$command->bindParam(':schema',$schema);
359
+			$command = $this->getDbConnection()->createCommand($sql);
360
+			$command->bindParam(':schema', $schema);
361 361
 		}
362 362
 
363
-		$rows=$command->queryAll();
364
-		$names=array();
365
-		foreach($rows as $row)
363
+		$rows = $command->queryAll();
364
+		$names = array();
365
+		foreach ($rows as $row)
366 366
 		{
367
-			if($schema===$this->getDefaultSchema() || $schema==='')
368
-				$names[]=$row['TABLE_NAME'];
367
+			if ($schema === $this->getDefaultSchema() || $schema === '')
368
+				$names[] = $row['TABLE_NAME'];
369 369
 			else
370
-				$names[]=$row['TABLE_SCHEMA'].'.'.$row['TABLE_NAME'];
370
+				$names[] = $row['TABLE_SCHEMA'] . '.' . $row['TABLE_NAME'];
371 371
 		}
372 372
 		return $names;
373 373
 	}
Please login to merge, or discard this patch.
Braces   +6 added lines, -8 removed lines patch added patch discarded remove patch
@@ -203,11 +203,9 @@  discard block
 block discarded – undo
203 203
 				$info['NumericPrecision'] = intval($matches[1]);
204 204
 				if(count($matches) > 2)
205 205
 					$info['NumericScale'] = intval($matches[2]);
206
-			}
207
-			else
206
+			} else
208 207
 				$info['ColumnSize'] = intval($matches[1]);
209
-		}
210
-		else
208
+		} else
211 209
 			$info['DbType'] = $col['type'];
212 210
 		$tableInfo->Columns[$columnId] = new TOracleTableColumn($info);
213 211
 	}
@@ -313,8 +311,9 @@  discard block
 block discarded – undo
313 311
 		{
314 312
 			$keys = preg_split('/,\s+/', $matches[1]);
315 313
 			$fkeys = array();
316
-			foreach(preg_split('/,\s+/', $matches[3]) as $i => $fkey)
317
-				$fkeys[$keys[$i]] = $fkey;
314
+			foreach(preg_split('/,\s+/', $matches[3]) as $i => $fkey) {
315
+							$fkeys[$keys[$i]] = $fkey;
316
+			}
318 317
 			return array('table' => str_replace('"','',$matches[2]), 'keys' => $fkeys);
319 318
 		}
320 319
 	}
@@ -349,8 +348,7 @@  discard block
 block discarded – undo
349 348
 SELECT table_name, '{$schema}' as table_schema FROM user_tables
350 349
 EOD;
351 350
 			$command=$this->getDbConnection()->createCommand($sql);
352
-		}
353
-		else
351
+		} else
354 352
 		{
355 353
 			$sql=<<<EOD
356 354
 SELECT object_name as table_name, owner as table_schema FROM all_objects
Please login to merge, or discard this patch.
Upper-Lower-Casing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 			TABLE_NAME = '{$tableName}'
94 94
 			AND OWNER = '{$schemaName}'
95 95
 		ORDER BY a.COLUMN_ID
96
-EOD;
96
+eod;
97 97
 		$this->getDbConnection()->setActive(true);
98 98
 		$this->getDbConnection()->setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER);
99 99
 		$command = $this->getDbConnection()->createCommand($sql);
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 		from 	ALL_OBJECTS
157 157
 		where	OBJECT_NAME = '{$tableName}'
158 158
 		and 	OWNER = '{$schemaName}'
159
-EOD;
159
+eod;
160 160
 		$this->getDbConnection()->setActive(true);
161 161
 		$command = $this->getDbConnection()->createCommand($sql);
162 162
 		//$command->bindValue(':schema',$schemaName);
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 		and	  a.TABLE_NAME = '{$tableName}'
256 256
 		and   a.OWNER = '{$schemaName}'
257 257
 		and   a.CONSTRAINT_TYPE in ('P','R')
258
-EOD;
258
+eod;
259 259
 		$this->getDbConnection()->setActive(true);
260 260
 		$command = $this->getDbConnection()->createCommand($sql);
261 261
 		//$command->bindValue(':table', $tableName);
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
 		{
348 348
 			$sql=<<<EOD
349 349
 SELECT table_name, '{$schema}' as table_schema FROM user_tables
350
-EOD;
350
+eod;
351 351
 			$command=$this->getDbConnection()->createCommand($sql);
352 352
 		}
353 353
 		else
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
 			$sql=<<<EOD
356 356
 SELECT object_name as table_name, owner as table_schema FROM all_objects
357 357
 WHERE object_type = 'TABLE' AND owner=:schema
358
-EOD;
358
+eod;
359 359
 			$command=$this->getDbConnection()->createCommand($sql);
360 360
 			$command->bindParam(':schema',$schema);
361 361
 		}
Please login to merge, or discard this patch.
framework/Data/Common/Oracle/TOracleTableInfo.php 3 patches
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.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
  */
20 20
 class TOracleTableInfo extends TComponent
21 21
 {
22
-	private $_info=array();
22
+	private $_info = array();
23 23
 
24 24
 	private $_primaryKeys;
25 25
 	private $_foreignKeys;
@@ -32,12 +32,12 @@  discard block
 block discarded – undo
32 32
 	 * Sets the database table meta data information.
33 33
 	 * @param array table column information.
34 34
 	 */
35
-	public function __construct($tableInfo=array(),$primary=array(),$foreign=array())
35
+	public function __construct($tableInfo = array(), $primary = array(), $foreign = array())
36 36
 	{
37
-		$this->_info=$tableInfo;
38
-		$this->_primaryKeys=$primary;
39
-		$this->_foreignKeys=$foreign;
40
-		$this->_columns=new TMap;
37
+		$this->_info = $tableInfo;
38
+		$this->_primaryKeys = $primary;
39
+		$this->_foreignKeys = $foreign;
40
+		$this->_columns = new TMap;
41 41
 	}
42 42
 
43 43
 	/**
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 	public function createCommandBuilder($connection)
48 48
 	{
49 49
 		Prado::using('System.Data.Common.Oracle.TOracleCommandBuilder');
50
-		return new TOracleCommandBuilder($connection,$this);
50
+		return new TOracleCommandBuilder($connection, $this);
51 51
 	}
52 52
 
53 53
 	/**
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 	 * @param mixed default value if information array value is null
56 56
 	 * @return mixed information array value.
57 57
 	 */
58
-	public function getInfo($name,$default=null)
58
+	public function getInfo($name, $default = null)
59 59
 	{
60 60
 		return isset($this->_info[$name]) ? $this->_info[$name] : $default;
61 61
 	}
@@ -64,9 +64,9 @@  discard block
 block discarded – undo
64 64
 	 * @param string information array key name
65 65
 	 * @param mixed new information array value.
66 66
 	 */
67
-	protected function setInfo($name,$value)
67
+	protected function setInfo($name, $value)
68 68
 	{
69
-		$this->_info[$name]=$value;
69
+		$this->_info[$name] = $value;
70 70
 	}
71 71
 
72 72
 	/**
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 	 */
83 83
 	public function getTableFullName()
84 84
 	{
85
-		return $this->_info['SchemaName'].'.'.$this->getTableName();
85
+		return $this->_info['SchemaName'] . '.' . $this->getTableName();
86 86
 	}
87 87
 
88 88
 	/**
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 	 */
91 91
 	public function getIsView()
92 92
 	{
93
-		return $this->getInfo('IsView',false);
93
+		return $this->getInfo('IsView', false);
94 94
 	}
95 95
 
96 96
 	/**
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 	 */
108 108
 	public function getColumn($name)
109 109
 	{
110
-		if(($column = $this->_columns->itemAt($name))!==null)
110
+		if (($column = $this->_columns->itemAt($name)) !== null)
111 111
 			return $column;
112 112
 		throw new TDbException('dbtableinfo_invalid_column_name', $name, $this->getTableFullName());
113 113
 	}
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 	 */
119 119
 	public function getColumnNames()
120 120
 	{
121
-		foreach($this->getColumns() as $column)
121
+		foreach ($this->getColumns() as $column)
122 122
 			$names[] = $column->getColumnName();
123 123
 		return $names;
124 124
 	}
@@ -144,10 +144,10 @@  discard block
 block discarded – undo
144 144
 	 */
145 145
 	public function getLowerCaseColumnNames()
146 146
 	{
147
-		if($this->_lowercase===null)
147
+		if ($this->_lowercase === null)
148 148
 		{
149
-			$this->_lowercase=array();
150
-			foreach($this->getColumns()->getKeys() as $key)
149
+			$this->_lowercase = array();
150
+			foreach ($this->getColumns()->getKeys() as $key)
151 151
 				$this->_lowercase[strtolower($key)] = $key;
152 152
 		}
153 153
 		return $this->_lowercase;
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -118,8 +118,9 @@  discard block
 block discarded – undo
118 118
 	 */
119 119
 	public function getColumnNames()
120 120
 	{
121
-		foreach($this->getColumns() as $column)
122
-			$names[] = $column->getColumnName();
121
+		foreach($this->getColumns() as $column) {
122
+					$names[] = $column->getColumnName();
123
+		}
123 124
 		return $names;
124 125
 	}
125 126
 
@@ -147,8 +148,9 @@  discard block
 block discarded – undo
147 148
 		if($this->_lowercase===null)
148 149
 		{
149 150
 			$this->_lowercase=array();
150
-			foreach($this->getColumns()->getKeys() as $key)
151
-				$this->_lowercase[strtolower($key)] = $key;
151
+			foreach($this->getColumns()->getKeys() as $key) {
152
+							$this->_lowercase[strtolower($key)] = $key;
153
+			}
152 154
 		}
153 155
 		return $this->_lowercase;
154 156
 	}
Please login to merge, or discard this patch.