@@ -47,8 +47,8 @@ |
||
47 | 47 | */ |
48 | 48 | public function __construct($response, $parameter) |
49 | 49 | { |
50 | - $this->_response = $response; |
|
51 | - $this->_parameter = $parameter; |
|
50 | + $this->_response=$response; |
|
51 | + $this->_parameter=$parameter; |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | /** |
@@ -64,10 +64,10 @@ |
||
64 | 64 | */ |
65 | 65 | protected function getTriggerOptions() |
66 | 66 | { |
67 | - $options = parent::getTriggerOptions(); |
|
68 | - $name = preg_replace('/^on/', '', $this->getEventName()); |
|
69 | - $options['EventName'] = strtolower($name); |
|
70 | - $options['StopEvent'] = $this->getPreventDefaultAction(); |
|
67 | + $options=parent::getTriggerOptions(); |
|
68 | + $name=preg_replace('/^on/', '', $this->getEventName()); |
|
69 | + $options['EventName']=strtolower($name); |
|
70 | + $options['StopEvent']=$this->getPreventDefaultAction(); |
|
71 | 71 | return $options; |
72 | 72 | } |
73 | 73 |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | */ |
38 | 38 | public function getTagName() |
39 | 39 | { |
40 | - return ($this->_tagName !== null) ? $this->_tagName : ($this->_tagName = $this->getDefaultTagName()); |
|
40 | + return ($this->_tagName!==null) ? $this->_tagName : ($this->_tagName=$this->getDefaultTagName()); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -61,6 +61,6 @@ discard block |
||
61 | 61 | * @return boolean true if TagName has deviated from the default. |
62 | 62 | */ |
63 | 63 | public function getIsMutated() { |
64 | - return $this->_tagName !== null && $this->_tagName != $this->getDefaultTagName(); |
|
64 | + return $this->_tagName!==null && $this->_tagName!=$this->getDefaultTagName(); |
|
65 | 65 | } |
66 | 66 | } |
@@ -518,16 +518,14 @@ |
||
518 | 518 | { |
519 | 519 | $this->setIsValid(true); |
520 | 520 | $this->onValidationSuccess(); |
521 | - } |
|
522 | - else |
|
521 | + } else |
|
523 | 522 | { |
524 | 523 | if($target) |
525 | 524 | $target->setIsValid(false); |
526 | 525 | $this->setIsValid(false); |
527 | 526 | $this->onValidationError(); |
528 | 527 | } |
529 | - } |
|
530 | - else |
|
528 | + } else |
|
531 | 529 | { |
532 | 530 | $this->evaluateIsValid(); |
533 | 531 | $this->setIsValid(true); |
@@ -185,6 +185,7 @@ discard block |
||
185 | 185 | * TBaseValidator::$_clientClass, be sure to update the corresponding |
186 | 186 | * "Javascript/validation3.js" file as well. |
187 | 187 | * @param TControl control to validate. |
188 | + * @param \Prado\Web\UI\TControl $control |
|
188 | 189 | * @return string control type for client-side validation. |
189 | 190 | */ |
190 | 191 | private function getClientControlClass($control) |
@@ -263,7 +264,7 @@ discard block |
||
263 | 264 | /** |
264 | 265 | * Update the ControlToValidate component's css class depending |
265 | 266 | * if the ControlCssClass property is set, and whether this is valid. |
266 | - * @return boolean true if change, false otherwise. |
|
267 | + * @return boolean|null true if change, false otherwise. |
|
267 | 268 | */ |
268 | 269 | protected function updateControlCssClass() |
269 | 270 | { |
@@ -388,6 +389,7 @@ discard block |
||
388 | 389 | * The ID path is the dot-connected IDs of the controls reaching from |
389 | 390 | * the validator's naming container to the target control. |
390 | 391 | * @param string the ID path |
392 | + * @param string $value |
|
391 | 393 | */ |
392 | 394 | public function setControlToValidate($value) |
393 | 395 | { |
@@ -476,7 +478,7 @@ discard block |
||
476 | 478 | } |
477 | 479 | |
478 | 480 | /** |
479 | - * @return TControl control to be validated. Null if no control is found. |
|
481 | + * @return \Prado\Web\UI\TControl control to be validated. Null if no control is found. |
|
480 | 482 | * @throws TConfigurationException if {@link getControlToValidate |
481 | 483 | * ControlToValidate} is empty or does not point to a valid control |
482 | 484 | */ |
@@ -553,6 +555,7 @@ discard block |
||
553 | 555 | |
554 | 556 | /** |
555 | 557 | * @param string the css class that is applied to the control being validated in case the validation fails |
558 | + * @param string $value |
|
556 | 559 | */ |
557 | 560 | public function setControlCssClass($value) |
558 | 561 | { |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | * them specially. |
96 | 96 | * @var array list of control class names |
97 | 97 | */ |
98 | - private static $_clientClass = ['THtmlArea', 'THtmlArea4', 'TDatePicker', 'TListBox', 'TCheckBoxList']; |
|
98 | + private static $_clientClass=['THtmlArea', 'THtmlArea4', 'TDatePicker', 'TListBox', 'TCheckBoxList']; |
|
99 | 99 | |
100 | 100 | /** |
101 | 101 | * Constructor. |
@@ -154,29 +154,29 @@ discard block |
||
154 | 154 | */ |
155 | 155 | protected function getClientScriptOptions() |
156 | 156 | { |
157 | - $control = $this->getValidationTarget(); |
|
158 | - $options['ID'] = $this->getClientID(); |
|
159 | - $options['FormID'] = $this->getPage()->getForm()->getClientID(); |
|
160 | - $options['Display'] = $this->getDisplay(); |
|
161 | - $options['ErrorMessage'] = $this->getErrorMessage(); |
|
157 | + $control=$this->getValidationTarget(); |
|
158 | + $options['ID']=$this->getClientID(); |
|
159 | + $options['FormID']=$this->getPage()->getForm()->getClientID(); |
|
160 | + $options['Display']=$this->getDisplay(); |
|
161 | + $options['ErrorMessage']=$this->getErrorMessage(); |
|
162 | 162 | if($this->getFocusOnError()) |
163 | 163 | { |
164 | - $options['FocusOnError'] = $this->getFocusOnError(); |
|
165 | - $options['FocusElementID'] = $this->getFocusElementID(); |
|
164 | + $options['FocusOnError']=$this->getFocusOnError(); |
|
165 | + $options['FocusElementID']=$this->getFocusElementID(); |
|
166 | 166 | } |
167 | - $options['ValidationGroup'] = $this->getValidationGroup(); |
|
167 | + $options['ValidationGroup']=$this->getValidationGroup(); |
|
168 | 168 | if($control) |
169 | - $options['ControlToValidate'] = $control->getClientID(); |
|
170 | - $options['ControlCssClass'] = $this->getControlCssClass(); |
|
169 | + $options['ControlToValidate']=$control->getClientID(); |
|
170 | + $options['ControlCssClass']=$this->getControlCssClass(); |
|
171 | 171 | |
172 | - $options['ControlType'] = $this->getClientControlClass($control); |
|
173 | - $options['Enabled'] = $this->getEnabled(true); |
|
172 | + $options['ControlType']=$this->getClientControlClass($control); |
|
173 | + $options['Enabled']=$this->getEnabled(true); |
|
174 | 174 | |
175 | 175 | //get date format from date picker target control |
176 | 176 | if($control instanceof TDatePicker) |
177 | - $options['DateFormat'] = $control->getDateFormat(); |
|
177 | + $options['DateFormat']=$control->getDateFormat(); |
|
178 | 178 | |
179 | - $options = array_merge($options, $this->getClientSide()->getOptions()->toArray()); |
|
179 | + $options=array_merge($options, $this->getClientSide()->getOptions()->toArray()); |
|
180 | 180 | |
181 | 181 | return $options; |
182 | 182 | } |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | foreach(self::$_clientClass as $type) |
194 | 194 | if($control instanceof $type) |
195 | 195 | return $type; |
196 | - $reflectionClass = new \ReflectionClass($control); |
|
196 | + $reflectionClass=new \ReflectionClass($control); |
|
197 | 197 | return $reflectionClass->getShortName(); |
198 | 198 | } |
199 | 199 | |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | public function getClientSide() |
217 | 217 | { |
218 | 218 | if($this->_clientSide===null) |
219 | - $this->_clientSide = $this->createClientSide(); |
|
219 | + $this->_clientSide=$this->createClientSide(); |
|
220 | 220 | return $this->_clientSide; |
221 | 221 | } |
222 | 222 | |
@@ -236,15 +236,15 @@ discard block |
||
236 | 236 | */ |
237 | 237 | public function renderClientControlScript($writer) |
238 | 238 | { |
239 | - $scripts = $this->getPage()->getClientScript(); |
|
240 | - if ($this->getEnableClientScript()) |
|
239 | + $scripts=$this->getPage()->getClientScript(); |
|
240 | + if($this->getEnableClientScript()) |
|
241 | 241 | $scripts->registerPradoScript('validator'); |
242 | 242 | $formID=$this->getPage()->getForm()->getClientID(); |
243 | - $scriptKey = "TBaseValidator:$formID"; |
|
243 | + $scriptKey="TBaseValidator:$formID"; |
|
244 | 244 | if($this->getEnableClientScript() && !$scripts->isEndScriptRegistered($scriptKey)) |
245 | 245 | { |
246 | - $manager['FormID'] = $formID; |
|
247 | - $options = TJavaScript::encode($manager); |
|
246 | + $manager['FormID']=$formID; |
|
247 | + $options=TJavaScript::encode($manager); |
|
248 | 248 | $scripts->registerEndScript($scriptKey, "new Prado.ValidationManager({$options});"); |
249 | 249 | } |
250 | 250 | if($this->getEnableClientScript()) |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | * Override parent implementation to update the control CSS Class before |
256 | 256 | * the validated control is rendered |
257 | 257 | */ |
258 | - public function onPreRender ($param) |
|
258 | + public function onPreRender($param) |
|
259 | 259 | { |
260 | 260 | parent::onPreRender($param); |
261 | 261 | $this->updateControlCssClass(); |
@@ -273,12 +273,12 @@ discard block |
||
273 | 273 | $control=$this->getValidationTarget(); |
274 | 274 | if($control instanceof TWebControl) |
275 | 275 | { |
276 | - $class = preg_replace('/ ' . preg_quote($cssClass) . '/', '', $control->getCssClass()); |
|
276 | + $class=preg_replace('/ '.preg_quote($cssClass).'/', '', $control->getCssClass()); |
|
277 | 277 | if(!$this->getIsValid()) |
278 | 278 | { |
279 | - $class .= ' ' . $cssClass; |
|
279 | + $class.=' '.$cssClass; |
|
280 | 280 | $control->setCssClass($class); |
281 | - } elseif ($control->getIsValid()) |
|
281 | + } elseif($control->getIsValid()) |
|
282 | 282 | $control->setCssClass($class); |
283 | 283 | } |
284 | 284 | } |
@@ -289,11 +289,11 @@ discard block |
||
289 | 289 | */ |
290 | 290 | protected function registerClientScriptValidator() |
291 | 291 | { |
292 | - $key = 'prado:' . $this->getClientID(); |
|
292 | + $key='prado:'.$this->getClientID(); |
|
293 | 293 | if(!$this->getPage()->getClientScript()->isEndScriptRegistered($key)) |
294 | 294 | { |
295 | - $options = TJavaScript::encode($this->getClientScriptOptions()); |
|
296 | - $script = 'new ' . $this->getClientClassName() . '(' . $options . ');'; |
|
295 | + $options=TJavaScript::encode($this->getClientScriptOptions()); |
|
296 | + $script='new '.$this->getClientClassName().'('.$options.');'; |
|
297 | 297 | $this->getPage()->getClientScript()->registerEndScript($key, $script); |
298 | 298 | } |
299 | 299 | } |
@@ -424,9 +424,9 @@ discard block |
||
424 | 424 | /* Workaround: TCheckBoxList and TRadioButtonList nests the actual |
425 | 425 | * inputs inside a table; we ensure the first input gets focused |
426 | 426 | */ |
427 | - if($target instanceof TCheckBoxList && $target->getItemCount()>0) |
|
427 | + if($target instanceof TCheckBoxList && $target->getItemCount() > 0) |
|
428 | 428 | { |
429 | - $id=$target->getClientID() . '_c0'; |
|
429 | + $id=$target->getClientID().'_c0'; |
|
430 | 430 | } else { |
431 | 431 | $id=$target->getClientID(); |
432 | 432 | } |
@@ -105,11 +105,11 @@ discard block |
||
105 | 105 | public function onPreRender($param) |
106 | 106 | { |
107 | 107 | parent::onPreRender($param); |
108 | - $scripts = preg_split('/,|\s+/', $this->getPradoScripts()); |
|
109 | - $cs = $this->getPage()->getClientScript(); |
|
108 | + $scripts=preg_split('/,|\s+/', $this->getPradoScripts()); |
|
109 | + $cs=$this->getPage()->getClientScript(); |
|
110 | 110 | foreach($scripts as $script) |
111 | 111 | { |
112 | - if(($script = trim($script))!=='') |
|
112 | + if(($script=trim($script))!=='') |
|
113 | 113 | $cs->registerPradoScript($script); |
114 | 114 | } |
115 | 115 | } |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | */ |
123 | 123 | public function render($writer) |
124 | 124 | { |
125 | - if ($this->getFlushScriptFiles()) |
|
125 | + if($this->getFlushScriptFiles()) |
|
126 | 126 | $this->getPage()->getClientScript()->flushScriptFiles($writer, $this); |
127 | 127 | $this->renderCustomScriptFile($writer); |
128 | 128 | $this->renderCustomScript($writer); |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | */ |
135 | 135 | protected function renderCustomScriptFile($writer) |
136 | 136 | { |
137 | - if(($scriptUrl = $this->getScriptUrl())!=='') |
|
137 | + if(($scriptUrl=$this->getScriptUrl())!=='') |
|
138 | 138 | $writer->write("<script type=\"text/javascript\" src=\"$scriptUrl\"></script>\n"); |
139 | 139 | } |
140 | 140 |
@@ -48,7 +48,7 @@ |
||
48 | 48 | */ |
49 | 49 | public function getPage() |
50 | 50 | { |
51 | - return $this->_control?$this->_control->getPage():null; |
|
51 | + return $this->_control ? $this->_control->getPage() : null; |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | /** |
@@ -203,11 +203,9 @@ discard block |
||
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 | } |
@@ -349,8 +347,7 @@ discard block |
||
349 | 347 | SELECT table_name, '{$schema}' as table_schema FROM user_tables |
350 | 348 | EOD; |
351 | 349 | $command=$this->getDbConnection()->createCommand($sql); |
352 | - } |
|
353 | - else |
|
350 | + } else |
|
354 | 351 | { |
355 | 352 | $sql=<<<EOD |
356 | 353 | SELECT object_name as table_name, owner as table_schema FROM all_objects |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | /** |
150 | 150 | * @param string table schema name |
151 | 151 | * @param string table name. |
152 | - * @return boolean true if the table is a view. |
|
152 | + * @return integer true if the table is a view. |
|
153 | 153 | */ |
154 | 154 | protected function getIsView($schemaName, $tableName) |
155 | 155 | { |
@@ -171,6 +171,7 @@ discard block |
||
171 | 171 | /** |
172 | 172 | * @param TOracleTableInfo table information. |
173 | 173 | * @param array column information. |
174 | + * @param TOracleTableInfo $tableInfo |
|
174 | 175 | */ |
175 | 176 | protected function processColumn($tableInfo, $col) |
176 | 177 | { |
@@ -326,6 +327,7 @@ discard block |
||
326 | 327 | /** |
327 | 328 | * @param string column name. |
328 | 329 | * @param TOracleTableInfo table information. |
330 | + * @param string $columnId |
|
329 | 331 | * @return boolean true if column is a foreign key. |
330 | 332 | */ |
331 | 333 | protected function isForeignKeyColumn($columnId, $tableInfo) |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | */ |
30 | 30 | class TOracleMetaData extends TDbMetaData |
31 | 31 | { |
32 | - private $_defaultSchema = 'system'; |
|
32 | + private $_defaultSchema='system'; |
|
33 | 33 | |
34 | 34 | |
35 | 35 | /** |
@@ -62,10 +62,10 @@ discard block |
||
62 | 62 | */ |
63 | 63 | protected function getSchemaTableName($table) |
64 | 64 | { |
65 | - if(count($parts= explode('.', str_replace('"', '', $table))) > 1) |
|
65 | + if(count($parts=explode('.', str_replace('"', '', $table))) > 1) |
|
66 | 66 | return [$parts[0], $parts[1]]; |
67 | 67 | else |
68 | - return [$this->getDefaultSchema(),$parts[0]]; |
|
68 | + return [$this->getDefaultSchema(), $parts[0]]; |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | /** |
@@ -75,12 +75,12 @@ discard block |
||
75 | 75 | */ |
76 | 76 | protected function createTableInfo($table) |
77 | 77 | { |
78 | - list($schemaName, $tableName) = $this->getSchemaTableName($table); |
|
78 | + list($schemaName, $tableName)=$this->getSchemaTableName($table); |
|
79 | 79 | |
80 | 80 | // This query is made much more complex by the addition of the 'attisserial' field. |
81 | 81 | // The subquery to get that field checks to see if there is an internally dependent |
82 | 82 | // sequence on the field. |
83 | - $sql = |
|
83 | + $sql= |
|
84 | 84 | <<<EOD |
85 | 85 | SELECT |
86 | 86 | a.COLUMN_ID, |
@@ -100,14 +100,14 @@ discard block |
||
100 | 100 | EOD; |
101 | 101 | $this->getDbConnection()->setActive(true); |
102 | 102 | $this->getDbConnection()->setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER); |
103 | - $command = $this->getDbConnection()->createCommand($sql); |
|
103 | + $command=$this->getDbConnection()->createCommand($sql); |
|
104 | 104 | //$command->bindValue(':table', $tableName); |
105 | 105 | //$command->bindValue(':schema', $schemaName); |
106 | - $tableInfo = $this->createNewTableInfo($schemaName, $tableName); |
|
106 | + $tableInfo=$this->createNewTableInfo($schemaName, $tableName); |
|
107 | 107 | $index=0; |
108 | 108 | foreach($command->query() as $col) |
109 | 109 | { |
110 | - $col['index'] = $index++; |
|
110 | + $col['index']=$index++; |
|
111 | 111 | $this->processColumn($tableInfo, $col); |
112 | 112 | } |
113 | 113 | if($index===0) |
@@ -122,12 +122,12 @@ discard block |
||
122 | 122 | */ |
123 | 123 | protected function createNewTableInfo($schemaName, $tableName) |
124 | 124 | { |
125 | - $info['SchemaName'] = $this->assertIdentifier($schemaName); |
|
126 | - $info['TableName'] = $this->assertIdentifier($tableName); |
|
127 | - $info['IsView'] = false; |
|
128 | - if($this->getIsView($schemaName, $tableName)) $info['IsView'] = true; |
|
129 | - list($primary, $foreign) = $this->getConstraintKeys($schemaName, $tableName); |
|
130 | - $class = $this->getTableInfoClass(); |
|
125 | + $info['SchemaName']=$this->assertIdentifier($schemaName); |
|
126 | + $info['TableName']=$this->assertIdentifier($tableName); |
|
127 | + $info['IsView']=false; |
|
128 | + if($this->getIsView($schemaName, $tableName)) $info['IsView']=true; |
|
129 | + list($primary, $foreign)=$this->getConstraintKeys($schemaName, $tableName); |
|
130 | + $class=$this->getTableInfoClass(); |
|
131 | 131 | return new $class($info, $primary, $foreign); |
132 | 132 | } |
133 | 133 | |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | { |
141 | 141 | if(strpos($name, '"')!==false) |
142 | 142 | { |
143 | - $ref = 'http://www.oracle.com'; |
|
143 | + $ref='http://www.oracle.com'; |
|
144 | 144 | throw new TDbException('dbcommon_invalid_identifier_name', $name, $ref); |
145 | 145 | } |
146 | 146 | return $name; |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | protected function getIsView($schemaName, $tableName) |
155 | 155 | { |
156 | 156 | $this->getDbConnection()->setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER); |
157 | - $sql = |
|
157 | + $sql= |
|
158 | 158 | <<<EOD |
159 | 159 | select OBJECT_TYPE |
160 | 160 | from ALL_OBJECTS |
@@ -162,10 +162,10 @@ discard block |
||
162 | 162 | and OWNER = '{$schemaName}' |
163 | 163 | EOD; |
164 | 164 | $this->getDbConnection()->setActive(true); |
165 | - $command = $this->getDbConnection()->createCommand($sql); |
|
165 | + $command=$this->getDbConnection()->createCommand($sql); |
|
166 | 166 | //$command->bindValue(':schema',$schemaName); |
167 | 167 | //$command->bindValue(':table', $tableName); |
168 | - return intval($command->queryScalar() === 'VIEW'); |
|
168 | + return intval($command->queryScalar()==='VIEW'); |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | /** |
@@ -174,17 +174,17 @@ discard block |
||
174 | 174 | */ |
175 | 175 | protected function processColumn($tableInfo, $col) |
176 | 176 | { |
177 | - $columnId = strtolower($col['attname']); //use column name as column Id |
|
177 | + $columnId=strtolower($col['attname']); //use column name as column Id |
|
178 | 178 | |
179 | 179 | //$info['ColumnName'] = '"'.$columnId.'"'; //quote the column names! |
180 | - $info['ColumnName'] = $columnId; //NOT quote the column names! |
|
181 | - $info['ColumnId'] = $columnId; |
|
182 | - $info['ColumnIndex'] = $col['index']; |
|
183 | - if(! (bool)$col['attnotnull']) $info['AllowNull'] = true; |
|
184 | - if(in_array($columnId, $tableInfo->getPrimaryKeys())) $info['IsPrimaryKey'] = true; |
|
185 | - if($this->isForeignKeyColumn($columnId, $tableInfo)) $info['IsForeignKey'] = true; |
|
186 | - if((int)$col['atttypmod'] > 0) $info['ColumnSize'] = $col['atttypmod']; // - 4; |
|
187 | - if((bool)$col['atthasdef']) $info['DefaultValue'] = $col['adsrc']; |
|
180 | + $info['ColumnName']=$columnId; //NOT quote the column names! |
|
181 | + $info['ColumnId']=$columnId; |
|
182 | + $info['ColumnIndex']=$col['index']; |
|
183 | + if(!(bool) $col['attnotnull']) $info['AllowNull']=true; |
|
184 | + if(in_array($columnId, $tableInfo->getPrimaryKeys())) $info['IsPrimaryKey']=true; |
|
185 | + if($this->isForeignKeyColumn($columnId, $tableInfo)) $info['IsForeignKey']=true; |
|
186 | + if((int) $col['atttypmod'] > 0) $info['ColumnSize']=$col['atttypmod']; // - 4; |
|
187 | + if((bool) $col['atthasdef']) $info['DefaultValue']=$col['adsrc']; |
|
188 | 188 | // |
189 | 189 | // For a while Oracle Tables has no associated AutoIncrement Triggers |
190 | 190 | // |
@@ -198,22 +198,22 @@ discard block |
||
198 | 198 | } |
199 | 199 | } |
200 | 200 | */ |
201 | - $matches = []; |
|
201 | + $matches=[]; |
|
202 | 202 | if(preg_match('/\((\d+)(?:,(\d+))?+\)/', $col['type'], $matches)) |
203 | 203 | { |
204 | - $info['DbType'] = preg_replace('/\(\d+(?:,\d+)?\)/', '', $col['type']); |
|
204 | + $info['DbType']=preg_replace('/\(\d+(?:,\d+)?\)/', '', $col['type']); |
|
205 | 205 | if($this->isPrecisionType($info['DbType'])) |
206 | 206 | { |
207 | - $info['NumericPrecision'] = intval($matches[1]); |
|
207 | + $info['NumericPrecision']=intval($matches[1]); |
|
208 | 208 | if(count($matches) > 2) |
209 | - $info['NumericScale'] = intval($matches[2]); |
|
209 | + $info['NumericScale']=intval($matches[2]); |
|
210 | 210 | } |
211 | 211 | else |
212 | - $info['ColumnSize'] = intval($matches[1]); |
|
212 | + $info['ColumnSize']=intval($matches[1]); |
|
213 | 213 | } |
214 | 214 | else |
215 | - $info['DbType'] = $col['type']; |
|
216 | - $tableInfo->Columns[$columnId] = new TOracleTableColumn($info); |
|
215 | + $info['DbType']=$col['type']; |
|
216 | + $tableInfo->Columns[$columnId]=new TOracleTableColumn($info); |
|
217 | 217 | } |
218 | 218 | |
219 | 219 | /** |
@@ -221,13 +221,13 @@ discard block |
||
221 | 221 | */ |
222 | 222 | protected function getSequenceName($tableInfo, $src) |
223 | 223 | { |
224 | - $matches = []; |
|
224 | + $matches=[]; |
|
225 | 225 | if(preg_match('/nextval\([^\']*\'([^\']+)\'[^\)]*\)/i', $src, $matches)) |
226 | 226 | { |
227 | 227 | if(is_int(strpos($matches[1], '.'))) |
228 | 228 | return $matches[1]; |
229 | 229 | else |
230 | - return $tableInfo->getSchemaName() . '.' . $matches[1]; |
|
230 | + return $tableInfo->getSchemaName().'.'.$matches[1]; |
|
231 | 231 | } |
232 | 232 | } |
233 | 233 | |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | */ |
237 | 237 | protected function isPrecisionType($type) |
238 | 238 | { |
239 | - $type = strtolower(trim($type)); |
|
239 | + $type=strtolower(trim($type)); |
|
240 | 240 | return $type==='number'; // || $type==='interval' || strpos($type, 'time')===0; |
241 | 241 | } |
242 | 242 | |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | { |
251 | 251 | $this->getDbConnection()->setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER); |
252 | 252 | // select decode( a.CONSTRAINT_TYPE, 'P', 'PRIMARY KEY (', 'FOREIGN KEY (' )||b.COLUMN_NAME||')' as consrc, |
253 | - $sql = |
|
253 | + $sql= |
|
254 | 254 | <<<EOD |
255 | 255 | select b.COLUMN_NAME as consrc, |
256 | 256 | a.CONSTRAINT_TYPE as contype |
@@ -261,24 +261,24 @@ discard block |
||
261 | 261 | and a.CONSTRAINT_TYPE in ('P','R') |
262 | 262 | EOD; |
263 | 263 | $this->getDbConnection()->setActive(true); |
264 | - $command = $this->getDbConnection()->createCommand($sql); |
|
264 | + $command=$this->getDbConnection()->createCommand($sql); |
|
265 | 265 | //$command->bindValue(':table', $tableName); |
266 | 266 | //$command->bindValue(':schema', $schemaName); |
267 | - $primary = []; |
|
268 | - $foreign = []; |
|
267 | + $primary=[]; |
|
268 | + $foreign=[]; |
|
269 | 269 | foreach($command->query() as $row) |
270 | 270 | { |
271 | 271 | switch(strtolower($row['contype'])) |
272 | 272 | { |
273 | 273 | case 'p': |
274 | - $primary = array_merge($primary, [strtolower($row['consrc'])]); |
|
274 | + $primary=array_merge($primary, [strtolower($row['consrc'])]); |
|
275 | 275 | /* |
276 | 276 | $arr = $this->getPrimaryKeys($row['consrc']); |
277 | 277 | $primary = array_merge( $primary, array(strtolower( $arr[0] )) ); |
278 | 278 | */ |
279 | 279 | break; |
280 | 280 | case 'r': |
281 | - $foreign = array_merge($foreign, [strtolower($row['consrc'])]); |
|
281 | + $foreign=array_merge($foreign, [strtolower($row['consrc'])]); |
|
282 | 282 | /* |
283 | 283 | // if(($fkey = $this->getForeignKeys($row['consrc']))!==null) |
284 | 284 | $fkey = $this->getForeignKeys( $row['consrc'] ); |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | break; |
288 | 288 | } |
289 | 289 | } |
290 | - return [$primary,$foreign]; |
|
290 | + return [$primary, $foreign]; |
|
291 | 291 | } |
292 | 292 | |
293 | 293 | /** |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | */ |
298 | 298 | protected function getPrimaryKeys($src) |
299 | 299 | { |
300 | - $matches = []; |
|
300 | + $matches=[]; |
|
301 | 301 | if(preg_match('/PRIMARY\s+KEY\s+\(([^\)]+)\)/i', $src, $matches)) |
302 | 302 | return preg_split('/,\s+/', $matches[1]); |
303 | 303 | return []; |
@@ -310,15 +310,15 @@ discard block |
||
310 | 310 | */ |
311 | 311 | protected function getForeignKeys($src) |
312 | 312 | { |
313 | - $matches = []; |
|
314 | - $brackets = '\(([^\)]+)\)'; |
|
315 | - $find = "/FOREIGN\s+KEY\s+{$brackets}\s+REFERENCES\s+([^\(]+){$brackets}/i"; |
|
313 | + $matches=[]; |
|
314 | + $brackets='\(([^\)]+)\)'; |
|
315 | + $find="/FOREIGN\s+KEY\s+{$brackets}\s+REFERENCES\s+([^\(]+){$brackets}/i"; |
|
316 | 316 | if(preg_match($find, $src, $matches)) |
317 | 317 | { |
318 | - $keys = preg_split('/,\s+/', $matches[1]); |
|
319 | - $fkeys = []; |
|
318 | + $keys=preg_split('/,\s+/', $matches[1]); |
|
319 | + $fkeys=[]; |
|
320 | 320 | foreach(preg_split('/,\s+/', $matches[3]) as $i => $fkey) |
321 | - $fkeys[$keys[$i]] = $fkey; |
|
321 | + $fkeys[$keys[$i]]=$fkey; |
|
322 | 322 | return ['table' => str_replace('"', '', $matches[2]), 'keys' => $fkeys]; |
323 | 323 | } |
324 | 324 | } |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | if($schema===$this->getDefaultSchema() || $schema==='') |
372 | 372 | $names[]=$row['TABLE_NAME']; |
373 | 373 | else |
374 | - $names[]=$row['TABLE_SCHEMA'] . '.' . $row['TABLE_NAME']; |
|
374 | + $names[]=$row['TABLE_SCHEMA'].'.'.$row['TABLE_NAME']; |
|
375 | 375 | } |
376 | 376 | return $names; |
377 | 377 | } |
@@ -35,7 +35,7 @@ |
||
35 | 35 | */ |
36 | 36 | public function getPHPType() |
37 | 37 | { |
38 | - $dbtype = strtolower($this->getDbType()); |
|
38 | + $dbtype=strtolower($this->getDbType()); |
|
39 | 39 | foreach(self::$types as $type => $dbtypes) |
40 | 40 | { |
41 | 41 | if(in_array($dbtype, $dbtypes)) |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | public function getTypeHandlers() |
89 | 89 | { |
90 | 90 | if($this->_typeHandlers===null) |
91 | - $this->_typeHandlers= new TSqlMapTypeHandlerRegistry(); |
|
91 | + $this->_typeHandlers=new TSqlMapTypeHandlerRegistry(); |
|
92 | 92 | return $this->_typeHandlers; |
93 | 93 | } |
94 | 94 | |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | */ |
109 | 109 | public function configureXml($file) |
110 | 110 | { |
111 | - $config = new TSqlMapXmlConfiguration($this); |
|
111 | + $config=new TSqlMapXmlConfiguration($this); |
|
112 | 112 | $config->configure($file); |
113 | 113 | } |
114 | 114 | |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | */ |
119 | 119 | public function getCacheDependencies() |
120 | 120 | { |
121 | - if($this->_cacheDependencies === null) |
|
121 | + if($this->_cacheDependencies===null) |
|
122 | 122 | $this->_cacheDependencies=new TChainedCacheDependency(); |
123 | 123 | |
124 | 124 | return $this->_cacheDependencies; |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | */ |
151 | 151 | public function getMappedStatement($name) |
152 | 152 | { |
153 | - if($this->_mappedStatements->contains($name) == false) |
|
153 | + if($this->_mappedStatements->contains($name)==false) |
|
154 | 154 | throw new TSqlMapUndefinedException('sqlmap_contains_no_statement', $name); |
155 | 155 | return $this->_mappedStatements[$name]; |
156 | 156 | } |
@@ -163,8 +163,8 @@ discard block |
||
163 | 163 | */ |
164 | 164 | public function addMappedStatement(IMappedStatement $statement) |
165 | 165 | { |
166 | - $key = $statement->getID(); |
|
167 | - if($this->_mappedStatements->contains($key) == true) |
|
166 | + $key=$statement->getID(); |
|
167 | + if($this->_mappedStatements->contains($key)==true) |
|
168 | 168 | throw new TSqlMapDuplicateException('sqlmap_already_contains_statement', $key); |
169 | 169 | $this->_mappedStatements->add($key, $statement); |
170 | 170 | } |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | */ |
186 | 186 | public function getResultMap($name) |
187 | 187 | { |
188 | - if($this->_resultMaps->contains($name) == false) |
|
188 | + if($this->_resultMaps->contains($name)==false) |
|
189 | 189 | throw new TSqlMapUndefinedException('sqlmap_contains_no_result_map', $name); |
190 | 190 | return $this->_resultMaps[$name]; |
191 | 191 | } |
@@ -196,8 +196,8 @@ discard block |
||
196 | 196 | */ |
197 | 197 | public function addResultMap(TResultMap $result) |
198 | 198 | { |
199 | - $key = $result->getID(); |
|
200 | - if($this->_resultMaps->contains($key) == true) |
|
199 | + $key=$result->getID(); |
|
200 | + if($this->_resultMaps->contains($key)==true) |
|
201 | 201 | throw new TSqlMapDuplicateException('sqlmap_already_contains_result_map', $key); |
202 | 202 | $this->_resultMaps->add($key, $result); |
203 | 203 | } |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | */ |
218 | 218 | public function getParameterMap($name) |
219 | 219 | { |
220 | - if($this->_parameterMaps->contains($name) == false) |
|
220 | + if($this->_parameterMaps->contains($name)==false) |
|
221 | 221 | throw new TSqlMapUndefinedException('sqlmap_contains_no_parameter_map', $name); |
222 | 222 | return $this->_parameterMaps[$name]; |
223 | 223 | } |
@@ -228,8 +228,8 @@ discard block |
||
228 | 228 | */ |
229 | 229 | public function addParameterMap(TParameterMap $parameter) |
230 | 230 | { |
231 | - $key = $parameter->getID(); |
|
232 | - if($this->_parameterMaps->contains($key) == true) |
|
231 | + $key=$parameter->getID(); |
|
232 | + if($this->_parameterMaps->contains($key)==true) |
|
233 | 233 | throw new TSqlMapDuplicateException('sqlmap_already_contains_parameter_map', $key); |
234 | 234 | $this->_parameterMaps->add($key, $parameter); |
235 | 235 | } |
@@ -61,6 +61,7 @@ discard block |
||
61 | 61 | * Constructor, create a new SqlMap manager. |
62 | 62 | * @param TDbConnection database connection |
63 | 63 | * @param string configuration file. |
64 | + * @param \Prado\Data\TDbConnection $connection |
|
64 | 65 | */ |
65 | 66 | public function __construct($connection=null) |
66 | 67 | { |
@@ -74,6 +75,7 @@ discard block |
||
74 | 75 | |
75 | 76 | /** |
76 | 77 | * @param TDbConnection default database connection |
78 | + * @param \Prado\Data\TDbConnection $conn |
|
77 | 79 | */ |
78 | 80 | public function setDbConnection($conn) |
79 | 81 | { |
@@ -111,6 +113,7 @@ discard block |
||
111 | 113 | /** |
112 | 114 | * Loads and parses the SqlMap configuration file. |
113 | 115 | * @param string xml configuration file. |
116 | + * @param string $file |
|
114 | 117 | */ |
115 | 118 | public function configureXml($file) |
116 | 119 | { |