|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* MIT License |
|
5
|
|
|
* For full license information, please view the LICENSE file that was distributed with this source code. |
|
6
|
|
|
*/ |
|
7
|
|
|
|
|
8
|
|
|
namespace SprykerEco\Zed\Braintree\Communication\Table; |
|
9
|
|
|
|
|
10
|
|
|
use Orm\Zed\Braintree\Persistence\Map\SpyPaymentBraintreeTransactionRequestLogTableMap; |
|
|
|
|
|
|
11
|
|
|
use Orm\Zed\Braintree\Persistence\SpyPaymentBraintreeTransactionRequestLogQuery; |
|
|
|
|
|
|
12
|
|
|
use Spryker\Zed\Gui\Communication\Table\AbstractTable; |
|
13
|
|
|
use Spryker\Zed\Gui\Communication\Table\TableConfiguration; |
|
14
|
|
|
|
|
15
|
|
|
class RequestLog extends AbstractTable implements BraintreeTableInterface |
|
16
|
|
|
{ |
|
17
|
|
|
/** |
|
18
|
|
|
* @var \Orm\Zed\Braintree\Persistence\SpyPaymentBraintreeTransactionRequestLogQuery |
|
19
|
|
|
*/ |
|
20
|
|
|
protected $requestLogQuery; |
|
21
|
|
|
|
|
22
|
|
|
/** |
|
23
|
|
|
* @var int |
|
24
|
|
|
*/ |
|
25
|
|
|
protected $idPayment; |
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* @var string[] |
|
29
|
|
|
*/ |
|
30
|
|
|
protected static $excludeFields = [ |
|
31
|
|
|
SpyPaymentBraintreeTransactionRequestLogTableMap::COL_ID_PAYMENT_BRAINTREE_TRANSACTION_REQUEST_LOG, |
|
32
|
|
|
SpyPaymentBraintreeTransactionRequestLogTableMap::COL_FK_PAYMENT_BRAINTREE, |
|
33
|
|
|
SpyPaymentBraintreeTransactionRequestLogTableMap::COL_CREATED_AT, |
|
34
|
|
|
SpyPaymentBraintreeTransactionRequestLogTableMap::COL_UPDATED_AT, |
|
35
|
|
|
]; |
|
36
|
|
|
|
|
37
|
|
|
/** |
|
38
|
|
|
* @param \Orm\Zed\Braintree\Persistence\SpyPaymentBraintreeTransactionRequestLogQuery $requestLogQuery |
|
39
|
|
|
* @param int $idPayment |
|
40
|
|
|
*/ |
|
41
|
|
|
public function __construct(SpyPaymentBraintreeTransactionRequestLogQuery $requestLogQuery, $idPayment) |
|
42
|
|
|
{ |
|
43
|
|
|
$this->requestLogQuery = $requestLogQuery; |
|
44
|
|
|
$this->idPayment = $idPayment; |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
|
|
/** |
|
48
|
|
|
* @param \Spryker\Zed\Gui\Communication\Table\TableConfiguration $config |
|
49
|
|
|
* |
|
50
|
|
|
* @return \Spryker\Zed\Gui\Communication\Table\TableConfiguration |
|
51
|
|
|
*/ |
|
52
|
|
|
protected function configure(TableConfiguration $config) |
|
53
|
|
|
{ |
|
54
|
|
|
$config->setHeader($this->getHeaderFields()); |
|
55
|
|
|
$config->setSortable([ |
|
56
|
|
|
SpyPaymentBraintreeTransactionRequestLogTableMap::COL_TRANSACTION_ID, |
|
57
|
|
|
]); |
|
58
|
|
|
$config->setUrl('request-log-table?id-payment=' . $this->idPayment); |
|
59
|
|
|
|
|
60
|
|
|
return $config; |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
/** |
|
64
|
|
|
* @return array |
|
65
|
|
|
*/ |
|
66
|
|
|
protected function getHeaderFields() |
|
67
|
|
|
{ |
|
68
|
|
|
$fieldNames = SpyPaymentBraintreeTransactionRequestLogTableMap::getFieldNames( |
|
69
|
|
|
SpyPaymentBraintreeTransactionRequestLogTableMap::TYPE_COLNAME |
|
70
|
|
|
); |
|
71
|
|
|
$headerFields = []; |
|
72
|
|
|
foreach ($fieldNames as $fieldName) { |
|
73
|
|
|
if (in_array($fieldName, static::$excludeFields)) { |
|
74
|
|
|
continue; |
|
75
|
|
|
} |
|
76
|
|
|
|
|
77
|
|
|
$translatedFieldName = SpyPaymentBraintreeTransactionRequestLogTableMap::translateFieldName( |
|
78
|
|
|
$fieldName, |
|
79
|
|
|
SpyPaymentBraintreeTransactionRequestLogTableMap::TYPE_COLNAME, |
|
80
|
|
|
SpyPaymentBraintreeTransactionRequestLogTableMap::TYPE_FIELDNAME |
|
81
|
|
|
); |
|
82
|
|
|
|
|
83
|
|
|
$headerFields[$translatedFieldName] = $translatedFieldName; |
|
84
|
|
|
} |
|
85
|
|
|
|
|
86
|
|
|
return $headerFields; |
|
87
|
|
|
} |
|
88
|
|
|
|
|
89
|
|
|
/** |
|
90
|
|
|
* @param \Spryker\Zed\Gui\Communication\Table\TableConfiguration $config |
|
91
|
|
|
* |
|
92
|
|
|
* @return array |
|
93
|
|
|
*/ |
|
94
|
|
|
protected function prepareData(TableConfiguration $config) |
|
95
|
|
|
{ |
|
96
|
|
|
$logItems = $this->runQuery($this->requestLogQuery, $config); |
|
97
|
|
|
$results = []; |
|
98
|
|
|
foreach ($logItems as $logItem) { |
|
99
|
|
|
$results[] = $this->getFieldMatchedResultArrayFromLogItem($logItem); |
|
100
|
|
|
} |
|
101
|
|
|
|
|
102
|
|
|
return $results; |
|
103
|
|
|
} |
|
104
|
|
|
|
|
105
|
|
|
/** |
|
106
|
|
|
* Returns an array that matches field values from $logItem with the table's |
|
107
|
|
|
* fields so that it renders correctly assigned field. |
|
108
|
|
|
* |
|
109
|
|
|
* @param array $logItem |
|
110
|
|
|
* |
|
111
|
|
|
* @return array |
|
112
|
|
|
*/ |
|
113
|
|
|
protected function getFieldMatchedResultArrayFromLogItem(array $logItem) |
|
114
|
|
|
{ |
|
115
|
|
|
$fieldNames = SpyPaymentBraintreeTransactionRequestLogTableMap::getFieldNames( |
|
116
|
|
|
SpyPaymentBraintreeTransactionRequestLogTableMap::TYPE_COLNAME |
|
117
|
|
|
); |
|
118
|
|
|
$resultArray = []; |
|
119
|
|
|
foreach ($fieldNames as $fieldName) { |
|
120
|
|
|
if (in_array($fieldName, static::$excludeFields)) { |
|
121
|
|
|
continue; |
|
122
|
|
|
} |
|
123
|
|
|
|
|
124
|
|
|
$translatedFieldName = SpyPaymentBraintreeTransactionRequestLogTableMap::translateFieldName( |
|
125
|
|
|
$fieldName, |
|
126
|
|
|
SpyPaymentBraintreeTransactionRequestLogTableMap::TYPE_COLNAME, |
|
127
|
|
|
SpyPaymentBraintreeTransactionRequestLogTableMap::TYPE_FIELDNAME |
|
128
|
|
|
); |
|
129
|
|
|
|
|
130
|
|
|
$resultArray[$translatedFieldName] = $logItem[$fieldName]; |
|
131
|
|
|
} |
|
132
|
|
|
|
|
133
|
|
|
return $resultArray; |
|
134
|
|
|
} |
|
135
|
|
|
} |
|
136
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths