@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | { |
65 | 65 | $conn->setActive(true); //must be connected before retrieving driver name |
66 | 66 | $driver = $conn->getDriverName(); |
67 | - switch (strtolower($driver)) { |
|
67 | + switch(strtolower($driver)) { |
|
68 | 68 | case 'pgsql': |
69 | 69 | return new TPgsqlMetaData($conn); |
70 | 70 | case 'mysqli': |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | public function getTableInfo($tableName = null) |
95 | 95 | { |
96 | 96 | $key = $tableName === null ? $this->getDbConnection()->getConnectionString() : $tableName; |
97 | - if (!isset($this->_tableInfoCache[$key])) { |
|
97 | + if(!isset($this->_tableInfoCache[$key])) { |
|
98 | 98 | $class = $this->getTableInfoClass(); |
99 | 99 | $tableInfo = $tableName === null ? new $class : $this->createTableInfo($tableName); |
100 | 100 | $this->_tableInfoCache[$key] = $tableInfo; |
@@ -141,11 +141,11 @@ discard block |
||
141 | 141 | $rgt = $lft = isset($args[1]) ? $args[1] : ''; |
142 | 142 | $rgt = isset($args[2]) ? $args[2] : $rgt; |
143 | 143 | |
144 | - if (strpos($name, '.') === false) { |
|
144 | + if(strpos($name, '.') === false) { |
|
145 | 145 | return $lft . $name . $rgt; |
146 | 146 | } |
147 | 147 | $names = explode('.', $name); |
148 | - foreach ($names as &$n) { |
|
148 | + foreach($names as &$n) { |
|
149 | 149 | $n = $lft . $n . $rgt; |
150 | 150 | } |
151 | 151 | return implode('.', $names); |
@@ -83,30 +83,30 @@ discard block |
||
83 | 83 | WHERE t.table_name = c.table_name |
84 | 84 | AND t.table_name = :table |
85 | 85 | EOD; |
86 | - if ($schemaName !== null) { |
|
86 | + if($schemaName !== null) { |
|
87 | 87 | $sql .= ' AND t.table_schema = :schema'; |
88 | 88 | } |
89 | - if ($catalogName !== null) { |
|
89 | + if($catalogName !== null) { |
|
90 | 90 | $sql .= ' AND t.table_catalog = :catalog'; |
91 | 91 | } |
92 | 92 | |
93 | 93 | $command = $this->getDbConnection()->createCommand($sql); |
94 | 94 | $command->bindValue(':table', $tableName); |
95 | - if ($schemaName !== null) { |
|
95 | + if($schemaName !== null) { |
|
96 | 96 | $command->bindValue(':schema', $schemaName); |
97 | 97 | } |
98 | - if ($catalogName !== null) { |
|
98 | + if($catalogName !== null) { |
|
99 | 99 | $command->bindValue(':catalog', $catalogName); |
100 | 100 | } |
101 | 101 | |
102 | 102 | $tableInfo = null; |
103 | - foreach ($command->query() as $col) { |
|
104 | - if ($tableInfo === null) { |
|
103 | + foreach($command->query() as $col) { |
|
104 | + if($tableInfo === null) { |
|
105 | 105 | $tableInfo = $this->createNewTableInfo($col); |
106 | 106 | } |
107 | 107 | $this->processColumn($tableInfo, $col); |
108 | 108 | } |
109 | - if ($tableInfo === null) { |
|
109 | + if($tableInfo === null) { |
|
110 | 110 | throw new TDbException('dbmetadata_invalid_table_view', $table); |
111 | 111 | } |
112 | 112 | return $tableInfo; |
@@ -120,14 +120,14 @@ discard block |
||
120 | 120 | { |
121 | 121 | //remove possible delimiters |
122 | 122 | $result = explode('.', preg_replace('/\[|\]|"/', '', $table)); |
123 | - if (count($result) === 1) { |
|
124 | - return [null,null,$result[0]]; |
|
123 | + if(count($result) === 1) { |
|
124 | + return [null, null, $result[0]]; |
|
125 | 125 | } |
126 | - if (count($result) === 2) { |
|
127 | - return [null,$result[0],$result[1]]; |
|
126 | + if(count($result) === 2) { |
|
127 | + return [null, $result[0], $result[1]]; |
|
128 | 128 | } |
129 | - if (count($result) > 2) { |
|
130 | - return [$result[0],$result[1],$result[2]]; |
|
129 | + if(count($result) > 2) { |
|
130 | + return [$result[0], $result[1], $result[2]]; |
|
131 | 131 | } |
132 | 132 | } |
133 | 133 | |
@@ -142,31 +142,31 @@ discard block |
||
142 | 142 | $info['ColumnName'] = "[$columnId]"; //quote the column names! |
143 | 143 | $info['ColumnId'] = $columnId; |
144 | 144 | $info['ColumnIndex'] = intval($col['ORDINAL_POSITION']) - 1; //zero-based index |
145 | - if ($col['IS_NULLABLE'] !== 'NO') { |
|
145 | + if($col['IS_NULLABLE'] !== 'NO') { |
|
146 | 146 | $info['AllowNull'] = true; |
147 | 147 | } |
148 | - if ($col['COLUMN_DEFAULT'] !== null) { |
|
148 | + if($col['COLUMN_DEFAULT'] !== null) { |
|
149 | 149 | $info['DefaultValue'] = $col['COLUMN_DEFAULT']; |
150 | 150 | } |
151 | 151 | |
152 | - if (in_array($columnId, $tableInfo->getPrimaryKeys())) { |
|
152 | + if(in_array($columnId, $tableInfo->getPrimaryKeys())) { |
|
153 | 153 | $info['IsPrimaryKey'] = true; |
154 | 154 | } |
155 | - if ($this->isForeignKeyColumn($columnId, $tableInfo)) { |
|
155 | + if($this->isForeignKeyColumn($columnId, $tableInfo)) { |
|
156 | 156 | $info['IsForeignKey'] = true; |
157 | 157 | } |
158 | 158 | |
159 | - if ($col['IsIdentity'] === '1') { |
|
159 | + if($col['IsIdentity'] === '1') { |
|
160 | 160 | $info['AutoIncrement'] = true; |
161 | 161 | } |
162 | 162 | $info['DbType'] = $col['DATA_TYPE']; |
163 | - if ($col['CHARACTER_MAXIMUM_LENGTH'] !== null) { |
|
163 | + if($col['CHARACTER_MAXIMUM_LENGTH'] !== null) { |
|
164 | 164 | $info['ColumnSize'] = intval($col['CHARACTER_MAXIMUM_LENGTH']); |
165 | 165 | } |
166 | - if ($col['NUMERIC_PRECISION'] !== null) { |
|
166 | + if($col['NUMERIC_PRECISION'] !== null) { |
|
167 | 167 | $info['NumericPrecision'] = intval($col['NUMERIC_PRECISION']); |
168 | 168 | } |
169 | - if ($col['NUMERIC_SCALE'] !== null) { |
|
169 | + if($col['NUMERIC_SCALE'] !== null) { |
|
170 | 170 | $info['NumericScale'] = intval($col['NUMERIC_SCALE']); |
171 | 171 | } |
172 | 172 | $tableInfo->Columns[$columnId] = new TMssqlTableColumn($info); |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | $info['CatalogName'] = $col['TABLE_CATALOG']; |
183 | 183 | $info['SchemaName'] = $col['TABLE_SCHEMA']; |
184 | 184 | $info['TableName'] = $col['TABLE_NAME']; |
185 | - if ($col['TABLE_TYPE'] === 'VIEW') { |
|
185 | + if($col['TABLE_TYPE'] === 'VIEW') { |
|
186 | 186 | $info['IsView'] = true; |
187 | 187 | } |
188 | 188 | list($primary, $foreign) = $this->getConstraintKeys($col); |
@@ -212,11 +212,11 @@ discard block |
||
212 | 212 | $command = $this->getDbConnection()->createCommand($sql); |
213 | 213 | $command->bindValue(':table', $col['TABLE_NAME']); |
214 | 214 | $primary = []; |
215 | - foreach ($command->query()->readAll() as $field) { |
|
215 | + foreach($command->query()->readAll() as $field) { |
|
216 | 216 | $primary[] = $field['field_name']; |
217 | 217 | } |
218 | 218 | $foreign = $this->getForeignConstraints($col); |
219 | - return [$primary,$foreign]; |
|
219 | + return [$primary, $foreign]; |
|
220 | 220 | } |
221 | 221 | |
222 | 222 | /** |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | $command->bindValue(':table', $col['TABLE_NAME']); |
258 | 258 | $fkeys = []; |
259 | 259 | $catalogSchema = "[{$col['TABLE_CATALOG']}].[{$col['TABLE_SCHEMA']}]"; |
260 | - foreach ($command->query() as $info) { |
|
260 | + foreach($command->query() as $info) { |
|
261 | 261 | $fkeys[$info['FK_CONSTRAINT_NAME']]['keys'][$info['FK_COLUMN_NAME']] = $info['UQ_COLUMN_NAME']; |
262 | 262 | $fkeys[$info['FK_CONSTRAINT_NAME']]['table'] = $info['UQ_TABLE_NAME']; |
263 | 263 | } |
@@ -271,8 +271,8 @@ discard block |
||
271 | 271 | */ |
272 | 272 | protected function isForeignKeyColumn($columnId, $tableInfo) |
273 | 273 | { |
274 | - foreach ($tableInfo->getForeignKeys() as $fk) { |
|
275 | - if (in_array($columnId, array_keys($fk['keys']))) { |
|
274 | + foreach($tableInfo->getForeignKeys() as $fk) { |
|
275 | + if(in_array($columnId, array_keys($fk['keys']))) { |
|
276 | 276 | return true; |
277 | 277 | } |
278 | 278 | } |
@@ -296,8 +296,8 @@ discard block |
||
296 | 296 | $command->bindParam(":schema", $schema); |
297 | 297 | $rows = $command->queryAll(); |
298 | 298 | $names = []; |
299 | - foreach ($rows as $row) { |
|
300 | - if ($schema == self::DEFAULT_SCHEMA) { |
|
299 | + foreach($rows as $row) { |
|
300 | + if($schema == self::DEFAULT_SCHEMA) { |
|
301 | 301 | $names[] = $row['TABLE_NAME']; |
302 | 302 | } else { |
303 | 303 | $names[] = $schema . '.' . $row['TABLE_SCHEMA'] . '.' . $row['TABLE_NAME']; |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | INFORMATION_SCHEMA.COLUMNS c |
83 | 83 | WHERE t.table_name = c.table_name |
84 | 84 | AND t.table_name = :table |
85 | -EOD; |
|
85 | +eod; |
|
86 | 86 | if ($schemaName !== null) { |
87 | 87 | $sql .= ' AND t.table_schema = :schema'; |
88 | 88 | } |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | AND |
209 | 209 | c.constraint_type ='PRIMARY KEY' |
210 | 210 | AND k.table_name = :table |
211 | -EOD; |
|
211 | +eod; |
|
212 | 212 | $command = $this->getDbConnection()->createCommand($sql); |
213 | 213 | $command->bindValue(':table', $col['TABLE_NAME']); |
214 | 214 | $primary = []; |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | RC.UNIQUE_CONSTRAINT_NAME |
253 | 253 | AND KCU2.ORDINAL_POSITION = KCU1.ORDINAL_POSITION |
254 | 254 | WHERE KCU1.TABLE_NAME = :table |
255 | -EOD; |
|
255 | +eod; |
|
256 | 256 | $command = $this->getDbConnection()->createCommand($sql); |
257 | 257 | $command->bindValue(':table', $col['TABLE_NAME']); |
258 | 258 | $fkeys = []; |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | $sql = <<<EOD |
292 | 292 | SELECT TABLE_NAME, TABLE_SCHEMA FROM [INFORMATION_SCHEMA].[TABLES] |
293 | 293 | WHERE TABLE_SCHEMA=:schema AND $condition |
294 | -EOD; |
|
294 | +eod; |
|
295 | 295 | $command = $this->getDbConnection()->createCommand($sql); |
296 | 296 | $command->bindParam(":schema", $schema); |
297 | 297 | $rows = $command->queryAll(); |
@@ -30,8 +30,8 @@ discard block |
||
30 | 30 | */ |
31 | 31 | public function getLastInsertID() |
32 | 32 | { |
33 | - foreach ($this->getTableInfo()->getColumns() as $column) { |
|
34 | - if ($column->hasSequence()) { |
|
33 | + foreach($this->getTableInfo()->getColumns() as $column) { |
|
34 | + if($column->hasSequence()) { |
|
35 | 35 | $command = $this->getDbConnection()->createCommand('SELECT @@Identity'); |
36 | 36 | return intval($command->queryScalar()); |
37 | 37 | } |
@@ -82,9 +82,9 @@ discard block |
||
82 | 82 | { |
83 | 83 | $limit = $limit !== null ? intval($limit) : -1; |
84 | 84 | $offset = $offset !== null ? intval($offset) : -1; |
85 | - if ($limit > 0 && $offset <= 0) { //just limit |
|
85 | + if($limit > 0 && $offset <= 0) { //just limit |
|
86 | 86 | $sql = preg_replace('/^([\s(])*SELECT( DISTINCT)?(?!\s*TOP\s*\()/i', "\\1SELECT\\2 TOP $limit", $sql); |
87 | - } elseif ($limit > 0 && $offset > 0) { |
|
87 | + } elseif($limit > 0 && $offset > 0) { |
|
88 | 88 | $sql = $this->rewriteLimitOffsetSql($sql, $limit, $offset); |
89 | 89 | } |
90 | 90 | return $sql; |
@@ -118,18 +118,18 @@ discard block |
||
118 | 118 | */ |
119 | 119 | protected function findOrdering($sql) |
120 | 120 | { |
121 | - if (!preg_match('/ORDER BY/i', $sql)) { |
|
121 | + if(!preg_match('/ORDER BY/i', $sql)) { |
|
122 | 122 | return []; |
123 | 123 | } |
124 | 124 | $matches = []; |
125 | 125 | $ordering = []; |
126 | 126 | preg_match_all('/(ORDER BY)[\s"\[](.*)(ASC|DESC)?(?:[\s"\[]|$|COMPUTE|FOR)/i', $sql, $matches); |
127 | - if (count($matches) > 1 && count($matches[2]) > 0) { |
|
127 | + if(count($matches) > 1 && count($matches[2]) > 0) { |
|
128 | 128 | $parts = explode(',', $matches[2][0]); |
129 | - foreach ($parts as $part) { |
|
129 | + foreach($parts as $part) { |
|
130 | 130 | $subs = []; |
131 | - if (preg_match_all('/(.*)[\s"\]](ASC|DESC)$/i', trim($part), $subs)) { |
|
132 | - if (count($subs) > 1 && count($subs[2]) > 0) { |
|
131 | + if(preg_match_all('/(.*)[\s"\]](ASC|DESC)$/i', trim($part), $subs)) { |
|
132 | + if(count($subs) > 1 && count($subs[2]) > 0) { |
|
133 | 133 | $ordering[$subs[1][0]] = $subs[2][0]; |
134 | 134 | } |
135 | 135 | //else what? |
@@ -147,9 +147,9 @@ discard block |
||
147 | 147 | */ |
148 | 148 | protected function joinOrdering($orders) |
149 | 149 | { |
150 | - if (count($orders) > 0) { |
|
150 | + if(count($orders) > 0) { |
|
151 | 151 | $str = []; |
152 | - foreach ($orders as $column => $direction) { |
|
152 | + foreach($orders as $column => $direction) { |
|
153 | 153 | $str[] = $column . ' ' . $direction; |
154 | 154 | } |
155 | 155 | return 'ORDER BY ' . implode(', ', $str); |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | */ |
163 | 163 | protected function reverseDirection($orders) |
164 | 164 | { |
165 | - foreach ($orders as $column => $direction) { |
|
165 | + foreach($orders as $column => $direction) { |
|
166 | 166 | $orders[$column] = strtolower(trim($direction)) === 'desc' ? 'ASC' : 'DESC'; |
167 | 167 | } |
168 | 168 | return $orders; |
@@ -60,17 +60,17 @@ discard block |
||
60 | 60 | */ |
61 | 61 | public function init($xml) |
62 | 62 | { |
63 | - if ($this->getApplication()->getConfigurationType() == TApplication::CONFIG_TYPE_PHP) { |
|
64 | - if (isset($xml['database']) && is_array($xml['database'])) { |
|
63 | + if($this->getApplication()->getConfigurationType() == TApplication::CONFIG_TYPE_PHP) { |
|
64 | + if(isset($xml['database']) && is_array($xml['database'])) { |
|
65 | 65 | $db = $this->getDbConnection(); |
66 | - foreach ($xml['database'] as $name => $value) { |
|
66 | + foreach($xml['database'] as $name => $value) { |
|
67 | 67 | $db->setSubProperty($name, $value); |
68 | 68 | } |
69 | 69 | } |
70 | 70 | } else { |
71 | - if ($prop = $xml->getElementByTagName('database')) { |
|
71 | + if($prop = $xml->getElementByTagName('database')) { |
|
72 | 72 | $db = $this->getDbConnection(); |
73 | - foreach ($prop->getAttributes() as $name => $value) { |
|
73 | + foreach($prop->getAttributes() as $name => $value) { |
|
74 | 74 | $db->setSubproperty($name, $value); |
75 | 75 | } |
76 | 76 | } |
@@ -104,8 +104,8 @@ discard block |
||
104 | 104 | */ |
105 | 105 | public function getDbConnection() |
106 | 106 | { |
107 | - if ($this->_conn === null) { |
|
108 | - if ($this->_connID !== '') { |
|
107 | + if($this->_conn === null) { |
|
108 | + if($this->_connID !== '') { |
|
109 | 109 | $this->_conn = $this->findConnectionByID($this->getConnectionID()); |
110 | 110 | } else { |
111 | 111 | $this->_conn = Prado::createComponent($this->getConnectionClass()); |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | */ |
143 | 143 | public function setConnectionClass($value) |
144 | 144 | { |
145 | - if ($this->_conn !== null) { |
|
145 | + if($this->_conn !== null) { |
|
146 | 146 | throw new TConfigurationException('datasource_dbconnection_exists', $value); |
147 | 147 | } |
148 | 148 | $this->_connClass = $value; |
@@ -157,9 +157,9 @@ discard block |
||
157 | 157 | protected function findConnectionByID($id) |
158 | 158 | { |
159 | 159 | $conn = $this->getApplication()->getModule($id); |
160 | - if ($conn instanceof TDbConnection) { |
|
160 | + if($conn instanceof TDbConnection) { |
|
161 | 161 | return $conn; |
162 | - } elseif ($conn instanceof TDataSourceConfig) { |
|
162 | + } elseif($conn instanceof TDataSourceConfig) { |
|
163 | 163 | return $conn->getDbConnection(); |
164 | 164 | } else { |
165 | 165 | throw new TConfigurationException('datasource_dbconnection_invalid', $id); |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | */ |
113 | 113 | public function prepare() |
114 | 114 | { |
115 | - if ($this->_statement == null) { |
|
115 | + if($this->_statement == null) { |
|
116 | 116 | try { |
117 | 117 | $this->_statement = $this->getConnection()->getPdoInstance()->prepare($this->getText()); |
118 | 118 | } catch (Exception $e) { |
@@ -145,9 +145,9 @@ discard block |
||
145 | 145 | public function bindParameter($name, &$value, $dataType = null, $length = null) |
146 | 146 | { |
147 | 147 | $this->prepare(); |
148 | - if ($dataType === null) { |
|
148 | + if($dataType === null) { |
|
149 | 149 | $this->_statement->bindParam($name, $value); |
150 | - } elseif ($length === null) { |
|
150 | + } elseif($length === null) { |
|
151 | 151 | $this->_statement->bindParam($name, $value, $dataType); |
152 | 152 | } else { |
153 | 153 | $this->_statement->bindParam($name, $value, $dataType, $length); |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | public function bindValue($name, $value, $dataType = null) |
168 | 168 | { |
169 | 169 | $this->prepare(); |
170 | - if ($dataType === null) { |
|
170 | + if($dataType === null) { |
|
171 | 171 | $this->_statement->bindValue($name, $value); |
172 | 172 | } else { |
173 | 173 | $this->_statement->bindValue($name, $value, $dataType); |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | try { |
187 | 187 | // Do not trace because it will remain even in Performance mode |
188 | 188 | // Prado::trace('Execute Command: '.$this->getDebugStatementText(), 'Prado\Data'); |
189 | - if ($this->_statement instanceof PDOStatement) { |
|
189 | + if($this->_statement instanceof PDOStatement) { |
|
190 | 190 | $this->_statement->execute(); |
191 | 191 | return $this->_statement->rowCount(); |
192 | 192 | } else { |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | { |
219 | 219 | try { |
220 | 220 | // Prado::trace('Query: '.$this->getDebugStatementText(), 'Prado\Data'); |
221 | - if ($this->_statement instanceof PDOStatement) { |
|
221 | + if($this->_statement instanceof PDOStatement) { |
|
222 | 222 | $this->_statement->execute(); |
223 | 223 | } else { |
224 | 224 | $this->_statement = $this->getConnection()->getPdoInstance()->query($this->getText()); |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | { |
242 | 242 | try { |
243 | 243 | // Prado::trace('Query Row: '.$this->getDebugStatementText(), 'Prado\Data'); |
244 | - if ($this->_statement instanceof PDOStatement) { |
|
244 | + if($this->_statement instanceof PDOStatement) { |
|
245 | 245 | $this->_statement->execute(); |
246 | 246 | } else { |
247 | 247 | $this->_statement = $this->getConnection()->getPdoInstance()->query($this->getText()); |
@@ -265,14 +265,14 @@ discard block |
||
265 | 265 | { |
266 | 266 | try { |
267 | 267 | // Prado::trace('Query Scalar: '.$this->getDebugStatementText(), 'Prado\Data'); |
268 | - if ($this->_statement instanceof PDOStatement) { |
|
268 | + if($this->_statement instanceof PDOStatement) { |
|
269 | 269 | $this->_statement->execute(); |
270 | 270 | } else { |
271 | 271 | $this->_statement = $this->getConnection()->getPdoInstance()->query($this->getText()); |
272 | 272 | } |
273 | 273 | $result = $this->_statement->fetchColumn(); |
274 | 274 | $this->_statement->closeCursor(); |
275 | - if (is_resource($result) && get_resource_type($result) === 'stream') { |
|
275 | + if(is_resource($result) && get_resource_type($result) === 'stream') { |
|
276 | 276 | return stream_get_contents($result); |
277 | 277 | } else { |
278 | 278 | return $result; |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | { |
295 | 295 | $rows = $this->query()->readAll(); |
296 | 296 | $column = []; |
297 | - foreach ($rows as $row) { |
|
297 | + foreach($rows as $row) { |
|
298 | 298 | $column[] = current($row); |
299 | 299 | } |
300 | 300 | return $column; |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | */ |
68 | 68 | public function bindColumn($column, &$value, $dataType = null) |
69 | 69 | { |
70 | - if ($dataType === null) { |
|
70 | + if($dataType === null) { |
|
71 | 71 | $this->_statement->bindColumn($column, $value); |
72 | 72 | } else { |
73 | 73 | $this->_statement->bindColumn($column, $value, $dataType); |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | public function setFetchMode($mode) |
81 | 81 | { |
82 | 82 | $params = func_get_args(); |
83 | - call_user_func_array([$this->_statement,'setFetchMode'], $params); |
|
83 | + call_user_func_array([$this->_statement, 'setFetchMode'], $params); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | /** |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | */ |
178 | 178 | public function rewind() |
179 | 179 | { |
180 | - if ($this->_index < 0) { |
|
180 | + if($this->_index < 0) { |
|
181 | 181 | $this->_row = $this->_statement->fetch(); |
182 | 182 | $this->_index = 0; |
183 | 183 | } else { |
@@ -53,12 +53,12 @@ discard block |
||
53 | 53 | */ |
54 | 54 | public function __construct($condition = null, $parameters = []) |
55 | 55 | { |
56 | - if (!is_array($parameters) && func_num_args() > 1) { |
|
56 | + if(!is_array($parameters) && func_num_args() > 1) { |
|
57 | 57 | $parameters = array_slice(func_get_args(), 1); |
58 | 58 | } |
59 | 59 | $this->_parameters = new TAttributeCollection; |
60 | 60 | $this->_parameters->setCaseSensitive(true); |
61 | - $this->_parameters->copyFrom((array)$parameters); |
|
61 | + $this->_parameters->copyFrom((array) $parameters); |
|
62 | 62 | $this->_ordersBy = new TAttributeCollection; |
63 | 63 | $this->_ordersBy->setCaseSensitive(true); |
64 | 64 | |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | */ |
133 | 133 | public function setCondition($value) |
134 | 134 | { |
135 | - if (empty($value)) { |
|
135 | + if(empty($value)) { |
|
136 | 136 | // reset the condition |
137 | 137 | $this->_condition = null; |
138 | 138 | return; |
@@ -144,32 +144,32 @@ discard block |
||
144 | 144 | // [LIMIT {[offset,] row_count | row_count OFFSET offset}] |
145 | 145 | // See: http://dev.mysql.com/doc/refman/5.0/en/select.html |
146 | 146 | |
147 | - if (preg_match('/ORDER\s+BY\s+(.*?)(?=LIMIT)|ORDER\s+BY\s+(.*?)$/i', $value, $matches) > 0) { |
|
147 | + if(preg_match('/ORDER\s+BY\s+(.*?)(?=LIMIT)|ORDER\s+BY\s+(.*?)$/i', $value, $matches) > 0) { |
|
148 | 148 | // condition contains ORDER BY |
149 | 149 | $value = str_replace($matches[0], '', $value); |
150 | - if (strlen($matches[1]) > 0) { |
|
150 | + if(strlen($matches[1]) > 0) { |
|
151 | 151 | $this->setOrdersBy($matches[1]); |
152 | - } elseif (strlen($matches[2]) > 0) { |
|
152 | + } elseif(strlen($matches[2]) > 0) { |
|
153 | 153 | $this->setOrdersBy($matches[2]); |
154 | 154 | } |
155 | 155 | } |
156 | 156 | |
157 | - if (preg_match('/LIMIT\s+([\d\s,]+)/i', $value, $matches) > 0) { |
|
157 | + if(preg_match('/LIMIT\s+([\d\s,]+)/i', $value, $matches) > 0) { |
|
158 | 158 | // condition contains limit |
159 | 159 | $value = str_replace($matches[0], '', $value); // remove limit from query |
160 | - if (strpos($matches[1], ',')) { // both offset and limit given |
|
160 | + if(strpos($matches[1], ',')) { // both offset and limit given |
|
161 | 161 | list($offset, $limit) = explode(',', $matches[1]); |
162 | - $this->_limit = (int)$limit; |
|
163 | - $this->_offset = (int)$offset; |
|
162 | + $this->_limit = (int) $limit; |
|
163 | + $this->_offset = (int) $offset; |
|
164 | 164 | } else { // only limit given |
165 | - $this->_limit = (int)$matches[1]; |
|
165 | + $this->_limit = (int) $matches[1]; |
|
166 | 166 | } |
167 | 167 | } |
168 | 168 | |
169 | - if (preg_match('/OFFSET\s+(\d+)/i', $value, $matches) > 0) { |
|
169 | + if(preg_match('/OFFSET\s+(\d+)/i', $value, $matches) > 0) { |
|
170 | 170 | // condition contains offset |
171 | 171 | $value = str_replace($matches[0], '', $value); // remove offset from query |
172 | - $this->_offset = (int)$matches[1]; // set offset in criteria |
|
172 | + $this->_offset = (int) $matches[1]; // set offset in criteria |
|
173 | 173 | } |
174 | 174 | |
175 | 175 | $this->_condition = trim($value); |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | */ |
189 | 189 | public function setParameters($value) |
190 | 190 | { |
191 | - if (!(is_array($value) || $value instanceof \ArrayAccess)) { |
|
191 | + if(!(is_array($value) || $value instanceof \ArrayAccess)) { |
|
192 | 192 | throw new TException('value must be array or \ArrayAccess'); |
193 | 193 | } |
194 | 194 | $this->_parameters->copyFrom($value); |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | */ |
200 | 200 | public function getIsNamedParameters() |
201 | 201 | { |
202 | - foreach ($this->getParameters() as $k => $v) { |
|
202 | + foreach($this->getParameters() as $k => $v) { |
|
203 | 203 | return is_string($k); |
204 | 204 | } |
205 | 205 | } |
@@ -217,12 +217,12 @@ discard block |
||
217 | 217 | */ |
218 | 218 | public function setOrdersBy($value) |
219 | 219 | { |
220 | - if (is_array($value) || $value instanceof Traversable) { |
|
220 | + if(is_array($value) || $value instanceof Traversable) { |
|
221 | 221 | $this->_ordersBy->copyFrom($value); |
222 | 222 | } else { |
223 | - $value = trim(preg_replace('/\s+/', ' ', (string)$value)); |
|
223 | + $value = trim(preg_replace('/\s+/', ' ', (string) $value)); |
|
224 | 224 | $orderBys = []; |
225 | - foreach (explode(',', $value) as $orderBy) { |
|
225 | + foreach(explode(',', $value) as $orderBy) { |
|
226 | 226 | $vs = explode(' ', trim($orderBy)); |
227 | 227 | $orderBys[$vs[0]] = isset($vs[1]) ? $vs[1] : 'asc'; |
228 | 228 | } |
@@ -268,27 +268,27 @@ discard block |
||
268 | 268 | public function __toString() |
269 | 269 | { |
270 | 270 | $str = ''; |
271 | - if (strlen((string)$this->getCondition()) > 0) { |
|
272 | - $str .= '"' . (string)$this->getCondition() . '"'; |
|
271 | + if(strlen((string) $this->getCondition()) > 0) { |
|
272 | + $str .= '"' . (string) $this->getCondition() . '"'; |
|
273 | 273 | } |
274 | 274 | $params = []; |
275 | - foreach ($this->getParameters() as $k => $v) { |
|
275 | + foreach($this->getParameters() as $k => $v) { |
|
276 | 276 | $params[] = "{$k} => ${v}"; |
277 | 277 | } |
278 | - if (count($params) > 0) { |
|
278 | + if(count($params) > 0) { |
|
279 | 279 | $str .= ', "' . implode(', ', $params) . '"'; |
280 | 280 | } |
281 | 281 | $orders = []; |
282 | - foreach ($this->getOrdersBy() as $k => $v) { |
|
282 | + foreach($this->getOrdersBy() as $k => $v) { |
|
283 | 283 | $orders[] = "{$k} => ${v}"; |
284 | 284 | } |
285 | - if (count($orders) > 0) { |
|
285 | + if(count($orders) > 0) { |
|
286 | 286 | $str .= ', "' . implode(', ', $orders) . '"'; |
287 | 287 | } |
288 | - if ($this->_limit !== null) { |
|
288 | + if($this->_limit !== null) { |
|
289 | 289 | $str .= ', ' . $this->_limit; |
290 | 290 | } |
291 | - if ($this->_offset !== null) { |
|
291 | + if($this->_offset !== null) { |
|
292 | 292 | $str .= ', ' . $this->_offset; |
293 | 293 | } |
294 | 294 | return $str; |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | */ |
104 | 104 | public function updateByPk($data, $keys) |
105 | 105 | { |
106 | - list($where, $parameters) = $this->getPrimaryKeyCondition((array)$keys); |
|
106 | + list($where, $parameters) = $this->getPrimaryKeyCondition((array) $keys); |
|
107 | 107 | return $this->update($data, new TSqlCriteria($where, $parameters)); |
108 | 108 | } |
109 | 109 | /** |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | */ |
134 | 134 | protected function getFindCommand($criteria) |
135 | 135 | { |
136 | - if ($criteria === null) { |
|
136 | + if($criteria === null) { |
|
137 | 137 | return $this->getBuilder()->createFindCommand(); |
138 | 138 | } |
139 | 139 | $where = $criteria->getCondition(); |
@@ -152,10 +152,10 @@ discard block |
||
152 | 152 | */ |
153 | 153 | public function findByPk($keys) |
154 | 154 | { |
155 | - if ($keys === null) { |
|
155 | + if($keys === null) { |
|
156 | 156 | return null; |
157 | 157 | } |
158 | - list($where, $parameters) = $this->getPrimaryKeyCondition((array)$keys); |
|
158 | + list($where, $parameters) = $this->getPrimaryKeyCondition((array) $keys); |
|
159 | 159 | $command = $this->getBuilder()->createFindCommand($where, $parameters); |
160 | 160 | $this->onCreateCommand($command, new TSqlCriteria($where, $parameters)); |
161 | 161 | return $this->onExecuteCommand($command, $command->queryRow()); |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | */ |
167 | 167 | public function findAllByPk($keys) |
168 | 168 | { |
169 | - $where = $this->getCompositeKeyCondition((array)$keys); |
|
169 | + $where = $this->getCompositeKeyCondition((array) $keys); |
|
170 | 170 | $command = $this->getBuilder()->createFindCommand($where); |
171 | 171 | $this->onCreateCommand($command, new TSqlCriteria($where, $keys)); |
172 | 172 | return $this->onExecuteCommand($command, $command->query()); |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | public function findAllByIndex($criteria, $fields, $values) |
175 | 175 | { |
176 | 176 | $index = $this->getIndexKeyCondition($this->getTableInfo(), $fields, $values); |
177 | - if (strlen($where = $criteria->getCondition()) > 0) { |
|
177 | + if(strlen($where = $criteria->getCondition()) > 0) { |
|
178 | 178 | $criteria->setCondition("({$index}) AND ({$where})"); |
179 | 179 | } else { |
180 | 180 | $criteria->setCondition($index); |
@@ -190,10 +190,10 @@ discard block |
||
190 | 190 | */ |
191 | 191 | public function deleteByPk($keys) |
192 | 192 | { |
193 | - if (count($keys) == 0) { |
|
193 | + if(count($keys) == 0) { |
|
194 | 194 | return 0; |
195 | 195 | } |
196 | - $where = $this->getCompositeKeyCondition((array)$keys); |
|
196 | + $where = $this->getCompositeKeyCondition((array) $keys); |
|
197 | 197 | $command = $this->getBuilder()->createDeleteCommand($where); |
198 | 198 | $this->onCreateCommand($command, new TSqlCriteria($where, $keys)); |
199 | 199 | $command->prepare(); |
@@ -202,12 +202,12 @@ discard block |
||
202 | 202 | |
203 | 203 | public function getIndexKeyCondition($table, $fields, $values) |
204 | 204 | { |
205 | - if (!count($values)) { |
|
205 | + if(!count($values)) { |
|
206 | 206 | return 'FALSE'; |
207 | 207 | } |
208 | 208 | $columns = []; |
209 | 209 | $tableName = $table->getTableFullName(); |
210 | - foreach ($fields as $field) { |
|
210 | + foreach($fields as $field) { |
|
211 | 211 | $columns[] = $tableName . '.' . $table->getColumn($field)->getColumnName(); |
212 | 212 | } |
213 | 213 | return '(' . implode(', ', $columns) . ') IN ' . $this->quoteTuple($values); |
@@ -222,22 +222,22 @@ discard block |
||
222 | 222 | { |
223 | 223 | $primary = $this->getTableInfo()->getPrimaryKeys(); |
224 | 224 | $count = count($primary); |
225 | - if ($count === 0) { |
|
225 | + if($count === 0) { |
|
226 | 226 | throw new TDbException( |
227 | 227 | 'dbtablegateway_no_primary_key_found', |
228 | 228 | $this->getTableInfo()->getTableFullName() |
229 | 229 | ); |
230 | 230 | } |
231 | - if (!is_array($values) || count($values) === 0) { |
|
231 | + if(!is_array($values) || count($values) === 0) { |
|
232 | 232 | throw new TDbException( |
233 | 233 | 'dbtablegateway_missing_pk_values', |
234 | 234 | $this->getTableInfo()->getTableFullName() |
235 | 235 | ); |
236 | 236 | } |
237 | - if ($count > 1 && (!isset($values[0]) || !is_array($values[0]))) { |
|
237 | + if($count > 1 && (!isset($values[0]) || !is_array($values[0]))) { |
|
238 | 238 | $values = [$values]; |
239 | 239 | } |
240 | - if ($count > 1 && count($values[0]) !== $count) { |
|
240 | + if($count > 1 && count($values[0]) !== $count) { |
|
241 | 241 | throw new TDbException( |
242 | 242 | 'dbtablegateway_pk_value_count_mismatch', |
243 | 243 | $this->getTableInfo()->getTableFullName() |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | { |
256 | 256 | $conn = $this->getDbConnection(); |
257 | 257 | $data = []; |
258 | - foreach ($array as $k => $v) { |
|
258 | + foreach($array as $k => $v) { |
|
259 | 259 | $data[] = is_array($v) ? $this->quoteTuple($v) : $conn->quoteString($v); |
260 | 260 | } |
261 | 261 | return '(' . implode(', ', $data) . ')'; |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | protected function getPrimaryKeyCondition($values) |
270 | 270 | { |
271 | 271 | $primary = $this->getTableInfo()->getPrimaryKeys(); |
272 | - if (count($primary) === 0) { |
|
272 | + if(count($primary) === 0) { |
|
273 | 273 | throw new TDbException( |
274 | 274 | 'dbtablegateway_no_primary_key_found', |
275 | 275 | $this->getTableInfo()->getTableFullName() |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | $criteria = []; |
279 | 279 | $bindings = []; |
280 | 280 | $i = 0; |
281 | - foreach ($primary as $key) { |
|
281 | + foreach($primary as $key) { |
|
282 | 282 | $column = $this->getTableInfo()->getColumn($key)->getColumnName(); |
283 | 283 | $criteria[] = $column . ' = :' . $key; |
284 | 284 | $bindings[$key] = isset($values[$key]) ? $values[$key] : $values[$i++]; |
@@ -319,10 +319,10 @@ discard block |
||
319 | 319 | $ordering = $criteria->getOrdersBy(); |
320 | 320 | $limit = $criteria->getLimit(); |
321 | 321 | $offset = $criteria->getOffset(); |
322 | - if (count($ordering) > 0) { |
|
322 | + if(count($ordering) > 0) { |
|
323 | 323 | $sql = $this->getBuilder()->applyOrdering($sql, $ordering); |
324 | 324 | } |
325 | - if ($limit >= 0 || $offset >= 0) { |
|
325 | + if($limit >= 0 || $offset >= 0) { |
|
326 | 326 | $sql = $this->getBuilder()->applyLimitOffset($sql, $limit, $offset); |
327 | 327 | } |
328 | 328 | $command = $this->getBuilder()->createCommand($sql); |
@@ -337,8 +337,8 @@ discard block |
||
337 | 337 | */ |
338 | 338 | public function count($criteria) |
339 | 339 | { |
340 | - if ($criteria === null) { |
|
341 | - return (int)$this->getBuilder()->createCountCommand()->queryScalar(); |
|
340 | + if($criteria === null) { |
|
341 | + return (int) $this->getBuilder()->createCountCommand()->queryScalar(); |
|
342 | 342 | } |
343 | 343 | $where = $criteria->getCondition(); |
344 | 344 | $parameters = $criteria->getParameters()->toArray(); |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | $offset = $criteria->getOffset(); |
348 | 348 | $command = $this->getBuilder()->createCountCommand($where, $parameters, $ordering, $limit, $offset); |
349 | 349 | $this->onCreateCommand($command, $criteria); |
350 | - return $this->onExecuteCommand($command, (int)$command->queryScalar()); |
|
350 | + return $this->onExecuteCommand($command, (int) $command->queryScalar()); |
|
351 | 351 | } |
352 | 352 | |
353 | 353 | /** |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | $command = $this->getBuilder()->createInsertCommand($data); |
363 | 363 | $this->onCreateCommand($command, new TSqlCriteria(null, $data)); |
364 | 364 | $command->prepare(); |
365 | - if ($this->onExecuteCommand($command, $command->execute()) > 0) { |
|
365 | + if($this->onExecuteCommand($command, $command->execute()) > 0) { |
|
366 | 366 | $value = $this->getLastInsertId(); |
367 | 367 | return $value !== null ? $value : true; |
368 | 368 | } |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | { |
390 | 390 | $fields = $this->extractMatchingConditions($method, $condition); |
391 | 391 | $args = count($args) === 1 && is_array($args[0]) ? $args[0] : $args; |
392 | - if (count($fields) > count($args)) { |
|
392 | + if(count($fields) > count($args)) { |
|
393 | 393 | throw new TDbException( |
394 | 394 | 'dbtablegateway_mismatch_args_exception', |
395 | 395 | $method, |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | $columns = $table->getLowerCaseColumnNames(); |
414 | 414 | $regexp = '/(' . implode('|', array_keys($columns)) . ')(and|_and_|or|_or_)?/i'; |
415 | 415 | $matches = []; |
416 | - if (!preg_match_all($regexp, strtolower($condition), $matches, PREG_SET_ORDER)) { |
|
416 | + if(!preg_match_all($regexp, strtolower($condition), $matches, PREG_SET_ORDER)) { |
|
417 | 417 | throw new TDbException( |
418 | 418 | 'dbtablegateway_mismatch_column_name', |
419 | 419 | $method, |
@@ -423,11 +423,11 @@ discard block |
||
423 | 423 | } |
424 | 424 | |
425 | 425 | $fields = []; |
426 | - foreach ($matches as $match) { |
|
426 | + foreach($matches as $match) { |
|
427 | 427 | $key = $columns[$match[1]]; |
428 | 428 | $column = $table->getColumn($key)->getColumnName(); |
429 | 429 | $sql = $column . ' = ? '; |
430 | - if (count($match) > 2) { |
|
430 | + if(count($match) > 2) { |
|
431 | 431 | $sql .= strtoupper(str_replace('_', '', $match[2])); |
432 | 432 | } |
433 | 433 | $fields[] = $sql; |
@@ -92,9 +92,9 @@ discard block |
||
92 | 92 | public function __construct($table, $connection) |
93 | 93 | { |
94 | 94 | $this->_connection = $connection; |
95 | - if (is_string($table)) { |
|
95 | + if(is_string($table)) { |
|
96 | 96 | $this->setTableName($table); |
97 | - } elseif ($table instanceof TDbTableInfo) { |
|
97 | + } elseif($table instanceof TDbTableInfo) { |
|
98 | 98 | $this->setTableInfo($table); |
99 | 99 | } else { |
100 | 100 | throw new TDbException('dbtablegateway_invalid_table_info'); |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | public function findAll($criteria = null, $parameters = []) |
243 | 243 | { |
244 | 244 | $args = func_num_args() > 1 ? array_slice(func_get_args(), 1) : null; |
245 | - if ($criteria !== null) { |
|
245 | + if($criteria !== null) { |
|
246 | 246 | $criteria = $this->getCriteria($criteria, $parameters, $args); |
247 | 247 | } |
248 | 248 | return $this->getCommand()->findAll($criteria); |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | */ |
263 | 263 | public function findByPk($keys) |
264 | 264 | { |
265 | - if (func_num_args() > 1) { |
|
265 | + if(func_num_args() > 1) { |
|
266 | 266 | $keys = func_get_args(); |
267 | 267 | } |
268 | 268 | return $this->getCommand()->findByPk($keys); |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | */ |
288 | 288 | public function findAllByPks($keys) |
289 | 289 | { |
290 | - if (func_num_args() > 1) { |
|
290 | + if(func_num_args() > 1) { |
|
291 | 291 | $keys = func_get_args(); |
292 | 292 | } |
293 | 293 | return $this->getCommand()->findAllByPk($keys); |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | */ |
337 | 337 | public function deleteByPk($keys) |
338 | 338 | { |
339 | - if (func_num_args() > 1) { |
|
339 | + if(func_num_args() > 1) { |
|
340 | 340 | $keys = func_get_args(); |
341 | 341 | } |
342 | 342 | return $this->getCommand()->deleteByPk($keys); |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | */ |
348 | 348 | public function deleteAllByPks($keys) |
349 | 349 | { |
350 | - if (func_num_args() > 1) { |
|
350 | + if(func_num_args() > 1) { |
|
351 | 351 | $keys = func_get_args(); |
352 | 352 | } |
353 | 353 | return $this->deleteByPk($keys); |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | public function count($criteria = null, $parameters = []) |
363 | 363 | { |
364 | 364 | $args = func_num_args() > 1 ? array_slice(func_get_args(), 1) : null; |
365 | - if ($criteria !== null) { |
|
365 | + if($criteria !== null) { |
|
366 | 366 | $criteria = $this->getCriteria($criteria, $parameters, $args); |
367 | 367 | } |
368 | 368 | return $this->getCommand()->count($criteria); |
@@ -420,10 +420,10 @@ discard block |
||
420 | 420 | */ |
421 | 421 | protected function getCriteria($criteria, $parameters, $args) |
422 | 422 | { |
423 | - if (is_string($criteria)) { |
|
423 | + if(is_string($criteria)) { |
|
424 | 424 | $useArgs = !is_array($parameters) && is_array($args); |
425 | 425 | return new TSqlCriteria($criteria, $useArgs ? $args : $parameters); |
426 | - } elseif ($criteria instanceof TSqlCriteria) { |
|
426 | + } elseif($criteria instanceof TSqlCriteria) { |
|
427 | 427 | return $criteria; |
428 | 428 | } else { |
429 | 429 | throw new TDbException('dbtablegateway_invalid_criteria'); |
@@ -462,20 +462,20 @@ discard block |
||
462 | 462 | public function __call($method, $args) |
463 | 463 | { |
464 | 464 | $delete = false; |
465 | - if ($findOne = substr(strtolower($method), 0, 6) === 'findby') { |
|
465 | + if($findOne = substr(strtolower($method), 0, 6) === 'findby') { |
|
466 | 466 | $condition = $method[6] === '_' ? substr($method, 7) : substr($method, 6); |
467 | - } elseif (substr(strtolower($method), 0, 9) === 'findallby') { |
|
467 | + } elseif(substr(strtolower($method), 0, 9) === 'findallby') { |
|
468 | 468 | $condition = $method[9] === '_' ? substr($method, 10) : substr($method, 9); |
469 | - } elseif ($delete = substr(strtolower($method), 0, 8) === 'deleteby') { |
|
469 | + } elseif($delete = substr(strtolower($method), 0, 8) === 'deleteby') { |
|
470 | 470 | $condition = $method[8] === '_' ? substr($method, 9) : substr($method, 8); |
471 | - } elseif ($delete = substr(strtolower($method), 0, 11) === 'deleteallby') { |
|
471 | + } elseif($delete = substr(strtolower($method), 0, 11) === 'deleteallby') { |
|
472 | 472 | $condition = $method[11] === '_' ? substr($method, 12) : substr($method, 11); |
473 | 473 | } else { |
474 | 474 | return null; |
475 | 475 | } |
476 | 476 | |
477 | 477 | $criteria = $this->getCommand()->createCriteriaFromString($method, $condition, $args); |
478 | - if ($delete) { |
|
478 | + if($delete) { |
|
479 | 479 | return $this->deleteAll($criteria); |
480 | 480 | } else { |
481 | 481 | return $findOne ? $this->find($criteria) : $this->findAll($criteria); |