PunchoutCatalogsEntityManager   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 141
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 60
c 2
b 0
f 0
dl 0
loc 141
rs 10
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A updatePunchoutCatalogConnectionCart() 0 15 1
A createPunchoutCatalogConnectionSetup() 0 17 1
A updatePunchoutCatalogConnectionSetup() 0 15 1
A updatePunchoutCatalogConnection() 0 15 1
A createPunchoutCatalogConnection() 0 15 1
A createPunchoutCatalogConnectionCart() 0 17 1
1
<?php
2
3
/**
4
 * Copyright © 2016-present Spryker Systems GmbH. All rights reserved.
5
 * Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file.
6
 */
7
8
namespace SprykerEco\Zed\PunchoutCatalogs\Persistence;
9
10
use Generated\Shared\Transfer\PunchoutCatalogConnectionCartTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...gConnectionCartTransfer 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\PunchoutCatalogConnectionSetupTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...ConnectionSetupTransfer 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\PunchoutCatalogConnectionTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...talogConnectionTransfer 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 Orm\Zed\PunchoutCatalog\Persistence\PgwPunchoutCatalogConnection;
0 ignored issues
show
Bug introduced by
The type Orm\Zed\PunchoutCatalog\...nchoutCatalogConnection 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...
14
use Orm\Zed\PunchoutCatalog\Persistence\PgwPunchoutCatalogConnectionCart;
0 ignored issues
show
Bug introduced by
The type Orm\Zed\PunchoutCatalog\...utCatalogConnectionCart 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...
15
use Orm\Zed\PunchoutCatalog\Persistence\PgwPunchoutCatalogConnectionSetup;
0 ignored issues
show
Bug introduced by
The type Orm\Zed\PunchoutCatalog\...tCatalogConnectionSetup 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...
16
use Spryker\Zed\Kernel\Persistence\AbstractEntityManager;
17
18
/**
19
 * @method \SprykerEco\Zed\PunchoutCatalogs\Persistence\PunchoutCatalogsPersistenceFactory getFactory()
20
 */
