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