@@ -91,6 +91,8 @@ class Installer
91
91
92
92
public const INFO_MESSAGE = 'message ' ;
93
93
94
+ public const ENTITY_TYPE_ORDER = 'order ' ;
95
+
94
96
/**
95
97
* The lowest supported MySQL verion
96
98
*/
@@ -1270,14 +1272,15 @@ private function installOrderIncrementPrefix($orderIncrementPrefix)
1270
1272
// get entity_type_id for order
1271
1273
$ select = $ dbConnection ->select ()
1272
1274
->from ($ setup ->getTable ('eav_entity_type ' ), 'entity_type_id ' )
1273
- ->where ('entity_type_code = \' order \'' );
1275
+ ->where ('entity_type_code = ? ' , self :: ENTITY_TYPE_ORDER );
1274
1276
$ entityTypeId = $ dbConnection ->fetchOne ($ select );
1275
1277
1276
1278
// See if row already exists
1277
- $ incrementRow = $ dbConnection ->fetchRow (
1278
- 'SELECT * FROM ' . $ setup ->getTable ('eav_entity_store ' ) . ' WHERE entity_type_id = ? AND store_id = ? ' ,
1279
- [$ entityTypeId , Store::DISTRO_STORE_ID ]
1280
- );
1279
+ $ eavEntityStore = $ dbConnection ->select ()
1280
+ ->from ($ setup ->getTable ('eav_entity_store ' ))
1281
+ ->where ('entity_type_id = ? ' , $ entityTypeId )
1282
+ ->where ('store_id = ? ' , Store::DISTRO_STORE_ID );
1283
+ $ incrementRow = $ dbConnection ->fetchRow ($ eavEntityStore );
1281
1284
1282
1285
if (!empty ($ incrementRow )) {
1283
1286
// row exists, update it
@@ -1300,23 +1303,22 @@ private function installOrderIncrementPrefix($orderIncrementPrefix)
1300
1303
// Get meta id for adding in profile table for order prefix
1301
1304
$ selectMeta = $ dbConnection ->select ()
1302
1305
->from ($ setup ->getTable ('sales_sequence_meta ' ), 'meta_id ' )
1303
- ->where ('entity_type = \' order \'' )
1304
- ->where ('store_id = \'' . Store::DISTRO_STORE_ID . '\'' );
1306
+ ->where ('entity_type = ? ' , self :: ENTITY_TYPE_ORDER )
1307
+ ->where ('store_id = ? ' , Store::DISTRO_STORE_ID );
1305
1308
$ metaId = $ dbConnection ->fetchOne ($ selectMeta );
1306
1309
1307
1310
// See if row already exists
1308
- $ incrementRow = $ dbConnection ->fetchRow (
1309
- ' SELECT * FROM ' . $ setup ->getTable ('sales_sequence_profile ' ) . ' WHERE meta_id = ? ' ,
1310
- [ $ metaId]
1311
- );
1311
+ $ profile = $ dbConnection ->select ()
1312
+ -> from ( $ setup ->getTable ('sales_sequence_profile ' ))
1313
+ -> where ( ' meta_id = ? ' , $ metaId);
1314
+ $ incrementRow = $ dbConnection -> fetchRow ( $ profile );
1312
1315
1313
1316
if (!empty ($ incrementRow )) {
1314
1317
// Row exists, update it
1315
- $ profileId = $ incrementRow ['profile_id ' ];
1316
1318
$ dbConnection ->update (
1317
1319
$ setup ->getTable ('sales_sequence_profile ' ),
1318
1320
['prefix ' => $ orderIncrementPrefix , 'is_active ' => '1 ' ],
1319
- 'profile_id = ' . $ profileId
1321
+ 'profile_id = ' . $ incrementRow [ ' profile_id ' ]
1320
1322
);
1321
1323
}
1322
1324
}
0 commit comments