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