@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | { |
63 | 63 | $db=$this->getDbConnection(); |
64 | 64 | foreach($xml['database'] as $name=>$value) |
65 | - $db->setSubProperty($name,$value); |
|
65 | + $db->setSubProperty($name, $value); |
|
66 | 66 | } |
67 | 67 | } |
68 | 68 | else |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | { |
72 | 72 | $db=$this->getDbConnection(); |
73 | 73 | foreach($prop->getAttributes() as $name=>$value) |
74 | - $db->setSubproperty($name,$value); |
|
74 | + $db->setSubproperty($name, $value); |
|
75 | 75 | } |
76 | 76 | } |
77 | 77 | } |
@@ -106,9 +106,9 @@ discard block |
||
106 | 106 | if($this->_conn===null) |
107 | 107 | { |
108 | 108 | if($this->_connID!=='') |
109 | - $this->_conn = $this->findConnectionByID($this->getConnectionID()); |
|
109 | + $this->_conn=$this->findConnectionByID($this->getConnectionID()); |
|
110 | 110 | else |
111 | - $this->_conn = Prado::createComponent($this->getConnectionClass()); |
|
111 | + $this->_conn=Prado::createComponent($this->getConnectionClass()); |
|
112 | 112 | } |
113 | 113 | return $this->_conn; |
114 | 114 | } |
@@ -154,12 +154,12 @@ discard block |
||
154 | 154 | */ |
155 | 155 | protected function findConnectionByID($id) |
156 | 156 | { |
157 | - $conn = $this->getApplication()->getModule($id); |
|
157 | + $conn=$this->getApplication()->getModule($id); |
|
158 | 158 | if($conn instanceof TDbConnection) |
159 | 159 | return $conn; |
160 | 160 | else if($conn instanceof TDataSourceConfig) |
161 | 161 | return $conn->getDbConnection(); |
162 | 162 | else |
163 | - throw new TConfigurationException('datasource_dbconnection_invalid',$id); |
|
163 | + throw new TConfigurationException('datasource_dbconnection_invalid', $id); |
|
164 | 164 | } |
165 | 165 | } |
@@ -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; |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | |
49 | 49 | public function getPropertyValue() |
50 | 50 | { |
51 | - $obj = $this->getSourceRecord(); |
|
51 | + $obj=$this->getSourceRecord(); |
|
52 | 52 | return $obj->getColumnValue($this->getProperty()); |
53 | 53 | } |
54 | 54 | |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | */ |
112 | 112 | public function getCondition() |
113 | 113 | { |
114 | - return isset($this->_relation[3])?$this->_relation[3]:null; |
|
114 | + return isset($this->_relation[3]) ? $this->_relation[3] : null; |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | /** |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | */ |
121 | 121 | public function getParameters() |
122 | 122 | { |
123 | - return isset($this->_relation[4])?$this->_relation[4]:array(); |
|
123 | + return isset($this->_relation[4]) ? $this->_relation[4] : array(); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | /** |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | */ |
130 | 130 | public function hasFkField() |
131 | 131 | { |
132 | - $notManyToMany = $this->getRelationType() !== TActiveRecord::MANY_TO_MANY; |
|
132 | + $notManyToMany=$this->getRelationType()!==TActiveRecord::MANY_TO_MANY; |
|
133 | 133 | return $notManyToMany && isset($this->_relation[2]) && !empty($this->_relation[2]); |
134 | 134 | } |
135 | 135 | |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | */ |
147 | 147 | public function hasAssociationTable() |
148 | 148 | { |
149 | - $isManyToMany = $this->getRelationType() === TActiveRecord::MANY_TO_MANY; |
|
149 | + $isManyToMany=$this->getRelationType()===TActiveRecord::MANY_TO_MANY; |
|
150 | 150 | return $isManyToMany && isset($this->_relation[2]) && !empty($this->_relation[2]); |
151 | 151 | } |
152 | 152 | |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | $this->_property, get_class($this->_record), 'RELATIONS'); |
175 | 175 | } |
176 | 176 | if($criteria===null) |
177 | - $criteria = new TActiveRecordCriteria($this->getCondition(), $this->getParameters()); |
|
177 | + $criteria=new TActiveRecordCriteria($this->getCondition(), $this->getParameters()); |
|
178 | 178 | switch($this->getRelationType()) |
179 | 179 | { |
180 | 180 | case TActiveRecord::HAS_MANY: |
@@ -202,15 +202,15 @@ discard block |
||
202 | 202 | $success=true; |
203 | 203 | foreach($this->_record->getRecordRelations() as $data) |
204 | 204 | { |
205 | - list($property, $relation) = $data; |
|
206 | - $belongsTo = $relation[0]==TActiveRecord::BELONGS_TO; |
|
205 | + list($property, $relation)=$data; |
|
206 | + $belongsTo=$relation[0]==TActiveRecord::BELONGS_TO; |
|
207 | 207 | if(($updateBelongsTo && $belongsTo) || (!$updateBelongsTo && !$belongsTo)) |
208 | 208 | { |
209 | - $obj = $this->getSourceRecord(); |
|
209 | + $obj=$this->getSourceRecord(); |
|
210 | 210 | if(!$this->isEmptyFkObject($obj->getColumnValue($property))) |
211 | 211 | { |
212 | - $context = new TActiveRecordRelationContext($this->getSourceRecord(),$property,$relation); |
|
213 | - $success = $context->getRelationHandler()->updateAssociatedRecords() && $success; |
|
212 | + $context=new TActiveRecordRelationContext($this->getSourceRecord(), $property, $relation); |
|
213 | + $success=$context->getRelationHandler()->updateAssociatedRecords() && $success; |
|
214 | 214 | } |
215 | 215 | } |
216 | 216 | } |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | protected function isEmptyFkObject($obj) |
221 | 221 | { |
222 | 222 | if(is_object($obj)) |
223 | - return $obj instanceof TList ? $obj->count() === 0 : false; |
|
223 | + return $obj instanceof TList ? $obj->count()===0 : false; |
|
224 | 224 | else if(is_array($obj)) |
225 | 225 | return count($obj)===0; |
226 | 226 | else |
@@ -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; |
@@ -96,10 +96,10 @@ discard block |
||
96 | 96 | */ |
97 | 97 | protected function collectForeignObjects(&$results) |
98 | 98 | { |
99 | - list($sourceKeys, $foreignKeys) = $this->getRelationForeignKeys(); |
|
100 | - $properties = array_values($sourceKeys); |
|
101 | - $indexValues = $this->getIndexValues($properties, $results); |
|
102 | - $this->fetchForeignObjects($results, $foreignKeys,$indexValues,$sourceKeys); |
|
99 | + list($sourceKeys, $foreignKeys)=$this->getRelationForeignKeys(); |
|
100 | + $properties=array_values($sourceKeys); |
|
101 | + $indexValues=$this->getIndexValues($properties, $results); |
|
102 | + $this->fetchForeignObjects($results, $foreignKeys, $indexValues, $sourceKeys); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | /** |
@@ -107,10 +107,10 @@ discard block |
||
107 | 107 | */ |
108 | 108 | public function getRelationForeignKeys() |
109 | 109 | { |
110 | - $association = $this->getAssociationTable(); |
|
111 | - $sourceKeys = $this->findForeignKeys($association, $this->getSourceRecord(), true); |
|
112 | - $fkObject = $this->getContext()->getForeignRecordFinder(); |
|
113 | - $foreignKeys = $this->findForeignKeys($association, $fkObject); |
|
110 | + $association=$this->getAssociationTable(); |
|
111 | + $sourceKeys=$this->findForeignKeys($association, $this->getSourceRecord(), true); |
|
112 | + $fkObject=$this->getContext()->getForeignRecordFinder(); |
|
113 | + $foreignKeys=$this->findForeignKeys($association, $fkObject); |
|
114 | 114 | return array($sourceKeys, $foreignKeys); |
115 | 115 | } |
116 | 116 | |
@@ -121,16 +121,16 @@ discard block |
||
121 | 121 | { |
122 | 122 | if($this->_association===null) |
123 | 123 | { |
124 | - $gateway = $this->getSourceRecord()->getRecordGateway(); |
|
125 | - $conn = $this->getSourceRecord()->getDbConnection(); |
|
124 | + $gateway=$this->getSourceRecord()->getRecordGateway(); |
|
125 | + $conn=$this->getSourceRecord()->getDbConnection(); |
|
126 | 126 | //table name may include the fk column name separated with a dot. |
127 | - $table = explode('.', $this->getContext()->getAssociationTable()); |
|
128 | - if(count($table)>1) |
|
127 | + $table=explode('.', $this->getContext()->getAssociationTable()); |
|
128 | + if(count($table) > 1) |
|
129 | 129 | { |
130 | - $columns = preg_replace('/^\((.*)\)/', '\1', $table[1]); |
|
131 | - $this->_association_columns = preg_split('/\s*[, ]\*/',$columns); |
|
130 | + $columns=preg_replace('/^\((.*)\)/', '\1', $table[1]); |
|
131 | + $this->_association_columns=preg_split('/\s*[, ]\*/', $columns); |
|
132 | 132 | } |
133 | - $this->_association = $gateway->getTableInfo($conn, $table[0]); |
|
133 | + $this->_association=$gateway->getTableInfo($conn, $table[0]); |
|
134 | 134 | } |
135 | 135 | return $this->_association; |
136 | 136 | } |
@@ -142,8 +142,8 @@ discard block |
||
142 | 142 | { |
143 | 143 | if($this->_sourceTable===null) |
144 | 144 | { |
145 | - $gateway = $this->getSourceRecord()->getRecordGateway(); |
|
146 | - $this->_sourceTable = $gateway->getRecordTableInfo($this->getSourceRecord()); |
|
145 | + $gateway=$this->getSourceRecord()->getRecordGateway(); |
|
146 | + $this->_sourceTable=$gateway->getRecordTableInfo($this->getSourceRecord()); |
|
147 | 147 | } |
148 | 148 | return $this->_sourceTable; |
149 | 149 | } |
@@ -155,9 +155,9 @@ discard block |
||
155 | 155 | { |
156 | 156 | if($this->_foreignTable===null) |
157 | 157 | { |
158 | - $gateway = $this->getSourceRecord()->getRecordGateway(); |
|
159 | - $fkObject = $this->getContext()->getForeignRecordFinder(); |
|
160 | - $this->_foreignTable = $gateway->getRecordTableInfo($fkObject); |
|
158 | + $gateway=$this->getSourceRecord()->getRecordGateway(); |
|
159 | + $fkObject=$this->getContext()->getForeignRecordFinder(); |
|
160 | + $this->_foreignTable=$gateway->getRecordTableInfo($fkObject); |
|
161 | 161 | } |
162 | 162 | return $this->_foreignTable; |
163 | 163 | } |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | */ |
176 | 176 | protected function getForeignCommandBuilder() |
177 | 177 | { |
178 | - $obj = $this->getContext()->getForeignRecordFinder(); |
|
178 | + $obj=$this->getContext()->getForeignRecordFinder(); |
|
179 | 179 | return $this->getSourceRecord()->getRecordGateway()->getCommand($obj); |
180 | 180 | } |
181 | 181 | |
@@ -185,21 +185,21 @@ discard block |
||
185 | 185 | * @param array field names |
186 | 186 | * @param array foreign key index values. |
187 | 187 | */ |
188 | - protected function fetchForeignObjects(&$results,$foreignKeys,$indexValues,$sourceKeys) |
|
188 | + protected function fetchForeignObjects(&$results, $foreignKeys, $indexValues, $sourceKeys) |
|
189 | 189 | { |
190 | - $criteria = $this->getCriteria(); |
|
191 | - $finder = $this->getContext()->getForeignRecordFinder(); |
|
192 | - $type = get_class($finder); |
|
193 | - $command = $this->createCommand($criteria, $foreignKeys,$indexValues,$sourceKeys); |
|
194 | - $srcProps = array_keys($sourceKeys); |
|
190 | + $criteria=$this->getCriteria(); |
|
191 | + $finder=$this->getContext()->getForeignRecordFinder(); |
|
192 | + $type=get_class($finder); |
|
193 | + $command=$this->createCommand($criteria, $foreignKeys, $indexValues, $sourceKeys); |
|
194 | + $srcProps=array_keys($sourceKeys); |
|
195 | 195 | $collections=array(); |
196 | 196 | foreach($this->getCommandBuilder()->onExecuteCommand($command, $command->query()) as $row) |
197 | 197 | { |
198 | - $hash = $this->getObjectHash($row, $srcProps); |
|
198 | + $hash=$this->getObjectHash($row, $srcProps); |
|
199 | 199 | foreach($srcProps as $column) |
200 | 200 | unset($row[$column]); |
201 | - $obj = $this->createFkObject($type,$row,$foreignKeys); |
|
202 | - $collections[$hash][] = $obj; |
|
201 | + $obj=$this->createFkObject($type, $row, $foreignKeys); |
|
202 | + $collections[$hash][]=$obj; |
|
203 | 203 | } |
204 | 204 | $this->setResultCollection($results, $collections, array_values($sourceKeys)); |
205 | 205 | } |
@@ -210,9 +210,9 @@ discard block |
||
210 | 210 | * @param array foreign key column names |
211 | 211 | * @return TActiveRecord |
212 | 212 | */ |
213 | - protected function createFkObject($type,$row,$foreignKeys) |
|
213 | + protected function createFkObject($type, $row, $foreignKeys) |
|
214 | 214 | { |
215 | - $obj = TActiveRecord::createRecord($type, $row); |
|
215 | + $obj=TActiveRecord::createRecord($type, $row); |
|
216 | 216 | if(count($this->_association_columns) > 0) |
217 | 217 | { |
218 | 218 | $i=0; |
@@ -228,22 +228,22 @@ discard block |
||
228 | 228 | * @param array field names |
229 | 229 | * @param array field values |
230 | 230 | */ |
231 | - public function createCommand($criteria, $foreignKeys,$indexValues,$sourceKeys) |
|
231 | + public function createCommand($criteria, $foreignKeys, $indexValues, $sourceKeys) |
|
232 | 232 | { |
233 | - $innerJoin = $this->getAssociationJoin($foreignKeys,$indexValues,$sourceKeys); |
|
234 | - $fkTable = $this->getForeignTable()->getTableFullName(); |
|
235 | - $srcColumns = $this->getSourceColumns($sourceKeys); |
|
233 | + $innerJoin=$this->getAssociationJoin($foreignKeys, $indexValues, $sourceKeys); |
|
234 | + $fkTable=$this->getForeignTable()->getTableFullName(); |
|
235 | + $srcColumns=$this->getSourceColumns($sourceKeys); |
|
236 | 236 | if(($where=$criteria->getCondition())===null) |
237 | 237 | $where='1=1'; |
238 | - $sql = "SELECT {$fkTable}.*, {$srcColumns} FROM {$fkTable} {$innerJoin} WHERE {$where}"; |
|
238 | + $sql="SELECT {$fkTable}.*, {$srcColumns} FROM {$fkTable} {$innerJoin} WHERE {$where}"; |
|
239 | 239 | |
240 | - $parameters = $criteria->getParameters()->toArray(); |
|
241 | - $ordering = $criteria->getOrdersBy(); |
|
242 | - $limit = $criteria->getLimit(); |
|
243 | - $offset = $criteria->getOffset(); |
|
240 | + $parameters=$criteria->getParameters()->toArray(); |
|
241 | + $ordering=$criteria->getOrdersBy(); |
|
242 | + $limit=$criteria->getLimit(); |
|
243 | + $offset=$criteria->getOffset(); |
|
244 | 244 | |
245 | - $builder = $this->getForeignCommandBuilder()->getBuilder(); |
|
246 | - $command = $builder->applyCriterias($sql,$parameters,$ordering,$limit,$offset); |
|
245 | + $builder=$this->getForeignCommandBuilder()->getBuilder(); |
|
246 | + $command=$builder->applyCriterias($sql, $parameters, $ordering, $limit, $offset); |
|
247 | 247 | $this->getCommandBuilder()->onCreateCommand($command, $criteria); |
248 | 248 | return $command; |
249 | 249 | } |
@@ -255,11 +255,11 @@ discard block |
||
255 | 255 | protected function getSourceColumns($sourceKeys) |
256 | 256 | { |
257 | 257 | $columns=array(); |
258 | - $table = $this->getAssociationTable(); |
|
259 | - $tableName = $table->getTableFullName(); |
|
260 | - $columnNames = array_merge(array_keys($sourceKeys),$this->_association_columns); |
|
258 | + $table=$this->getAssociationTable(); |
|
259 | + $tableName=$table->getTableFullName(); |
|
260 | + $columnNames=array_merge(array_keys($sourceKeys), $this->_association_columns); |
|
261 | 261 | foreach($columnNames as $name) |
262 | - $columns[] = $tableName.'.'.$table->getColumn($name)->getColumnName(); |
|
262 | + $columns[]=$tableName.'.'.$table->getColumn($name)->getColumnName(); |
|
263 | 263 | return implode(', ', $columns); |
264 | 264 | } |
265 | 265 | |
@@ -270,28 +270,28 @@ discard block |
||
270 | 270 | * @param array source table column names. |
271 | 271 | * @return string inner join condition for M-N relationship via association table. |
272 | 272 | */ |
273 | - protected function getAssociationJoin($foreignKeys,$indexValues,$sourceKeys) |
|
273 | + protected function getAssociationJoin($foreignKeys, $indexValues, $sourceKeys) |
|
274 | 274 | { |
275 | - $refInfo= $this->getAssociationTable(); |
|
276 | - $fkInfo = $this->getForeignTable(); |
|
275 | + $refInfo=$this->getAssociationTable(); |
|
276 | + $fkInfo=$this->getForeignTable(); |
|
277 | 277 | |
278 | - $refTable = $refInfo->getTableFullName(); |
|
279 | - $fkTable = $fkInfo->getTableFullName(); |
|
278 | + $refTable=$refInfo->getTableFullName(); |
|
279 | + $fkTable=$fkInfo->getTableFullName(); |
|
280 | 280 | |
281 | - $joins = array(); |
|
282 | - $hasAssociationColumns = count($this->_association_columns) > 0; |
|
281 | + $joins=array(); |
|
282 | + $hasAssociationColumns=count($this->_association_columns) > 0; |
|
283 | 283 | $i=0; |
284 | 284 | foreach($foreignKeys as $ref=>$fk) |
285 | 285 | { |
286 | 286 | if($hasAssociationColumns) |
287 | - $refField = $refInfo->getColumn($this->_association_columns[$i++])->getColumnName(); |
|
287 | + $refField=$refInfo->getColumn($this->_association_columns[$i++])->getColumnName(); |
|
288 | 288 | else |
289 | - $refField = $refInfo->getColumn($ref)->getColumnName(); |
|
290 | - $fkField = $fkInfo->getColumn($fk)->getColumnName(); |
|
291 | - $joins[] = "{$fkTable}.{$fkField} = {$refTable}.{$refField}"; |
|
289 | + $refField=$refInfo->getColumn($ref)->getColumnName(); |
|
290 | + $fkField=$fkInfo->getColumn($fk)->getColumnName(); |
|
291 | + $joins[]="{$fkTable}.{$fkField} = {$refTable}.{$refField}"; |
|
292 | 292 | } |
293 | - $joinCondition = implode(' AND ', $joins); |
|
294 | - $index = $this->getCommandBuilder()->getIndexKeyCondition($refInfo,array_keys($sourceKeys), $indexValues); |
|
293 | + $joinCondition=implode(' AND ', $joins); |
|
294 | + $index=$this->getCommandBuilder()->getIndexKeyCondition($refInfo, array_keys($sourceKeys), $indexValues); |
|
295 | 295 | return "INNER JOIN {$refTable} ON ({$joinCondition}) AND {$index}"; |
296 | 296 | } |
297 | 297 | |
@@ -301,15 +301,15 @@ discard block |
||
301 | 301 | */ |
302 | 302 | public function updateAssociatedRecords() |
303 | 303 | { |
304 | - $obj = $this->getContext()->getSourceRecord(); |
|
305 | - $fkObjects = &$obj->{$this->getContext()->getProperty()}; |
|
304 | + $obj=$this->getContext()->getSourceRecord(); |
|
305 | + $fkObjects=&$obj->{$this->getContext()->getProperty()}; |
|
306 | 306 | $success=true; |
307 | - if(($total = count($fkObjects))> 0) |
|
307 | + if(($total=count($fkObjects)) > 0) |
|
308 | 308 | { |
309 | - $source = $this->getSourceRecord(); |
|
310 | - $builder = $this->getAssociationTableCommandBuilder(); |
|
311 | - for($i=0;$i<$total;$i++) |
|
312 | - $success = $fkObjects[$i]->save() && $success; |
|
309 | + $source=$this->getSourceRecord(); |
|
310 | + $builder=$this->getAssociationTableCommandBuilder(); |
|
311 | + for($i=0; $i < $total; $i++) |
|
312 | + $success=$fkObjects[$i]->save() && $success; |
|
313 | 313 | return $this->updateAssociationTable($obj, $fkObjects, $builder) && $success; |
314 | 314 | } |
315 | 315 | return $success; |
@@ -320,57 +320,57 @@ discard block |
||
320 | 320 | */ |
321 | 321 | protected function getAssociationTableCommandBuilder() |
322 | 322 | { |
323 | - $conn = $this->getContext()->getSourceRecord()->getDbConnection(); |
|
323 | + $conn=$this->getContext()->getSourceRecord()->getDbConnection(); |
|
324 | 324 | return $this->getAssociationTable()->createCommandBuilder($conn); |
325 | 325 | } |
326 | 326 | |
327 | - private function hasAssociationData($builder,$data) |
|
327 | + private function hasAssociationData($builder, $data) |
|
328 | 328 | { |
329 | 329 | $condition=array(); |
330 | - $table = $this->getAssociationTable(); |
|
330 | + $table=$this->getAssociationTable(); |
|
331 | 331 | foreach($data as $name=>$value) |
332 | - $condition[] = $table->getColumn($name)->getColumnName().' = ?'; |
|
333 | - $command = $builder->createCountCommand(implode(' AND ', $condition),array_values($data)); |
|
334 | - $result = $this->getCommandBuilder()->onExecuteCommand($command, intval($command->queryScalar())); |
|
332 | + $condition[]=$table->getColumn($name)->getColumnName().' = ?'; |
|
333 | + $command=$builder->createCountCommand(implode(' AND ', $condition), array_values($data)); |
|
334 | + $result=$this->getCommandBuilder()->onExecuteCommand($command, intval($command->queryScalar())); |
|
335 | 335 | return intval($result) > 0; |
336 | 336 | } |
337 | 337 | |
338 | - private function addAssociationData($builder,$data) |
|
338 | + private function addAssociationData($builder, $data) |
|
339 | 339 | { |
340 | - $command = $builder->createInsertCommand($data); |
|
340 | + $command=$builder->createInsertCommand($data); |
|
341 | 341 | return $this->getCommandBuilder()->onExecuteCommand($command, $command->execute()) > 0; |
342 | 342 | } |
343 | 343 | |
344 | - private function updateAssociationTable($obj,$fkObjects, $builder) |
|
344 | + private function updateAssociationTable($obj, $fkObjects, $builder) |
|
345 | 345 | { |
346 | - $source = $this->getSourceRecordValues($obj); |
|
347 | - $foreignKeys = $this->findForeignKeys($this->getAssociationTable(), $fkObjects[0]); |
|
346 | + $source=$this->getSourceRecordValues($obj); |
|
347 | + $foreignKeys=$this->findForeignKeys($this->getAssociationTable(), $fkObjects[0]); |
|
348 | 348 | $success=true; |
349 | 349 | foreach($fkObjects as $fkObject) |
350 | 350 | { |
351 | - $data = array_merge($source, $this->getForeignObjectValues($foreignKeys,$fkObject)); |
|
352 | - if(!$this->hasAssociationData($builder,$data)) |
|
353 | - $success = $this->addAssociationData($builder,$data) && $success; |
|
351 | + $data=array_merge($source, $this->getForeignObjectValues($foreignKeys, $fkObject)); |
|
352 | + if(!$this->hasAssociationData($builder, $data)) |
|
353 | + $success=$this->addAssociationData($builder, $data) && $success; |
|
354 | 354 | } |
355 | 355 | return $success; |
356 | 356 | } |
357 | 357 | |
358 | 358 | private function getSourceRecordValues($obj) |
359 | 359 | { |
360 | - $sourceKeys = $this->findForeignKeys($this->getAssociationTable(), $obj); |
|
361 | - $indexValues = $this->getIndexValues(array_values($sourceKeys), $obj); |
|
362 | - $data = array(); |
|
360 | + $sourceKeys=$this->findForeignKeys($this->getAssociationTable(), $obj); |
|
361 | + $indexValues=$this->getIndexValues(array_values($sourceKeys), $obj); |
|
362 | + $data=array(); |
|
363 | 363 | $i=0; |
364 | 364 | foreach($sourceKeys as $name=>$srcKey) |
365 | - $data[$name] = $indexValues[0][$i++]; |
|
365 | + $data[$name]=$indexValues[0][$i++]; |
|
366 | 366 | return $data; |
367 | 367 | } |
368 | 368 | |
369 | - private function getForeignObjectValues($foreignKeys,$fkObject) |
|
369 | + private function getForeignObjectValues($foreignKeys, $fkObject) |
|
370 | 370 | { |
371 | 371 | $data=array(); |
372 | 372 | foreach($foreignKeys as $name=>$fKey) |
373 | - $data[$name] = $fkObject->getColumnValue($fKey); |
|
373 | + $data[$name]=$fkObject->getColumnValue($fKey); |
|
374 | 374 | return $data; |
375 | 375 | } |
376 | 376 | } |
@@ -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(); |
@@ -30,8 +30,8 @@ discard block |
||
30 | 30 | |
31 | 31 | public function __construct(TActiveRecordRelationContext $context, $criteria) |
32 | 32 | { |
33 | - $this->_context = $context; |
|
34 | - $this->_criteria = $criteria; |
|
33 | + $this->_context=$context; |
|
34 | + $this->_criteria=$criteria; |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | /** |
@@ -71,22 +71,22 @@ discard block |
||
71 | 71 | * @param array method arguments |
72 | 72 | * @return mixed TActiveRecord or array of TActiveRecord results depending on the method called. |
73 | 73 | */ |
74 | - public function __call($method,$args) |
|
74 | + public function __call($method, $args) |
|
75 | 75 | { |
76 | 76 | static $stack=array(); |
77 | 77 | |
78 | - $results = call_user_func_array(array($this->getSourceRecord(),$method),$args); |
|
79 | - $validArray = is_array($results) && count($results) > 0; |
|
78 | + $results=call_user_func_array(array($this->getSourceRecord(), $method), $args); |
|
79 | + $validArray=is_array($results) && count($results) > 0; |
|
80 | 80 | if($validArray || $results instanceof ArrayAccess || $results instanceof TActiveRecord) |
81 | 81 | { |
82 | 82 | $this->collectForeignObjects($results); |
83 | - while($obj = array_pop($stack)) |
|
83 | + while($obj=array_pop($stack)) |
|
84 | 84 | $obj->collectForeignObjects($results); |
85 | 85 | } |
86 | 86 | else if($results instanceof TActiveRecordRelation) |
87 | - $stack[] = $this; //call it later |
|
88 | - else if($results === null || !$validArray) |
|
89 | - $stack = array(); |
|
87 | + $stack[]=$this; //call it later |
|
88 | + else if($results===null || !$validArray) |
|
89 | + $stack=array(); |
|
90 | 90 | return $results; |
91 | 91 | } |
92 | 92 | |
@@ -110,28 +110,28 @@ discard block |
||
110 | 110 | */ |
111 | 111 | protected function findForeignKeys($from, $matchesRecord, $loose=false) |
112 | 112 | { |
113 | - $gateway = $matchesRecord->getRecordGateway(); |
|
114 | - $recordTableInfo = $gateway->getRecordTableInfo($matchesRecord); |
|
115 | - $matchingTableName = strtolower($recordTableInfo->getTableName()); |
|
116 | - $matchingFullTableName = strtolower($recordTableInfo->getTableFullName()); |
|
113 | + $gateway=$matchesRecord->getRecordGateway(); |
|
114 | + $recordTableInfo=$gateway->getRecordTableInfo($matchesRecord); |
|
115 | + $matchingTableName=strtolower($recordTableInfo->getTableName()); |
|
116 | + $matchingFullTableName=strtolower($recordTableInfo->getTableFullName()); |
|
117 | 117 | $tableInfo=$from; |
118 | 118 | if($from instanceof TActiveRecord) |
119 | - $tableInfo = $gateway->getRecordTableInfo($from); |
|
119 | + $tableInfo=$gateway->getRecordTableInfo($from); |
|
120 | 120 | //find first non-empty FK |
121 | 121 | foreach($tableInfo->getForeignKeys() as $fkeys) |
122 | 122 | { |
123 | - $fkTable = strtolower($fkeys['table']); |
|
123 | + $fkTable=strtolower($fkeys['table']); |
|
124 | 124 | if($fkTable===$matchingTableName || $fkTable===$matchingFullTableName) |
125 | 125 | { |
126 | - $hasFkField = !$loose && $this->getContext()->hasFkField(); |
|
127 | - $key = $hasFkField ? $this->getFkFields($fkeys['keys']) : $fkeys['keys']; |
|
126 | + $hasFkField=!$loose && $this->getContext()->hasFkField(); |
|
127 | + $key=$hasFkField ? $this->getFkFields($fkeys['keys']) : $fkeys['keys']; |
|
128 | 128 | if(!empty($key)) |
129 | 129 | return $key; |
130 | 130 | } |
131 | 131 | } |
132 | 132 | |
133 | 133 | //none found |
134 | - $matching = $gateway->getRecordTableInfo($matchesRecord)->getTableFullName(); |
|
134 | + $matching=$gateway->getRecordTableInfo($matchesRecord)->getTableFullName(); |
|
135 | 135 | throw new TActiveRecordException('ar_relations_missing_fk', |
136 | 136 | $tableInfo->getTableFullName(), $matching); |
137 | 137 | } |
@@ -149,13 +149,13 @@ discard block |
||
149 | 149 | */ |
150 | 150 | private function getFkFields($fkeys) |
151 | 151 | { |
152 | - $matching = array(); |
|
152 | + $matching=array(); |
|
153 | 153 | preg_match_all('/\s*(\S+\.)?([\w-]+)\s*/', $this->getContext()->getFkField(), $matching); |
154 | - $fields = array(); |
|
154 | + $fields=array(); |
|
155 | 155 | foreach($fkeys as $fkName => $field) |
156 | 156 | { |
157 | 157 | if(in_array($fkName, $matching[2])) |
158 | - $fields[$fkName] = $field; |
|
158 | + $fields[$fkName]=$field; |
|
159 | 159 | } |
160 | 160 | return $fields; |
161 | 161 | } |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | { |
170 | 170 | $ids=array(); |
171 | 171 | foreach($properties as $property) |
172 | - $ids[] = is_object($obj) ? (string)$obj->getColumnValue($property) : (string)$obj[$property]; |
|
172 | + $ids[]=is_object($obj) ? (string) $obj->getColumnValue($property) : (string) $obj[$property]; |
|
173 | 173 | return serialize($ids); |
174 | 174 | } |
175 | 175 | |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | */ |
182 | 182 | protected function findForeignObjects($fields, $indexValues) |
183 | 183 | { |
184 | - $finder = $this->getContext()->getForeignRecordFinder(); |
|
184 | + $finder=$this->getContext()->getForeignRecordFinder(); |
|
185 | 185 | return $finder->findAllByIndex($this->_criteria, $fields, $indexValues); |
186 | 186 | } |
187 | 187 | |
@@ -194,14 +194,14 @@ discard block |
||
194 | 194 | protected function getIndexValues($keys, $results) |
195 | 195 | { |
196 | 196 | if(!is_array($results) && !$results instanceof ArrayAccess) |
197 | - $results = array($results); |
|
197 | + $results=array($results); |
|
198 | 198 | $values=array(); |
199 | 199 | foreach($results as $result) |
200 | 200 | { |
201 | - $value = array(); |
|
201 | + $value=array(); |
|
202 | 202 | foreach($keys as $name) |
203 | - $value[] = $result->getColumnValue($name); |
|
204 | - $values[] = $value; |
|
203 | + $value[]=$result->getColumnValue($name); |
|
204 | + $values[]=$value; |
|
205 | 205 | } |
206 | 206 | return $values; |
207 | 207 | } |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | * @param array foreign objects |
214 | 214 | * @param array foreign object field names. |
215 | 215 | */ |
216 | - protected function populateResult(&$results,$properties,&$fkObjects,$fields) |
|
216 | + protected function populateResult(&$results, $properties, &$fkObjects, $fields) |
|
217 | 217 | { |
218 | 218 | $collections=array(); |
219 | 219 | foreach($fkObjects as $fkObject) |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | { |
232 | 232 | if(is_array($results) || $results instanceof ArrayAccess) |
233 | 233 | { |
234 | - for($i=0,$k=count($results);$i<$k;$i++) |
|
234 | + for($i=0, $k=count($results); $i < $k; $i++) |
|
235 | 235 | $this->setObjectProperty($results[$i], $properties, $collections); |
236 | 236 | } |
237 | 237 | else |
@@ -246,8 +246,8 @@ discard block |
||
246 | 246 | */ |
247 | 247 | protected function setObjectProperty($source, $properties, &$collections) |
248 | 248 | { |
249 | - $hash = $this->getObjectHash($source, $properties); |
|
250 | - $prop = $this->getContext()->getProperty(); |
|
249 | + $hash=$this->getObjectHash($source, $properties); |
|
250 | + $prop=$this->getContext()->getProperty(); |
|
251 | 251 | $source->$prop=isset($collections[$hash]) ? $collections[$hash] : array(); |
252 | 252 | } |
253 | 253 | } |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | public function setRecordPk($value) |
84 | 84 | { |
85 | 85 | $this->clearRecordObject(); |
86 | - $val = TPropertyValue::ensureArray($value); |
|
86 | + $val=TPropertyValue::ensureArray($value); |
|
87 | 87 | $this->setViewState('PK', count($val) > 0 ? $val : null); |
88 | 88 | } |
89 | 89 | |
@@ -108,11 +108,11 @@ discard block |
||
108 | 108 | */ |
109 | 109 | public function initializeEditForm() |
110 | 110 | { |
111 | - $record = $this->getCurrentRecord(); |
|
112 | - $classPath = $this->getEditRenderer(); |
|
113 | - if($classPath === '') |
|
111 | + $record=$this->getCurrentRecord(); |
|
112 | + $classPath=$this->getEditRenderer(); |
|
113 | + if($classPath==='') |
|
114 | 114 | { |
115 | - $columns = $this->getTableInfo()->getColumns(); |
|
115 | + $columns=$this->getTableInfo()->getColumns(); |
|
116 | 116 | $this->getInputRepeater()->setDataSource($columns); |
117 | 117 | $this->getInputRepeater()->dataBind(); |
118 | 118 | } |
@@ -134,11 +134,11 @@ discard block |
||
134 | 134 | */ |
135 | 135 | protected function createEditRenderer($record, $classPath) |
136 | 136 | { |
137 | - $this->_editRenderer = Prado::createComponent($classPath); |
|
137 | + $this->_editRenderer=Prado::createComponent($classPath); |
|
138 | 138 | if($this->_editRenderer instanceof IScaffoldEditRenderer) |
139 | 139 | { |
140 | - $index = $this->getControls()->remove($this->getInputRepeater()); |
|
141 | - $this->getControls()->insertAt($index,$this->_editRenderer); |
|
140 | + $index=$this->getControls()->remove($this->getInputRepeater()); |
|
141 | + $this->getControls()->insertAt($index, $this->_editRenderer); |
|
142 | 142 | $this->_editRenderer->setData($record); |
143 | 143 | } |
144 | 144 | else |
@@ -153,16 +153,16 @@ discard block |
||
153 | 153 | */ |
154 | 154 | protected function createRepeaterEditItem($sender, $param) |
155 | 155 | { |
156 | - $type = $param->getItem()->getItemType(); |
|
156 | + $type=$param->getItem()->getItemType(); |
|
157 | 157 | if($type==TListItemType::Item || $type==TListItemType::AlternatingItem) |
158 | 158 | { |
159 | - $item = $param->getItem(); |
|
160 | - $column = $item->getDataItem(); |
|
159 | + $item=$param->getItem(); |
|
160 | + $column=$item->getDataItem(); |
|
161 | 161 | if($column===null) |
162 | 162 | return; |
163 | 163 | |
164 | - $record = $this->getCurrentRecord(); |
|
165 | - $builder = $this->getScaffoldInputBuilder($record); |
|
164 | + $record=$this->getCurrentRecord(); |
|
165 | + $builder=$this->getScaffoldInputBuilder($record); |
|
166 | 166 | $builder->createScaffoldInput($this, $item, $column, $record); |
167 | 167 | } |
168 | 168 | } |
@@ -194,14 +194,14 @@ discard block |
||
194 | 194 | { |
195 | 195 | if($this->getPage()->getIsValid()) |
196 | 196 | { |
197 | - $record = $this->getCurrentRecord(); |
|
197 | + $record=$this->getCurrentRecord(); |
|
198 | 198 | if($this->_editRenderer===null) |
199 | 199 | { |
200 | - $table = $this->getTableInfo(); |
|
201 | - $builder = $this->getScaffoldInputBuilder($record); |
|
200 | + $table=$this->getTableInfo(); |
|
201 | + $builder=$this->getScaffoldInputBuilder($record); |
|
202 | 202 | foreach($this->getInputRepeater()->getItems() as $item) |
203 | 203 | { |
204 | - $column = $table->getColumn($item->getCustomData()); |
|
204 | + $column=$table->getColumn($item->getCustomData()); |
|
205 | 205 | $builder->loadScaffoldInput($this, $item, $column, $record); |
206 | 206 | } |
207 | 207 | } |
@@ -265,11 +265,11 @@ discard block |
||
265 | 265 | protected function getScaffoldInputBuilder($record) |
266 | 266 | { |
267 | 267 | static $_builders=array(); |
268 | - $class = get_class($record); |
|
268 | + $class=get_class($record); |
|
269 | 269 | if(!isset($_builders[$class])) |
270 | 270 | { |
271 | 271 | Prado::using('System.Data.ActiveRecord.Scaffold.InputBuilder.TScaffoldInputBase'); |
272 | - $_builders[$class] = TScaffoldInputBase::createInputBuilder($record); |
|
272 | + $_builders[$class]=TScaffoldInputBase::createInputBuilder($record); |
|
273 | 273 | } |
274 | 274 | return $_builders[$class]; |
275 | 275 | } |
@@ -40,8 +40,8 @@ discard block |
||
40 | 40 | */ |
41 | 41 | protected function getTableInfo() |
42 | 42 | { |
43 | - $finder = $this->getRecordFinder(); |
|
44 | - $gateway = $finder->getRecordManager()->getRecordGateWay(); |
|
43 | + $finder=$this->getRecordFinder(); |
|
44 | + $gateway=$finder->getRecordManager()->getRecordGateWay(); |
|
45 | 45 | return $gateway->getRecordTableInfo($finder); |
46 | 46 | } |
47 | 47 | |
@@ -51,9 +51,9 @@ discard block |
||
51 | 51 | */ |
52 | 52 | protected function getRecordPropertyValues($record) |
53 | 53 | { |
54 | - $data = array(); |
|
54 | + $data=array(); |
|
55 | 55 | foreach($this->getTableInfo()->getColumns() as $name=>$column) |
56 | - $data[] = $record->getColumnValue($name); |
|
56 | + $data[]=$record->getColumnValue($name); |
|
57 | 57 | return $data; |
58 | 58 | } |
59 | 59 | |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | foreach($this->getTableInfo()->getColumns() as $name=>$column) |
68 | 68 | { |
69 | 69 | if($column->getIsPrimaryKey()) |
70 | - $data[] = $record->getColumnValue($name); |
|
70 | + $data[]=$record->getColumnValue($name); |
|
71 | 71 | } |
72 | 72 | return $data; |
73 | 73 | } |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | */ |
97 | 97 | protected function copyFrom(TScaffoldBase $obj) |
98 | 98 | { |
99 | - $this->_record = $obj->_record; |
|
99 | + $this->_record=$obj->_record; |
|
100 | 100 | $this->setRecordClass($obj->getRecordClass()); |
101 | 101 | $this->setEnableDefaultStyle($obj->getEnableDefaultStyle()); |
102 | 102 | } |
@@ -128,13 +128,13 @@ discard block |
||
128 | 128 | } |
129 | 129 | else |
130 | 130 | { |
131 | - $class = $this->getRecordClass(); |
|
131 | + $class=$this->getRecordClass(); |
|
132 | 132 | if($class!==null) |
133 | 133 | $this->_record=Prado::createComponent($class); |
134 | 134 | else |
135 | 135 | { |
136 | 136 | throw new TConfigurationException('scaffold_invalid_record_class', |
137 | - $this->getRecordClass(),$this->getID()); |
|
137 | + $this->getRecordClass(), $this->getID()); |
|
138 | 138 | } |
139 | 139 | } |
140 | 140 | } |
@@ -197,8 +197,8 @@ discard block |
||
197 | 197 | parent::onPreRender($param); |
198 | 198 | if($this->getEnableDefaultStyle()) |
199 | 199 | { |
200 | - $url = $this->publishAsset($this->getDefaultStyle().'.css'); |
|
201 | - $this->getPage()->getClientScript()->registerStyleSheetFile($url,$url); |
|
200 | + $url=$this->publishAsset($this->getDefaultStyle().'.css'); |
|
201 | + $this->getPage()->getClientScript()->registerStyleSheetFile($url, $url); |
|
202 | 202 | } |
203 | 203 | } |
204 | 204 | } |