|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* TechDivision\Import\Attribute\Set\Repositories\EavAttributeGroupRepository |
|
5
|
|
|
* |
|
6
|
|
|
* PHP version 7 |
|
7
|
|
|
* |
|
8
|
|
|
* @author Tim Wagner <[email protected]> |
|
9
|
|
|
* @copyright 2019 TechDivision GmbH <[email protected]> |
|
10
|
|
|
* @license https://opensource.org/licenses/MIT |
|
11
|
|
|
* @link https://github.com/techdivision/import |
|
12
|
|
|
* @link http://www.techdivision.com |
|
13
|
|
|
*/ |
|
14
|
|
|
|
|
15
|
|
|
namespace TechDivision\Import\Attribute\Set\Repositories; |
|
16
|
|
|
|
|
17
|
|
|
use TechDivision\Import\Attribute\Set\Utils\SqlStatementKeys; |
|
18
|
|
|
use TechDivision\Import\Attribute\Set\Utils\MemberNames; |
|
19
|
|
|
|
|
20
|
|
|
/** |
|
21
|
|
|
* Repository implementation to load EAV attribute group data. |
|
22
|
|
|
* |
|
23
|
|
|
* @author Tim Wagner <[email protected]> |
|
24
|
|
|
* @copyright 2019 TechDivision GmbH <[email protected]> |
|
25
|
|
|
* @license https://opensource.org/licenses/MIT |
|
26
|
|
|
* @link https://github.com/techdivision/import |
|
27
|
|
|
* @link http://www.techdivision.com |
|
28
|
|
|
*/ |
|
29
|
|
|
class EavAttributeGroupRepository extends \TechDivision\Import\Repositories\EavAttributeGroupRepository implements EavAttributeGroupRepositoryInterface |
|
30
|
|
|
{ |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* The prepared statement to load an attribute group for a specific attribute set ID. |
|
34
|
|
|
* |
|
35
|
|
|
* @var \PDOStatement |
|
36
|
|
|
*/ |
|
37
|
|
|
protected $eavAttributeGroupByAttributeSetIdAndAttributeGroupCodeStmt; |
|
38
|
|
|
|
|
39
|
|
|
/** |
|
40
|
|
|
* Initializes the repository's prepared statements. |
|
41
|
|
|
* |
|
42
|
|
|
* @return void |
|
43
|
|
|
*/ |
|
44
|
|
|
public function init() |
|
45
|
|
|
{ |
|
46
|
|
|
|
|
47
|
|
|
// invoke the parent instance |
|
48
|
|
|
parent::init(); |
|
49
|
|
|
|
|
50
|
|
|
// initialize the prepared statements |
|
51
|
|
|
$this->eavAttributeGroupByAttributeSetIdAndAttributeGroupCodeStmt = |
|
52
|
|
|
$this->getConnection()->prepare($this->loadStatement(SqlStatementKeys::EAV_ATTRIBUTE_GROUP_BY_ATTRIBUTE_SET_ID_AND_ATTRIBUTE_GROUP_CODE)); |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
|
|
/** |
|
56
|
|
|
* Return's the attribute group for the passed attribute set ID and attribute group code. |
|
57
|
|
|
* |
|
58
|
|
|
* @param integer $attributeSetId The EAV attribute set ID to return the attribute group for |
|
59
|
|
|
* @param string $attributeGroupCode The EAV attribute group code to load the attribute group for |
|
60
|
|
|
* |
|
61
|
|
|
* @return array|boolean The EAV attribute group for the passed attribute set ID and attribute group code |
|
62
|
|
|
*/ |
|
63
|
|
|
public function findOneByAttributeSetIdAndAttributeGroupCode($attributeSetId, $attributeGroupCode) |
|
64
|
|
|
{ |
|
65
|
|
|
|
|
66
|
|
|
// initialize the params |
|
67
|
|
|
$params = array( |
|
68
|
|
|
MemberNames::ATTRIBUTE_SET_ID => $attributeSetId, |
|
69
|
|
|
MemberNames::ATTRIBUTE_GROUP_CODE => $attributeGroupCode |
|
70
|
|
|
); |
|
71
|
|
|
|
|
72
|
|
|
// load the attributes for the given params |
|
73
|
|
|
$this->eavAttributeGroupByAttributeSetIdAndAttributeGroupCodeStmt->execute($params); |
|
74
|
|
|
return $this->eavAttributeGroupByAttributeSetIdAndAttributeGroupCodeStmt->fetch(\PDO::FETCH_ASSOC); |
|
75
|
|
|
} |
|
76
|
|
|
} |
|
77
|
|
|
|