@@ -31,13 +31,13 @@ discard block |
||
31 | 31 | * @var null|array |
32 | 32 | * @since 3.1.7 |
33 | 33 | */ |
34 | - private $_names = null; |
|
34 | + private $_names=null; |
|
35 | 35 | |
36 | 36 | /** |
37 | 37 | * Sets the database table meta data information. |
38 | 38 | * @param array table column information. |
39 | 39 | */ |
40 | - public function __construct($tableInfo=array(),$primary=array(),$foreign=array()) |
|
40 | + public function __construct($tableInfo=array(), $primary=array(), $foreign=array()) |
|
41 | 41 | { |
42 | 42 | $this->_info=$tableInfo; |
43 | 43 | $this->_primaryKeys=$primary; |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | public function createCommandBuilder($connection) |
53 | 53 | { |
54 | 54 | Prado::using('System.Data.Common.TDbCommandBuilder'); |
55 | - return new TDbCommandBuilder($connection,$this); |
|
55 | + return new TDbCommandBuilder($connection, $this); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | /** |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | * @param mixed default value if information array value is null |
61 | 61 | * @return mixed information array value. |
62 | 62 | */ |
63 | - protected function getInfo($name,$default=null) |
|
63 | + protected function getInfo($name, $default=null) |
|
64 | 64 | { |
65 | 65 | return isset($this->_info[$name]) ? $this->_info[$name] : $default; |
66 | 66 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | * @param string information array key name |
70 | 70 | * @param mixed new information array value. |
71 | 71 | */ |
72 | - protected function setInfo($name,$value) |
|
72 | + protected function setInfo($name, $value) |
|
73 | 73 | { |
74 | 74 | $this->_info[$name]=$value; |
75 | 75 | } |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | */ |
96 | 96 | public function getIsView() |
97 | 97 | { |
98 | - return $this->getInfo('IsView',false); |
|
98 | + return $this->getInfo('IsView', false); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | /** |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | */ |
113 | 113 | public function getColumn($name) |
114 | 114 | { |
115 | - if(($column = $this->_columns->itemAt($name))!==null) |
|
115 | + if(($column=$this->_columns->itemAt($name))!==null) |
|
116 | 116 | return $column; |
117 | 117 | throw new TDbException('dbtableinfo_invalid_column_name', $name, $this->getTableFullName()); |
118 | 118 | } |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | { |
128 | 128 | $this->_names=array(); |
129 | 129 | foreach($this->getColumns() as $column) |
130 | - $this->_names[] = $column->getColumnName(); |
|
130 | + $this->_names[]=$column->getColumnName(); |
|
131 | 131 | } |
132 | 132 | return $this->_names; |
133 | 133 | } |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | { |
158 | 158 | $this->_lowercase=array(); |
159 | 159 | foreach($this->getColumns()->getKeys() as $key) |
160 | - $this->_lowercase[strtolower($key)] = $key; |
|
160 | + $this->_lowercase[strtolower($key)]=$key; |
|
161 | 161 | } |
162 | 162 | return $this->_lowercase; |
163 | 163 | } |
@@ -69,30 +69,30 @@ discard block |
||
69 | 69 | */ |
70 | 70 | protected function createTableInfo($tableName) |
71 | 71 | { |
72 | - $tableName = str_replace("'",'',$tableName); |
|
72 | + $tableName=str_replace("'", '', $tableName); |
|
73 | 73 | $this->getDbConnection()->setActive(true); |
74 | - $table = $this->getDbConnection()->quoteString($tableName); |
|
75 | - $sql = "PRAGMA table_info({$table})"; |
|
76 | - $command = $this->getDbConnection()->createCommand($sql); |
|
77 | - $foreign = $this->getForeignKeys($table); |
|
74 | + $table=$this->getDbConnection()->quoteString($tableName); |
|
75 | + $sql="PRAGMA table_info({$table})"; |
|
76 | + $command=$this->getDbConnection()->createCommand($sql); |
|
77 | + $foreign=$this->getForeignKeys($table); |
|
78 | 78 | $index=0; |
79 | 79 | $columns=array(); |
80 | 80 | $primary=array(); |
81 | 81 | foreach($command->query() as $col) |
82 | 82 | { |
83 | - $col['index'] = $index++; |
|
84 | - $column = $this->processColumn($col, $foreign); |
|
85 | - $columns[$col['name']] = $column; |
|
83 | + $col['index']=$index++; |
|
84 | + $column=$this->processColumn($col, $foreign); |
|
85 | + $columns[$col['name']]=$column; |
|
86 | 86 | if($column->getIsPrimaryKey()) |
87 | - $primary[] = $col['name']; |
|
87 | + $primary[]=$col['name']; |
|
88 | 88 | } |
89 | - $info['TableName'] = $tableName; |
|
89 | + $info['TableName']=$tableName; |
|
90 | 90 | if($this->getIsView($tableName)) |
91 | - $info['IsView'] = true; |
|
91 | + $info['IsView']=true; |
|
92 | 92 | if(count($columns)===0) |
93 | 93 | throw new TDbException('dbmetadata_invalid_table_view', $tableName); |
94 | - $class = $this->getTableInfoClass(); |
|
95 | - $tableInfo = new $class($info,$primary,$foreign); |
|
94 | + $class=$this->getTableInfoClass(); |
|
95 | + $tableInfo=new $class($info, $primary, $foreign); |
|
96 | 96 | $tableInfo->getColumns()->copyFrom($columns); |
97 | 97 | return $tableInfo; |
98 | 98 | } |
@@ -103,11 +103,11 @@ discard block |
||
103 | 103 | */ |
104 | 104 | protected function getIsView($tableName) |
105 | 105 | { |
106 | - $sql = 'SELECT count(*) FROM sqlite_master WHERE type="view" AND name= :table'; |
|
106 | + $sql='SELECT count(*) FROM sqlite_master WHERE type="view" AND name= :table'; |
|
107 | 107 | $this->getDbConnection()->setActive(true); |
108 | - $command = $this->getDbConnection()->createCommand($sql); |
|
108 | + $command=$this->getDbConnection()->createCommand($sql); |
|
109 | 109 | $command->bindValue(':table', $tableName); |
110 | - return intval($command->queryScalar()) === 1; |
|
110 | + return intval($command->queryScalar())===1; |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | /** |
@@ -117,39 +117,39 @@ discard block |
||
117 | 117 | */ |
118 | 118 | protected function processColumn($col, $foreign) |
119 | 119 | { |
120 | - $columnId = $col['name']; //use column name as column Id |
|
120 | + $columnId=$col['name']; //use column name as column Id |
|
121 | 121 | |
122 | - $info['ColumnName'] = '"'.$columnId.'"'; //quote the column names! |
|
123 | - $info['ColumnId'] = $columnId; |
|
124 | - $info['ColumnIndex'] = $col['index']; |
|
122 | + $info['ColumnName']='"'.$columnId.'"'; //quote the column names! |
|
123 | + $info['ColumnId']=$columnId; |
|
124 | + $info['ColumnIndex']=$col['index']; |
|
125 | 125 | |
126 | 126 | if($col['notnull']!=='99') |
127 | - $info['AllowNull'] = true; |
|
127 | + $info['AllowNull']=true; |
|
128 | 128 | |
129 | 129 | if($col['pk']==='1') |
130 | - $info['IsPrimaryKey'] = true; |
|
130 | + $info['IsPrimaryKey']=true; |
|
131 | 131 | if($this->isForeignKeyColumn($columnId, $foreign)) |
132 | - $info['IsForeignKey'] = true; |
|
132 | + $info['IsForeignKey']=true; |
|
133 | 133 | |
134 | 134 | if($col['dflt_value']!==null) |
135 | - $info['DefaultValue'] = $col['dflt_value']; |
|
135 | + $info['DefaultValue']=$col['dflt_value']; |
|
136 | 136 | |
137 | - $type = strtolower($col['type']); |
|
138 | - $info['AutoIncrement'] = $type==='integer' && $col['pk']==='1'; |
|
137 | + $type=strtolower($col['type']); |
|
138 | + $info['AutoIncrement']=$type==='integer' && $col['pk']==='1'; |
|
139 | 139 | |
140 | - $info['DbType'] = $type; |
|
140 | + $info['DbType']=$type; |
|
141 | 141 | $match=array(); |
142 | 142 | if(is_int($pos=strpos($type, '(')) && preg_match('/\((.*)\)/', $type, $match)) |
143 | 143 | { |
144 | - $ps = explode(',', $match[1]); |
|
144 | + $ps=explode(',', $match[1]); |
|
145 | 145 | if(count($ps)===2) |
146 | 146 | { |
147 | - $info['NumericPrecision'] = intval($ps[0]); |
|
148 | - $info['NumericScale'] = intval($ps[1]); |
|
147 | + $info['NumericPrecision']=intval($ps[0]); |
|
148 | + $info['NumericScale']=intval($ps[1]); |
|
149 | 149 | } |
150 | 150 | else |
151 | 151 | $info['ColumnSize']=intval($match[1]); |
152 | - $info['DbType'] = substr($type,0,$pos); |
|
152 | + $info['DbType']=substr($type, 0, $pos); |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | return new TSqliteTableColumn($info); |
@@ -163,13 +163,13 @@ discard block |
||
163 | 163 | */ |
164 | 164 | protected function getForeignKeys($table) |
165 | 165 | { |
166 | - $sql = "PRAGMA foreign_key_list({$table})"; |
|
167 | - $command = $this->getDbConnection()->createCommand($sql); |
|
168 | - $fkeys = array(); |
|
166 | + $sql="PRAGMA foreign_key_list({$table})"; |
|
167 | + $command=$this->getDbConnection()->createCommand($sql); |
|
168 | + $fkeys=array(); |
|
169 | 169 | foreach($command->query() as $col) |
170 | 170 | { |
171 | - $fkeys[$col['table']]['keys'][$col['from']] = $col['to']; |
|
172 | - $fkeys[$col['table']]['table'] = $col['table']; |
|
171 | + $fkeys[$col['table']]['keys'][$col['from']]=$col['to']; |
|
172 | + $fkeys[$col['table']]['table']=$col['table']; |
|
173 | 173 | } |
174 | 174 | return count($fkeys) > 0 ? array_values($fkeys) : $fkeys; |
175 | 175 | } |
@@ -30,12 +30,12 @@ |
||
30 | 30 | */ |
31 | 31 | public function applyLimitOffset($sql, $limit=-1, $offset=-1) |
32 | 32 | { |
33 | - $limit = $limit!==null ? intval($limit) : -1; |
|
34 | - $offset = $offset!==null ? intval($offset) : -1; |
|
33 | + $limit=$limit!==null ? intval($limit) : -1; |
|
34 | + $offset=$offset!==null ? intval($offset) : -1; |
|
35 | 35 | if($limit > 0 || $offset > 0) |
36 | 36 | { |
37 | - $limitStr = ' LIMIT '.$limit; |
|
38 | - $offsetStr = $offset >= 0 ? ' OFFSET '.$offset : ''; |
|
37 | + $limitStr=' LIMIT '.$limit; |
|
38 | + $offsetStr=$offset >= 0 ? ' OFFSET '.$offset : ''; |
|
39 | 39 | return $sql.$limitStr.$offsetStr; |
40 | 40 | } |
41 | 41 | else |
@@ -31,7 +31,7 @@ |
||
31 | 31 | public function createCommandBuilder($connection) |
32 | 32 | { |
33 | 33 | Prado::using('System.Data.Common.Sqlite.TSqliteCommandBuilder'); |
34 | - return new TSqliteCommandBuilder($connection,$this); |
|
34 | + return new TSqliteCommandBuilder($connection, $this); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | /** |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | /** |
27 | 27 | * @TODO add sqlite types. |
28 | 28 | */ |
29 | - private static $types = array(); |
|
29 | + private static $types=array(); |
|
30 | 30 | |
31 | 31 | /** |
32 | 32 | * Overrides parent implementation, returns PHP type from the db type. |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | */ |
35 | 35 | public function getPHPType() |
36 | 36 | { |
37 | - $dbtype = strtolower($this->getDbType()); |
|
37 | + $dbtype=strtolower($this->getDbType()); |
|
38 | 38 | foreach(self::$types as $type => $dbtypes) |
39 | 39 | { |
40 | 40 | if(in_array($dbtype, $dbtypes)) |
@@ -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; |