@@ -77,13 +77,13 @@ discard block |
||
77 | 77 | */ |
78 | 78 | protected function collectForeignObjects(&$results) |
79 | 79 | { |
80 | - $fkeys = $this->getRelationForeignKeys(); |
|
80 | + $fkeys=$this->getRelationForeignKeys(); |
|
81 | 81 | |
82 | - $properties = array_keys($fkeys); |
|
83 | - $fields = array_values($fkeys); |
|
84 | - $indexValues = $this->getIndexValues($properties, $results); |
|
85 | - $fkObjects = $this->findForeignObjects($fields, $indexValues); |
|
86 | - $this->populateResult($results,$properties,$fkObjects,$fields); |
|
82 | + $properties=array_keys($fkeys); |
|
83 | + $fields=array_values($fkeys); |
|
84 | + $indexValues=$this->getIndexValues($properties, $results); |
|
85 | + $fkObjects=$this->findForeignObjects($fields, $indexValues); |
|
86 | + $this->populateResult($results, $properties, $fkObjects, $fields); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | /** |
@@ -92,8 +92,8 @@ discard block |
||
92 | 92 | */ |
93 | 93 | public function getRelationForeignKeys() |
94 | 94 | { |
95 | - $fkObject = $this->getContext()->getForeignRecordFinder(); |
|
96 | - return $this->findForeignKeys($this->getSourceRecord(),$fkObject); |
|
95 | + $fkObject=$this->getContext()->getForeignRecordFinder(); |
|
96 | + return $this->findForeignKeys($this->getSourceRecord(), $fkObject); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | /** |
@@ -103,8 +103,8 @@ discard block |
||
103 | 103 | */ |
104 | 104 | protected function setObjectProperty($source, $properties, &$collections) |
105 | 105 | { |
106 | - $hash = $this->getObjectHash($source, $properties); |
|
107 | - $prop = $this->getContext()->getProperty(); |
|
106 | + $hash=$this->getObjectHash($source, $properties); |
|
107 | + $prop=$this->getContext()->getProperty(); |
|
108 | 108 | if(isset($collections[$hash]) && count($collections[$hash]) > 0) |
109 | 109 | { |
110 | 110 | if(count($collections[$hash]) > 1) |
@@ -121,13 +121,13 @@ discard block |
||
121 | 121 | */ |
122 | 122 | public function updateAssociatedRecords() |
123 | 123 | { |
124 | - $obj = $this->getContext()->getSourceRecord(); |
|
125 | - $fkObject = $obj->getColumnValue($this->getContext()->getProperty()); |
|
124 | + $obj=$this->getContext()->getSourceRecord(); |
|
125 | + $fkObject=$obj->getColumnValue($this->getContext()->getProperty()); |
|
126 | 126 | if($fkObject!==null) |
127 | 127 | { |
128 | 128 | $fkObject->save(); |
129 | - $source = $this->getSourceRecord(); |
|
130 | - $fkeys = $this->findForeignKeys($source, $fkObject); |
|
129 | + $source=$this->getSourceRecord(); |
|
130 | + $fkeys=$this->findForeignKeys($source, $fkObject); |
|
131 | 131 | foreach($fkeys as $srcKey => $fKey) |
132 | 132 | $source->setColumnValue($srcKey, $fkObject->getColumnValue($fKey)); |
133 | 133 | return true; |
@@ -58,8 +58,7 @@ |
||
58 | 58 | if ($this->sourcepath === NULL) |
59 | 59 | { |
60 | 60 | $this->sourcepath = $sourcepath; |
61 | - } |
|
62 | - else |
|
61 | + } else |
|
63 | 62 | { |
64 | 63 | $this->sourcepath->append($sourcepath); |
65 | 64 | } |
@@ -75,14 +75,14 @@ discard block |
||
75 | 75 | */ |
76 | 76 | protected function collectForeignObjects(&$results) |
77 | 77 | { |
78 | - $fkeys = $this->getRelationForeignKeys(); |
|
78 | + $fkeys=$this->getRelationForeignKeys(); |
|
79 | 79 | |
80 | - $properties = array_values($fkeys); |
|
81 | - $fields = array_keys($fkeys); |
|
80 | + $properties=array_values($fkeys); |
|
81 | + $fields=array_keys($fkeys); |
|
82 | 82 | |
83 | - $indexValues = $this->getIndexValues($properties, $results); |
|
84 | - $fkObjects = $this->findForeignObjects($fields,$indexValues); |
|
85 | - $this->populateResult($results,$properties,$fkObjects,$fields); |
|
83 | + $indexValues=$this->getIndexValues($properties, $results); |
|
84 | + $fkObjects=$this->findForeignObjects($fields, $indexValues); |
|
85 | + $this->populateResult($results, $properties, $fkObjects, $fields); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | /** |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | */ |
92 | 92 | public function getRelationForeignKeys() |
93 | 93 | { |
94 | - $fkObject = $this->getContext()->getForeignRecordFinder(); |
|
94 | + $fkObject=$this->getContext()->getForeignRecordFinder(); |
|
95 | 95 | return $this->findForeignKeys($fkObject, $this->getSourceRecord()); |
96 | 96 | } |
97 | 97 | |
@@ -101,18 +101,18 @@ discard block |
||
101 | 101 | */ |
102 | 102 | public function updateAssociatedRecords() |
103 | 103 | { |
104 | - $obj = $this->getContext()->getSourceRecord(); |
|
105 | - $fkObjects = &$obj->{$this->getContext()->getProperty()}; |
|
104 | + $obj=$this->getContext()->getSourceRecord(); |
|
105 | + $fkObjects=&$obj->{$this->getContext()->getProperty()}; |
|
106 | 106 | $success=true; |
107 | - if(($total = count($fkObjects))> 0) |
|
107 | + if(($total=count($fkObjects)) > 0) |
|
108 | 108 | { |
109 | - $source = $this->getSourceRecord(); |
|
110 | - $fkeys = $this->findForeignKeys($fkObjects[0], $source); |
|
111 | - for($i=0;$i<$total;$i++) |
|
109 | + $source=$this->getSourceRecord(); |
|
110 | + $fkeys=$this->findForeignKeys($fkObjects[0], $source); |
|
111 | + for($i=0; $i < $total; $i++) |
|
112 | 112 | { |
113 | 113 | foreach($fkeys as $fKey => $srcKey) |
114 | 114 | $fkObjects[$i]->setColumnValue($fKey, $source->getColumnValue($srcKey)); |
115 | - $success = $fkObjects[$i]->save() && $success; |
|
115 | + $success=$fkObjects[$i]->save() && $success; |
|
116 | 116 | } |
117 | 117 | } |
118 | 118 | return $success; |
@@ -92,13 +92,13 @@ discard block |
||
92 | 92 | */ |
93 | 93 | protected function collectForeignObjects(&$results) |
94 | 94 | { |
95 | - $fkeys = $this->getRelationForeignKeys(); |
|
96 | - $properties = array_values($fkeys); |
|
97 | - $fields = array_keys($fkeys); |
|
95 | + $fkeys=$this->getRelationForeignKeys(); |
|
96 | + $properties=array_values($fkeys); |
|
97 | + $fields=array_keys($fkeys); |
|
98 | 98 | |
99 | - $indexValues = $this->getIndexValues($properties, $results); |
|
100 | - $fkObjects = $this->findForeignObjects($fields,$indexValues); |
|
101 | - $this->populateResult($results,$properties,$fkObjects,$fields); |
|
99 | + $indexValues=$this->getIndexValues($properties, $results); |
|
100 | + $fkObjects=$this->findForeignObjects($fields, $indexValues); |
|
101 | + $this->populateResult($results, $properties, $fkObjects, $fields); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | /** |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | */ |
108 | 108 | public function getRelationForeignKeys() |
109 | 109 | { |
110 | - $fkObject = $this->getContext()->getForeignRecordFinder(); |
|
110 | + $fkObject=$this->getContext()->getForeignRecordFinder(); |
|
111 | 111 | return $this->findForeignKeys($fkObject, $this->getSourceRecord()); |
112 | 112 | } |
113 | 113 | |
@@ -118,8 +118,8 @@ discard block |
||
118 | 118 | */ |
119 | 119 | protected function setObjectProperty($source, $properties, &$collections) |
120 | 120 | { |
121 | - $hash = $this->getObjectHash($source, $properties); |
|
122 | - $prop = $this->getContext()->getProperty(); |
|
121 | + $hash=$this->getObjectHash($source, $properties); |
|
122 | + $prop=$this->getContext()->getProperty(); |
|
123 | 123 | if(isset($collections[$hash]) && count($collections[$hash]) > 0) |
124 | 124 | { |
125 | 125 | if(count($collections[$hash]) > 1) |
@@ -134,9 +134,9 @@ discard block |
||
134 | 134 | */ |
135 | 135 | public function updateAssociatedRecords() |
136 | 136 | { |
137 | - $fkObject = $this->getContext()->getPropertyValue(); |
|
138 | - $source = $this->getSourceRecord(); |
|
139 | - $fkeys = $this->findForeignKeys($fkObject, $source); |
|
137 | + $fkObject=$this->getContext()->getPropertyValue(); |
|
138 | + $source=$this->getSourceRecord(); |
|
139 | + $fkeys=$this->findForeignKeys($fkObject, $source); |
|
140 | 140 | foreach($fkeys as $fKey => $srcKey) |
141 | 141 | $fkObject->setColumnValue($fKey, $source->getColumnValue($srcKey)); |
142 | 142 | return $fkObject->save(); |
@@ -1,14 +1,14 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * TActiveRecordHasOne class file. |
|
4 | - * |
|
5 | - * @author Wei Zhuo <weizhuo[at]gmail[dot]com> |
|
6 | - * @link https://github.com/pradosoft/prado |
|
7 | - * @copyright Copyright © 2005-2016 The PRADO Group |
|
8 | - * @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT |
|
9 | - * @version $Id$ |
|
10 | - * @package System.Data.ActiveRecord.Relations |
|
11 | - */ |
|
3 | + * TActiveRecordHasOne class file. |
|
4 | + * |
|
5 | + * @author Wei Zhuo <weizhuo[at]gmail[dot]com> |
|
6 | + * @link https://github.com/pradosoft/prado |
|
7 | + * @copyright Copyright © 2005-2016 The PRADO Group |
|
8 | + * @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT |
|
9 | + * @version $Id$ |
|
10 | + * @package System.Data.ActiveRecord.Relations |
|
11 | + */ |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * Loads base active record relationship class. |
@@ -90,7 +90,7 @@ |
||
90 | 90 | * Handle the "edit" and "new" commands by displaying the edit view. |
91 | 91 | * Default command shows the list view. |
92 | 92 | */ |
93 | - public function bubbleEvent($sender,$param) |
|
93 | + public function bubbleEvent($sender, $param) |
|
94 | 94 | { |
95 | 95 | switch(strtolower($param->getCommandName())) |
96 | 96 | { |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | case 'char': case 'varchar': |
30 | 30 | return $this->createMultiLineControl($container, $column, $record); |
31 | 31 | default: |
32 | - return $this->createDefaultControl($container,$column, $record); |
|
32 | + return $this->createDefaultControl($container, $column, $record); |
|
33 | 33 | } |
34 | 34 | } |
35 | 35 | |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | case 'timestamp': |
45 | 45 | return $this->getDateTimeValue($container, $column, $record); |
46 | 46 | default: |
47 | - return $this->getDefaultControlValue($container,$column, $record); |
|
47 | + return $this->getDefaultControlValue($container, $column, $record); |
|
48 | 48 | } |
49 | 49 | } |
50 | 50 | } |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | case 'datetime': case 'smalldatetime': |
27 | 27 | return $this->createDateTimeControl($container, $column, $record); |
28 | 28 | default: |
29 | - $control = $this->createDefaultControl($container,$column, $record); |
|
29 | + $control=$this->createDefaultControl($container, $column, $record); |
|
30 | 30 | if($column->getIsExcluded()) |
31 | 31 | $control->setEnabled(false); |
32 | 32 | return $control; |
@@ -40,9 +40,9 @@ discard block |
||
40 | 40 | case 'boolean': |
41 | 41 | return $container->findControl(self::DEFAULT_ID)->getChecked(); |
42 | 42 | case 'datetime': case 'smalldatetime': |
43 | - return $this->getDateTimeValue($container,$column, $record); |
|
43 | + return $this->getDateTimeValue($container, $column, $record); |
|
44 | 44 | default: |
45 | - $value = $this->getDefaultControlValue($container,$column, $record); |
|
45 | + $value=$this->getDefaultControlValue($container, $column, $record); |
|
46 | 46 | if(trim($value)==='' && $column->getAllowNull()) |
47 | 47 | return null; |
48 | 48 | else |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | case 'timestamp without time zone': |
31 | 31 | return $this->createDateTimeControl($container, $column, $record); |
32 | 32 | default: |
33 | - return $this->createDefaultControl($container,$column, $record); |
|
33 | + return $this->createDefaultControl($container, $column, $record); |
|
34 | 34 | } |
35 | 35 | } |
36 | 36 | |
@@ -45,9 +45,9 @@ discard block |
||
45 | 45 | case 'time without time zone': |
46 | 46 | return $this->getTimeValue($container, $column, $record); |
47 | 47 | case 'timestamp without time zone': |
48 | - return $this->getDateTimeValue($container,$column, $record); |
|
48 | + return $this->getDateTimeValue($container, $column, $record); |
|
49 | 49 | default: |
50 | - return $this->getDefaultControlValue($container,$column, $record); |
|
50 | + return $this->getDefaultControlValue($container, $column, $record); |
|
51 | 51 | } |
52 | 52 | } |
53 | 53 | } |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | { |
14 | 14 | protected function createControl($container, $column, $record) |
15 | 15 | { |
16 | - $dbtype = trim(str_replace(array('unsigned', 'zerofill'),array('','',),strtolower($column->getDbType()))); |
|
16 | + $dbtype=trim(str_replace(array('unsigned', 'zerofill'), array('', '',), strtolower($column->getDbType()))); |
|
17 | 17 | switch($dbtype) |
18 | 18 | { |
19 | 19 | case 'date': |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | |
43 | 43 | protected function getControlValue($container, $column, $record) |
44 | 44 | { |
45 | - $dbtype = trim(str_replace(array('unsigned', 'zerofill'),array('','',),strtolower($column->getDbType()))); |
|
45 | + $dbtype=trim(str_replace(array('unsigned', 'zerofill'), array('', '',), strtolower($column->getDbType()))); |
|
46 | 46 | switch($dbtype) |
47 | 47 | { |
48 | 48 | case 'date': |
@@ -52,15 +52,15 @@ discard block |
||
52 | 52 | case 'time': |
53 | 53 | return $this->getTimeValue($container, $column, $record); |
54 | 54 | case 'datetime': case 'timestamp': |
55 | - return $this->getDateTimeValue($container,$column, $record); |
|
55 | + return $this->getDateTimeValue($container, $column, $record); |
|
56 | 56 | case 'tinyint': |
57 | - return $this->getIntBooleanValue($container,$column, $record); |
|
57 | + return $this->getIntBooleanValue($container, $column, $record); |
|
58 | 58 | case 'set': |
59 | 59 | return $this->getSetValue($container, $column, $record); |
60 | 60 | case 'enum': |
61 | 61 | return $this->getEnumValue($container, $column, $record); |
62 | 62 | default: |
63 | - return $this->getDefaultControlValue($container,$column, $record); |
|
63 | + return $this->getDefaultControlValue($container, $column, $record); |
|
64 | 64 | } |
65 | 65 | } |
66 | 66 | |
@@ -72,12 +72,12 @@ discard block |
||
72 | 72 | parent::createIntegerControl($container, $column, $record); |
73 | 73 | } |
74 | 74 | |
75 | - protected function getIntBooleanValue($container,$column, $record) |
|
75 | + protected function getIntBooleanValue($container, $column, $record) |
|
76 | 76 | { |
77 | 77 | if($column->getColumnSize()==1) |
78 | - return (int)$container->findControl(self::DEFAULT_ID)->getChecked(); |
|
78 | + return (int) $container->findControl(self::DEFAULT_ID)->getChecked(); |
|
79 | 79 | else |
80 | - return $this->getDefaultControlValue($container,$column, $record); |
|
80 | + return $this->getDefaultControlValue($container, $column, $record); |
|
81 | 81 | } |
82 | 82 | } |
83 | 83 |
@@ -45,10 +45,10 @@ discard block |
||
45 | 45 | */ |
46 | 46 | protected function getListView() |
47 | 47 | { |
48 | - if($this->_list===null && ($id = $this->getListViewID()) !== null) |
|
48 | + if($this->_list===null && ($id=$this->getListViewID())!==null) |
|
49 | 49 | { |
50 | - $this->_list = $this->getParent()->findControl($id); |
|
51 | - if($this->_list ===null) |
|
50 | + $this->_list=$this->getParent()->findControl($id); |
|
51 | + if($this->_list===null) |
|
52 | 52 | throw new TConfigurationException('scaffold_unable_to_find_list_view', $id); |
53 | 53 | } |
54 | 54 | return $this->_list; |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | { |
79 | 79 | if(strtolower($param->getCommandName())==='search') |
80 | 80 | { |
81 | - if(($list = $this->getListView()) !== null) |
|
81 | + if(($list=$this->getListView())!==null) |
|
82 | 82 | { |
83 | 83 | $list->setSearchCondition($this->createSearchCondition()); |
84 | 84 | return false; |
@@ -93,10 +93,10 @@ discard block |
||
93 | 93 | */ |
94 | 94 | protected function createSearchCondition() |
95 | 95 | { |
96 | - $table = $this->getTableInfo(); |
|
96 | + $table=$this->getTableInfo(); |
|
97 | 97 | if(strlen($str=$this->getSearchText()->getText()) > 0) |
98 | 98 | { |
99 | - $builder = $table->createCommandBuilder($this->getRecordFinder()->getDbConnection()); |
|
99 | + $builder=$table->createCommandBuilder($this->getRecordFinder()->getDbConnection()); |
|
100 | 100 | return $builder->getSearchExpression($this->getFields(), $str); |
101 | 101 | } |
102 | 102 | } |
@@ -106,10 +106,10 @@ discard block |
||
106 | 106 | */ |
107 | 107 | protected function getFields() |
108 | 108 | { |
109 | - if(strlen(trim($str=$this->getSearchableFields()))>0) |
|
110 | - $fields = preg_split('/\s*,\s*/', $str); |
|
109 | + if(strlen(trim($str=$this->getSearchableFields())) > 0) |
|
110 | + $fields=preg_split('/\s*,\s*/', $str); |
|
111 | 111 | else |
112 | - $fields = $this->getTableInfo()->getColumns()->getKeys(); |
|
112 | + $fields=$this->getTableInfo()->getColumns()->getKeys(); |
|
113 | 113 | return $fields; |
114 | 114 | } |
115 | 115 | |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | */ |
119 | 119 | public function getSearchableFields() |
120 | 120 | { |
121 | - return $this->getViewState('SearchableFields',''); |
|
121 | + return $this->getViewState('SearchableFields', ''); |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | /** |