3
3
* Copyright © Magento, Inc. All rights reserved.
4
4
* See COPYING.txt for license details.
5
5
*/
6
+ declare (strict_types=1 );
7
+
6
8
namespace Magento \Framework \App ;
7
9
8
10
use Magento \Framework \App \ResourceConnection \ConfigInterface as ResourceConfigInterface ;
18
20
*/
19
21
class ResourceConnection
20
22
{
21
- const AUTO_UPDATE_ONCE = 0 ;
22
-
23
- const AUTO_UPDATE_NEVER = -1 ;
24
-
25
- const AUTO_UPDATE_ALWAYS = 1 ;
26
-
27
- const DEFAULT_CONNECTION = 'default ' ;
23
+ public const AUTO_UPDATE_ONCE = 0 ;
24
+ public const AUTO_UPDATE_NEVER = -1 ;
25
+ public const AUTO_UPDATE_ALWAYS = 1 ;
26
+ public const DEFAULT_CONNECTION = 'default ' ;
28
27
29
28
/**
30
29
* Instances of actual connections.
@@ -93,8 +92,7 @@ public function __construct(
93
92
public function getConnection ($ resourceName = self ::DEFAULT_CONNECTION )
94
93
{
95
94
$ connectionName = $ this ->config ->getConnectionName ($ resourceName );
96
- $ connection = $ this ->getConnectionByName ($ connectionName );
97
- return $ connection ;
95
+ return $ this ->getConnectionByName ($ connectionName );
98
96
}
99
97
100
98
/**
@@ -160,13 +158,13 @@ public function getConnectionByName($connectionName)
160
158
*/
161
159
private function getProcessConnectionName ($ connectionName )
162
160
{
163
- return $ connectionName . '_process_ ' . getmypid ();
161
+ return $ connectionName . '_process_ ' . getmypid ();
164
162
}
165
163
166
164
/**
167
165
* Get resource table name, validated by db adapter.
168
166
*
169
- * @param string|string[] $modelEntity
167
+ * @param string|string[] $modelEntity
170
168
* @param string $connectionName
171
169
* @return string
172
170
* @api
@@ -212,9 +210,9 @@ public function getTablePlaceholder($tableName)
212
210
/**
213
211
* Build a trigger name.
214
212
*
215
- * @param string $tableName The table that is the subject of the trigger
216
- * @param string $time Either "before" or "after"
217
- * @param string $event The DB level event which activates the trigger, i.e. "update" or "insert"
213
+ * @param string $tableName The table that is the subject of the trigger
214
+ * @param string $time Either "before" or "after"
215
+ * @param string $event The DB level event which activates the trigger, i.e. "update" or "insert"
218
216
* @return string
219
217
*/
220
218
public function getTriggerName ($ tableName , $ time , $ event )
@@ -275,9 +273,9 @@ public function getIdxName(
275
273
/**
276
274
* Retrieve 32bit UNIQUE HASH for a Table foreign key.
277
275
*
278
- * @param string $priTableName the target table name
276
+ * @param string $priTableName the target table name
279
277
* @param string $priColumnName the target table column name
280
- * @param string $refTableName the reference table name
278
+ * @param string $refTableName the reference table name
281
279
* @param string $refColumnName the reference table column name
282
280
* @return string
283
281
*/
@@ -302,10 +300,7 @@ public function getFkName($priTableName, $priColumnName, $refTableName, $refColu
302
300
public function getSchemaName ($ resourceName )
303
301
{
304
302
return $ this ->deploymentConfig ->get (
305
- ConfigOptionsListConstants::CONFIG_PATH_DB_CONNECTIONS .
306
- '/ ' .
307
- $ resourceName .
308
- '/dbname '
303
+ ConfigOptionsListConstants::CONFIG_PATH_DB_CONNECTIONS . '/ ' . $ resourceName . '/dbname '
309
304
);
310
305
}
311
306
@@ -320,8 +315,6 @@ public function getTablePrefix()
320
315
return $ this ->tablePrefix ;
321
316
}
322
317
323
- return (string ) $ this ->deploymentConfig ->get (
324
- ConfigOptionsListConstants::CONFIG_PATH_DB_PREFIX
325
- );
318
+ return (string )$ this ->deploymentConfig ->get (ConfigOptionsListConstants::CONFIG_PATH_DB_PREFIX );
326
319
}
327
320
}
0 commit comments