1
1
<?php
2
2
/**
3
- * Copyright 2014 Adobe
4
- * All Rights Reserved .
3
+ * Copyright © Magento, Inc. All rights reserved.
4
+ * See COPYING.txt for license details .
5
5
*/
6
6
namespace Magento \Framework \Mview \Config ;
7
7
8
8
use Magento \Framework \Mview \View \AdditionalColumnsProcessor \DefaultProcessor ;
9
9
use Magento \Framework \Mview \View \ChangelogBatchWalker ;
10
10
use Magento \Framework \Mview \View \SubscriptionInterface ;
11
- use Magento \Framework \App \ResourceConnection ;
12
11
13
12
class Converter implements \Magento \Framework \Config \ConverterInterface
14
13
{
@@ -23,21 +22,13 @@ class Converter implements \Magento\Framework\Config\ConverterInterface
23
22
private $ defaultIterator ;
24
23
25
24
/**
26
- * @var ResourceConnection
27
- */
28
- private $ resourceConnection ;
29
-
30
- /**
31
- * @param ResourceConnection $resourceConnection
32
25
* @param string $defaultProcessor
33
26
* @param string $defaultIterator
34
27
*/
35
28
public function __construct (
36
- ResourceConnection $ resourceConnection ,
37
29
string $ defaultProcessor = DefaultProcessor::class,
38
30
string $ defaultIterator = ChangelogBatchWalker::class
39
31
) {
40
- $ this ->resourceConnection = $ resourceConnection ;
41
32
$ this ->defaultProcessor = $ defaultProcessor ;
42
33
$ this ->defaultIterator = $ defaultIterator ;
43
34
}
@@ -108,15 +99,7 @@ protected function convertChild(\DOMNode $childNode, $data)
108
99
continue ;
109
100
}
110
101
$ name = $ this ->getAttributeValue ($ subscription , 'name ' );
111
- $ configColumn = $ this ->getAttributeValue ($ subscription , 'entity_column ' );
112
- $ column = $ this ->checkifcolumnexist ($ name , $ configColumn );
113
-
114
- if (empty ($ column )) {
115
- throw new \InvalidArgumentException (
116
- 'Column ' . $ configColumn . ' does not exist in table ' . $ name
117
- );
118
- }
119
-
102
+ $ column = $ this ->getAttributeValue ($ subscription , 'entity_column ' );
120
103
$ subscriptionModel = $ this ->getAttributeValue ($ subscription , 'subscription_model ' );
121
104
122
105
if (!empty ($ subscriptionModel )
@@ -172,23 +155,4 @@ private function getAdditionalColumns(\DOMNode $subscription): array
172
155
173
156
return $ additionalColumns ;
174
157
}
175
-
176
- /**
177
- * Check if column exists in table, otherwise return primary key column
178
- *
179
- * @param string $tableName
180
- * @param string $columnName
181
- * @return string
182
- */
183
- public function checkifcolumnexist ($ tableName , $ columnName ) : string
184
- {
185
- $ connection = $ this ->resourceConnection ->getConnection ();
186
- $ tableName = $ this ->resourceConnection ->getTableName ($ tableName );
187
-
188
- if (!$ connection ->isTableExists ($ tableName ) || $ connection ->tableColumnExists ($ tableName , $ columnName )) {
189
- return $ columnName ;
190
- }
191
-
192
- return '' ;
193
- }
194
158
}
0 commit comments