Passed
Push — feature/eco-3656/eco-3658-enab... ( b8179e...c68c7e )
by
unknown
05:37
created

getComputopSalesOrderItemsCollection()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 16
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 10
c 0
b 0
f 0
dl 0
loc 16
rs 9.9332
cc 1
nc 1
nop 1
1
<?php
2
3
/**
4
 * MIT License
5
 * Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file.
6
 */
7
8
namespace SprykerEco\Zed\Computop\Persistence;
9
10
use Generated\Shared\Transfer\ComputopPaymentComputopOrderItemCollectionTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...rItemCollectionTransfer was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
11
use Generated\Shared\Transfer\ComputopPaymentComputopTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...PaymentComputopTransfer was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
12
use Generated\Shared\Transfer\ComputopSalesOrderItemCollectionTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...rItemCollectionTransfer was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
13
use Spryker\Zed\Kernel\Persistence\AbstractRepository;
14
15
/**
16
 * @method \SprykerEco\Zed\Computop\Persistence\ComputopPersistenceFactory getFactory();
17
 */
18
class ComputopRepository extends AbstractRepository implements ComputopRepositoryInterface
19
{
20
    /**
21
     * @inheritDoc
22
     */
23
    public function getComputopPaymentByComputopTransId(string $transactionId): ComputopPaymentComputopTransfer
24
    {
25
        $paymentComputopQuery = $this->getFactory()->createPaymentComputopQuery();
26
        $computopPaymentEntity = $paymentComputopQuery->queryPaymentByTransactionId($transactionId)->findOne();
27
        $computopPaymentTransfer = new ComputopPaymentComputopTransfer();
28
29
        if ($computopPaymentEntity === null) {
30
            return $computopPaymentTransfer;
31
        }
32
33
        return $this->getFactory()
34
            ->createComputopEntityMapper()
35
            ->mapComputopPaymentEntityToComputopPaymentTransfer($computopPaymentEntity, $computopPaymentTransfer);
36
    }
37
38
    /**
39
     * @param \Generated\Shared\Transfer\ComputopPaymentComputopTransfer $computopPaymentComputopTransfer
40
     *
41
     * @return \Generated\Shared\Transfer\ComputopSalesOrderItemCollectionTransfer
42
     */
43
    public function getComputopSalesOrderItemsCollection(
44
        ComputopPaymentComputopTransfer $computopPaymentComputopTransfer
45
    ): ComputopSalesOrderItemCollectionTransfer {
46
        $salesOrderItemsCollection = $this
47
            ->getFactory()->createSpySalesOrderItemQuery()
48
            ->getById($computopPaymentComputopTransfer->getFKSalesOrder())
49
            ->find();
50
51
        $computopSalesOrderItemCollectionTransfer = $this->getFactory()
52
            ->createComputopEntityMapper()
53
            ->mapSalesOrderItemsCollectionToComputopSalesOrderItemCollectionTransfer(
54
                $salesOrderItemsCollection,
55
                new ComputopSalesOrderItemCollectionTransfer()
56
            );
57
58
        return $computopSalesOrderItemCollectionTransfer;
59
    }
60
61
    /**
62
     * @param \Generated\Shared\Transfer\ComputopPaymentComputopTransfer $computopPaymentComputopTransfer
63
     *
64
     * @return \Generated\Shared\Transfer\ComputopPaymentComputopOrderItemCollectionTransfer
65
     */
66
    public function getComputopPaymentComputopOrderItemsCollection(
67
        ComputopPaymentComputopTransfer $computopPaymentComputopTransfer
68
    ): ComputopPaymentComputopOrderItemCollectionTransfer {
69
        $computopPaymentComputopOrderItemsEntityCollection = $this->getFactory()
70
            ->createPaymentComputopOrderItemQuery()
71
            ->getByFkPaymentComputop($computopPaymentComputopTransfer->getFkPaymentComputop())
72
            ->find();
73
74
        $computopPaymentComputopOrderItemsCollectionTransfer = $this->getFactory()
75
            ->createComputopEntityMapper()
76
            ->mapPaymentComputopOrderItemEntityCollectionToComputopPaymentComputopOrderItemTransferCollection(
77
                $computopPaymentComputopOrderItemsEntityCollection,
78
                new ComputopPaymentComputopOrderItemCollectionTransfer()
79
            );
80
81
        return $computopPaymentComputopOrderItemsCollectionTransfer;
82
    }
83
}
84