Code Duplication    Length = 47-47 lines in 4 locations

src/Repositories/ProductRelationRepository.php 1 location

@@ 35-81 (lines=47) @@
32
 * @link      https://github.com/techdivision/import-product-variant
33
 * @link      http://www.techdivision.com
34
 */
35
class ProductRelationRepository extends AbstractRepository
36
{
37
38
    /**
39
     * The prepared statement to load an existing product relation.
40
     *
41
     * @var \PDOStatement
42
     */
43
    protected $productRelationStmt;
44
45
    /**
46
     * Initializes the repository's prepared statements.
47
     *
48
     * @return void
49
     */
50
    public function init()
51
    {
52
53
        // load the utility class name
54
        $utilityClassName = $this->getUtilityClassName();
55
56
        // initialize the prepared statements
57
        $this->productRelationStmt = $this->getConnection()->prepare($utilityClassName::PRODUCT_RELATION);
58
    }
59
60
    /**
61
     * Load's the product relation with the passed parent/child ID.
62
     *
63
     * @param integer $parentId The entity ID of the product relation's parent product
64
     * @param integer $childId  The entity ID of the product relation's child product
65
     *
66
     * @return array The product relation
67
     */
68
    public function findOneByParentIdAndChildId($parentId, $childId)
69
    {
70
71
        // initialize the params
72
        $params = array(
73
            MemberNames::PARENT_ID => $parentId,
74
            MemberNames::CHILD_ID  => $childId
75
        );
76
77
        // load and return the product relation with the passed parent/child ID
78
        $this->productRelationStmt->execute($params);
79
        return $this->productRelationStmt->fetch(\PDO::FETCH_ASSOC);
80
    }
81
}
82

src/Repositories/ProductSuperAttributeLabelRepository.php 1 location

@@ 35-81 (lines=47) @@
32
 * @link      https://github.com/techdivision/import-product-variant
33
 * @link      http://www.techdivision.com
34
 */
35
class ProductSuperAttributeLabelRepository extends AbstractRepository
36
{
37
38
    /**
39
     * The prepared statement to load an existing product super attribute label.
40
     *
41
     * @var \PDOStatement
42
     */
43
    protected $productSuperAttributeLabelStmt;
44
45
    /**
46
     * Initializes the repository's prepared statements.
47
     *
48
     * @return void
49
     */
50
    public function init()
51
    {
52
53
        // load the utility class name
54
        $utilityClassName = $this->getUtilityClassName();
55
56
        // initialize the prepared statements
57
        $this->productSuperAttributeLabelStmt = $this->getConnection()->prepare($utilityClassName::PRODUCT_SUPER_ATTRIBUTE_LABEL);
58
    }
59
60
    /**
61
     * Load's the product super attribute label with the passed product super attribute/store ID.
62
     *
63
     * @param integer $productSuperAttributeId The product super attribute ID of the product super attribute label
64
     * @param integer $storeId                 The store ID of the product super attribute label
65
     *
66
     * @return array The product super attribute label
67
     */
68
    public function findOneByProductSuperAttributeIdAndStoreId($productSuperAttributeId, $storeId)
69
    {
70
71
        // initialize the params
72
        $params = array(
73
            MemberNames::PRODUCT_SUPER_ATTRIBUTE_ID => $productSuperAttributeId,
74
            MemberNames::STORE_ID                   => $storeId
75
        );
76
77
        // load and return the product super attribute label with the passed product super attribute/store ID
78
        $this->productSuperAttributeLabelStmt->execute($params);
79
        return $this->productSuperAttributeLabelStmt->fetch(\PDO::FETCH_ASSOC);
80
    }
81
}
82

src/Repositories/ProductSuperAttributeRepository.php 1 location

@@ 35-81 (lines=47) @@
32
 * @link      https://github.com/techdivision/import-product-variant
33
 * @link      http://www.techdivision.com
34
 */
35
class ProductSuperAttributeRepository extends AbstractRepository
36
{
37
38
    /**
39
     * The prepared statement to load an existing product super attribute.
40
     *
41
     * @var \PDOStatement
42
     */
43
    protected $productSuperAttributeStmt;
44
45
    /**
46
     * Initializes the repository's prepared statements.
47
     *
48
     * @return void
49
     */
50
    public function init()
51
    {
52
53
        // load the utility class name
54
        $utilityClassName = $this->getUtilityClassName();
55
56
        // initialize the prepared statements
57
        $this->productSuperAttributeStmt = $this->getConnection()->prepare($utilityClassName::PRODUCT_SUPER_ATTRIBUTE);
58
    }
59
60
    /**
61
     * Load's the product super attribute with the passed product/attribute ID.
62
     *
63
     * @param integer $productId   The entity ID of the product super attribute's product
64
     * @param integer $attributeId The attribute ID of the product super attributes attribute
65
     *
66
     * @return array The product super attribute
67
     */
68
    public function findOneByProductIdAndAttributeId($productId, $attributeId)
69
    {
70
71
        // initialize the params
72
        $params = array(
73
            MemberNames::PRODUCT_ID    => $productId,
74
            MemberNames::ATTRIBUTE_ID  => $attributeId
75
        );
76
77
        // load and return the product super attribute with the passed product/attribute ID
78
        $this->productSuperAttributeStmt->execute($params);
79
        return $this->productSuperAttributeStmt->fetch(\PDO::FETCH_ASSOC);
80
    }
81
}
82

src/Repositories/ProductSuperLinkRepository.php 1 location

@@ 35-81 (lines=47) @@
32
 * @link      https://github.com/techdivision/import-product-variant
33
 * @link      http://www.techdivision.com
34
 */
35
class ProductSuperLinkRepository extends AbstractRepository
36
{
37
38
    /**
39
     * The prepared statement to load an existing product super link.
40
     *
41
     * @var \PDOStatement
42
     */
43
    protected $productSuperLinkStmt;
44
45
    /**
46
     * Initializes the repository's prepared statements.
47
     *
48
     * @return void
49
     */
50
    public function init()
51
    {
52
53
        // load the utility class name
54
        $utilityClassName = $this->getUtilityClassName();
55
56
        // initialize the prepared statements
57
        $this->productSuperLinkStmt = $this->getConnection()->prepare($utilityClassName::PRODUCT_SUPER_LINK);
58
    }
59
60
    /**
61
     * Load's the product super link with the passed product/parent ID.
62
     *
63
     * @param integer $productId The entity ID of the product super link's product
64
     * @param integer $parentId  The entity ID of the product super link's parent product
65
     *
66
     * @return array The product super link
67
     */
68
    public function findOneByProductIdAndParentId($productId, $parentId)
69
    {
70
71
        // initialize the params
72
        $params = array(
73
            MemberNames::PRODUCT_ID => $productId,
74
            MemberNames::PARENT_ID  => $parentId,
75
        );
76
77
        // load and return the product super link with the passed product/parent ID
78
        $this->productSuperLinkStmt->execute($params);
79
        return $this->productSuperLinkStmt->fetch(\PDO::FETCH_ASSOC);
80
    }
81
}
82