21
class PunchoutCatalogsEntityManager extends AbstractEntityManager implements PunchoutCatalogsEntityManagerInterface
22
{
23
    /**
24
     * @param \Generated\Shared\Transfer\PunchoutCatalogConnectionTransfer $punchoutCatalogConnectionTransfer
25
     *
26
     * @return \Generated\Shared\Transfer\PunchoutCatalogConnectionTransfer
27
     */
28
    public function createPunchoutCatalogConnection(PunchoutCatalogConnectionTransfer $punchoutCatalogConnectionTransfer): PunchoutCatalogConnectionTransfer
29
    {
30
        $punchoutCatalogsConnectionMapper = $this->getFactory()
31
            ->createPunchoutCatalogsConnectionMapper();
32
33
        $punchoutCatalogConnectionEntity = $punchoutCatalogsConnectionMapper->mapPunchoutCatalogConnectionTransferToEntity(
34
            $punchoutCatalogConnectionTransfer,
35
            new PgwPunchoutCatalogConnection()
36
        );
37
38
        $punchoutCatalogConnectionEntity->save();
39
40
        return $punchoutCatalogsConnectionMapper->mapPunchoutCatalogConnectionEntityToTransfer(
41
            $punchoutCatalogConnectionEntity,
42
            $punchoutCatalogConnectionTransfer
43
        );
44
    }
45
46
    /**
47
     * @param \Generated\Shared\Transfer\PunchoutCatalogConnectionTransfer $punchoutCatalogConnectionTransfer
48
     *
49
     * @return void
50
     */
51
    public function updatePunchoutCatalogConnection(PunchoutCatalogConnectionTransfer $punchoutCatalogConnectionTransfer): void
52
    {
53
        $punchoutCatalogConnectionEntity = $this->getFactory()
54
            ->getPunchoutCatalogConnectionPropelQuery()
55
            ->filterByIdPunchoutCatalogConnection($punchoutCatalogConnectionTransfer->getIdPunchoutCatalogConnection())
56
            ->findOne();
57
58
        $punchoutCatalogConnectionEntity = $this->getFactory()
59
            ->createPunchoutCatalogsConnectionMapper()
60
            ->mapPunchoutCatalogConnectionTransferToEntity(
61
                $punchoutCatalogConnectionTransfer,
62
                $punchoutCatalogConnectionEntity
63
            );
64
65
        $punchoutCatalogConnectionEntity->save();
66
    }
67
68
    /**
69
     * @param int $idPunchoutCatalogConnection
70
     * @param \Generated\Shared\Transfer\PunchoutCatalogConnectionCartTransfer $punchoutCatalogConnectionCartTransfer
71
     *
72
     * @return \Generated\Shared\Transfer\PunchoutCatalogConnectionCartTransfer
73
     */
74
    public function createPunchoutCatalogConnectionCart(int $idPunchoutCatalogConnection, PunchoutCatalogConnectionCartTransfer $punchoutCatalogConnectionCartTransfer): PunchoutCatalogConnectionCartTransfer
75
    {
76
        $punchoutCatalogsConnectionCartMapper = $this->getFactory()
77
            ->createPunchoutCatalogsConnectionCartMapper();
78
79
        $punchoutCatalogConnectionCartEntity = $punchoutCatalogsConnectionCartMapper->mapPunchoutCatalogConnectionCartTransferToEntity(
80
            $punchoutCatalogConnectionCartTransfer,
81
            new PgwPunchoutCatalogConnectionCart()
82
        );
83
84
        $punchoutCatalogConnectionCartEntity->setIdPunchoutCatalogConnectionCart($idPunchoutCatalogConnection);
85
86
        $punchoutCatalogConnectionCartEntity->save();
87
88
        return $punchoutCatalogsConnectionCartMapper->mapPunchoutCatalogConnectionCartEntityToTransfer(
89
            $punchoutCatalogConnectionCartEntity,
90
            $punchoutCatalogConnectionCartTransfer
91
        );
92
    }
93
94
    /**
95
     * @param \Generated\Shared\Transfer\PunchoutCatalogConnectionCartTransfer $punchoutCatalogConnectionCartTransfer
96
     *
97
     * @return void
98
     */
99
    public function updatePunchoutCatalogConnectionCart(PunchoutCatalogConnectionCartTransfer $punchoutCatalogConnectionCartTransfer): void
100
    {
101
        $punchoutCatalogConnectionCartEntity = $this->getFactory()
102
            ->getPunchoutCatalogConnectionCartPropelQuery()
103
            ->filterByIdPunchoutCatalogConnectionCart($punchoutCatalogConnectionCartTransfer->getIdPunchoutCatalogCart())
104
            ->findOne();
105
106
        $punchoutCatalogConnectionCartEntity = $this->getFactory()
107
            ->createPunchoutCatalogsConnectionCartMapper()
108
            ->mapPunchoutCatalogConnectionCartTransferToEntity(
109
                $punchoutCatalogConnectionCartTransfer,
110
                $punchoutCatalogConnectionCartEntity
111
            );
112
113
        $punchoutCatalogConnectionCartEntity->save();
114
    }
115
116
    /**
117
     * @param int $idPunchoutCatalogConnection
118
     * @param \Generated\Shared\Transfer\PunchoutCatalogConnectionSetupTransfer $punchoutCatalogConnectionSetupTransfer
119
     *
120
     * @return \Generated\Shared\Transfer\PunchoutCatalogConnectionSetupTransfer
121
     */
122
    public function createPunchoutCatalogConnectionSetup(int $idPunchoutCatalogConnection, PunchoutCatalogConnectionSetupTransfer $punchoutCatalogConnectionSetupTransfer): PunchoutCatalogConnectionSetupTransfer
123
    {
124
        $punchoutCatalogsConnectionSetupMapper = $this->getFactory()
125
            ->createPunchoutCatalogsConnectionSetupMapper();
126
127
        $punchoutCatalogConnectionSetupEntity = $punchoutCatalogsConnectionSetupMapper->mapPunchoutCatalogConnectionSetupTransferToEntity(
128
            $punchoutCatalogConnectionSetupTransfer,
129
            new PgwPunchoutCatalogConnectionSetup()
130
        );
131
132
        $punchoutCatalogConnectionSetupEntity->setIdPunchoutCatalogConnectionSetup($idPunchoutCatalogConnection);
133
134
        $punchoutCatalogConnectionSetupEntity->save();
135
136
        return $punchoutCatalogsConnectionSetupMapper->mapPunchoutCatalogConnectionSetupEntityToTransfer(
137
            $punchoutCatalogConnectionSetupEntity,
138
            $punchoutCatalogConnectionSetupTransfer
139
        );
140
    }
141
142
    /**
143
     * @param \Generated\Shared\Transfer\PunchoutCatalogConnectionSetupTransfer $punchoutCatalogConnectionSetupTransfer
144
     *
145
     * @return void
146
     */
147
    public function updatePunchoutCatalogConnectionSetup(PunchoutCatalogConnectionSetupTransfer $punchoutCatalogConnectionSetupTransfer): void
148
    {
149
        $punchoutCatalogConnectionSetupEntity = $this->getFactory()
150
            ->getPunchoutCatalogConnectionSetupPropelQuery()
151
            ->filterByIdPunchoutCatalogConnectionSetup($punchoutCatalogConnectionSetupTransfer->getIdPunchoutCatalogSetup())
152
            ->findOne();
153
154
        $punchoutCatalogConnectionSetupEntity = $this->getFactory()
155
            ->createPunchoutCatalogsConnectionSetupMapper()
156
            ->mapPunchoutCatalogConnectionSetupTransferToEntity(
157
                $punchoutCatalogConnectionSetupTransfer,
158
                $punchoutCatalogConnectionSetupEntity
159
            );
160
161
        $punchoutCatalogConnectionSetupEntity->save();
162
    }
163
}
164