Code Duplication    Length = 47-49 lines in 9 locations

src/Repositories/CategoryProductRepository.php 1 location

@@ 35-81 (lines=47) @@
32
 * @link      https://github.com/techdivision/import
33
 * @link      http://www.techdivision.com
34
 */
35
class CategoryProductRepository extends AbstractRepository
36
{
37
38
    /**
39
     * The prepared statement to load the existing category product relations.
40
     *
41
     * @var \PDOStatement
42
     */
43
    protected $productCategoryStmt;
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->productCategoryStmt = $this->getConnection()->prepare($utilityClassName::CATEGORY_PRODUCT);
58
    }
59
60
    /**
61
     * Return's the category product relation with the passed category/product ID.
62
     *
63
     * @param integer $categoryId The category ID of the category product relation to return
64
     * @param integer $productId  The product ID of the category product relation to return
65
     *
66
     * @return array The category product relation
67
     */
68
    public function findOneByCategoryIdAndProductId($categoryId, $productId)
69
    {
70
71
        // prepare the params
72
        $params = array(
73
            MemberNames::CATEGORY_ID => $categoryId,
74
            MemberNames::PRODUCT_ID  => $productId
75
        );
76
77
        // load and return the product category relation with the passed category/product ID
78
        $this->productCategoryStmt->execute($params);
79
        return $this->productCategoryStmt->fetch(\PDO::FETCH_ASSOC);
80
    }
81
}
82

src/Repositories/ProductDatetimeRepository.php 1 location

@@ 35-83 (lines=49) @@
32
 * @link      https://github.com/techdivision/import
33
 * @link      http://www.techdivision.com
34
 */
35
class ProductDatetimeRepository extends AbstractRepository
36
{
37
38
    /**
39
     * The prepared statement to load the existing product datetime attribute.
40
     *
41
     * @var \PDOStatement
42
     */
43
    protected $productDatetimeStmt;
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->productDatetimeStmt = $this->getConnection()->prepare($utilityClassName::PRODUCT_DATETIME);
58
    }
59
60
    /**
61
     * Load's and return's the datetime attribute with the passed entity/attribute/store ID.
62
     *
63
     * @param integer $entityId    The entity ID of the attribute
64
     * @param integer $attributeId The attribute ID of the attribute
65
     * @param integer $storeId     The store ID of the attribute
66
     *
67
     * @return array|null The datetime attribute
68
     */
69
    public function findOneByEntityIdAndAttributeIdAndStoreId($entityId, $attributeId, $storeId)
70
    {
71
72
        // prepare the params
73
        $params = array(
74
            MemberNames::STORE_ID      => $storeId,
75
            MemberNames::ENTITY_ID     => $entityId,
76
            MemberNames::ATTRIBUTE_ID  => $attributeId
77
        );
78
79
        // load and return the product datetime attribute with the passed store/entity/attribute ID
80
        $this->productDatetimeStmt->execute($params);
81
        return $this->productDatetimeStmt->fetch(\PDO::FETCH_ASSOC);
82
    }
83
}
84

src/Repositories/ProductDecimalRepository.php 1 location

@@ 35-83 (lines=49) @@
32
 * @link      https://github.com/techdivision/import
33
 * @link      http://www.techdivision.com
34
 */
35
class ProductDecimalRepository extends AbstractRepository
36
{
37
38
    /**
39
     * The prepared statement to load the existing product decimal attribute.
40
     *
41
     * @var \PDOStatement
42
     */
43
    protected $productDecimalStmt;
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->productDecimalStmt = $this->getConnection()->prepare($utilityClassName::PRODUCT_DECIMAL);
58
    }
59
60
    /**
61
     * Load's and return's the decimal attribute with the passed entity/attribute/store ID.
62
     *
63
     * @param integer $entityId    The entity ID of the attribute
64
     * @param integer $attributeId The attribute ID of the attribute
65
     * @param integer $storeId     The store ID of the attribute
66
     *
67
     * @return array|null The decimal attribute
68
     */
69
    public function findOneByEntityIdAndAttributeIdAndStoreId($entityId, $attributeId, $storeId)
70
    {
71
72
        // prepare the params
73
        $params = array(
74
            MemberNames::STORE_ID      => $storeId,
75
            MemberNames::ENTITY_ID     => $entityId,
76
            MemberNames::ATTRIBUTE_ID  => $attributeId
77
        );
78
79
        // load and return the product decimal attribute with the passed store/entity/attribute ID
80
        $this->productDecimalStmt->execute($params);
81
        return $this->productDecimalStmt->fetch(\PDO::FETCH_ASSOC);
82
    }
83
}
84

src/Repositories/ProductIntRepository.php 1 location

@@ 35-83 (lines=49) @@
32
 * @link      https://github.com/techdivision/import
33
 * @link      http://www.techdivision.com
34
 */
35
class ProductIntRepository extends AbstractRepository
36
{
37
38
    /**
39
     * The prepared statement to load the existing product integer attribute.
40
     *
41
     * @var \PDOStatement
42
     */
43
    protected $productIntStmt;
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->productIntStmt = $this->getConnection()->prepare($utilityClassName::PRODUCT_INT);
58
    }
59
60
    /**
61
     * Load's and return's the integer attribute with the passed entity/attribute/store ID.
62
     *
63
     * @param integer $entityId    The entity ID of the attribute
64
     * @param integer $attributeId The attribute ID of the attribute
65
     * @param integer $storeId     The store ID of the attribute
66
     *
67
     * @return array|null The integer attribute
68
     */
69
    public function findOneByEntityIdAndAttributeIdAndStoreId($entityId, $attributeId, $storeId)
70
    {
71
72
        // prepare the params
73
        $params = array(
74
            MemberNames::STORE_ID      => $storeId,
75
            MemberNames::ENTITY_ID     => $entityId,
76
            MemberNames::ATTRIBUTE_ID  => $attributeId
77
        );
78
79
        // load and return the product integer attribute with the passed store/entity/attribute ID
80
        $this->productIntStmt->execute($params);
81
        return $this->productIntStmt->fetch(\PDO::FETCH_ASSOC);
82
    }
83
}
84

src/Repositories/ProductTextRepository.php 1 location

@@ 35-83 (lines=49) @@
32
 * @link      https://github.com/techdivision/import
33
 * @link      http://www.techdivision.com
34
 */
35
class ProductTextRepository extends AbstractRepository
36
{
37
38
    /**
39
     * The prepared statement to load the existing product text attribute.
40
     *
41
     * @var \PDOStatement
42
     */
43
    protected $productTextStmt;
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->productTextStmt = $this->getConnection()->prepare($utilityClassName::PRODUCT_TEXT);
58
    }
59
60
    /**
61
     * Load's and return's the text attribute with the passed entity/attribute/store ID.
62
     *
63
     * @param integer $entityId    The entity ID of the attribute
64
     * @param integer $attributeId The attribute ID of the attribute
65
     * @param integer $storeId     The store ID of the attribute
66
     *
67
     * @return array|null The text attribute
68
     */
69
    public function findOneByEntityIdAndAttributeIdAndStoreId($entityId, $attributeId, $storeId)
70
    {
71
72
        // prepare the params
73
        $params = array(
74
            MemberNames::STORE_ID      => $storeId,
75
            MemberNames::ENTITY_ID     => $entityId,
76
            MemberNames::ATTRIBUTE_ID  => $attributeId
77
        );
78
79
        // load and return the product text attribute with the passed store/entity/attribute ID
80
        $this->productTextStmt->execute($params);
81
        return $this->productTextStmt->fetch(\PDO::FETCH_ASSOC);
82
    }
83
}
84

src/Repositories/ProductVarcharRepository.php 1 location

@@ 35-83 (lines=49) @@
32
 * @link      https://github.com/techdivision/import
33
 * @link      http://www.techdivision.com
34
 */
35
class ProductVarcharRepository extends AbstractRepository
36
{
37
38
    /**
39
     * The prepared statement to load the existing product varchar attribute.
40
     *
41
     * @var \PDOStatement
42
     */
43
    protected $productVarcharStmt;
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->productVarcharStmt = $this->getConnection()->prepare($utilityClassName::PRODUCT_VARCHAR);
58
    }
59
60
    /**
61
     * Load's and return's the varchar attribute with the passed entity/attribute/store ID.
62
     *
63
     * @param integer $entityId    The entity ID of the attribute
64
     * @param integer $attributeId The attribute ID of the attribute
65
     * @param integer $storeId     The store ID of the attribute
66
     *
67
     * @return array|null The varchar attribute
68
     */
69
    public function findOneByEntityIdAndAttributeIdAndStoreId($entityId, $attributeId, $storeId)
70
    {
71
72
        // prepare the params
73
        $params = array(
74
            MemberNames::STORE_ID      => $storeId,
75
            MemberNames::ENTITY_ID     => $entityId,
76
            MemberNames::ATTRIBUTE_ID  => $attributeId
77
        );
78
79
        // load and return the product varchar attribute with the passed store/entity/attribute ID
80
        $this->productVarcharStmt->execute($params);
81
        return $this->productVarcharStmt->fetch(\PDO::FETCH_ASSOC);
82
    }
83
}
84

src/Repositories/ProductWebsiteRepository.php 1 location

@@ 35-81 (lines=47) @@
32
 * @link      https://github.com/techdivision/import
33
 * @link      http://www.techdivision.com
34
 */
35
class ProductWebsiteRepository extends AbstractRepository
36
{
37
38
    /**
39
     * The prepared statement to load the existing product website relations.
40
     *
41
     * @var \PDOStatement
42
     */
43
    protected $productWebsiteStmt;
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->productWebsiteStmt = $this->getConnection()->prepare($utilityClassName::PRODUCT_WEBSITE);
58
    }
59
60
    /**
61
     * Load's and return's the product website relation with the passed product and website ID.
62
     *
63
     * @param string $productId The product ID of the relation
64
     * @param string $websiteId The website ID of the relation
65
     *
66
     * @return array The product website
67
     */
68
    public function findOneByProductIdAndWebsite($productId, $websiteId)
69
    {
70
71
        // prepare the params
72
        $params = array(
73
            MemberNames::PRODUCT_ID => $productId,
74
            MemberNames::WEBSITE_ID => $websiteId
75
        );
76
77
        // load and return the product with the passed product/website ID
78
        $this->productWebsiteStmt->execute($params);
79
        return $this->productWebsiteStmt->fetch(\PDO::FETCH_ASSOC);
80
    }
81
}
82

src/Repositories/StockItemRepository.php 1 location

@@ 35-83 (lines=49) @@
32
 * @link      https://github.com/techdivision/import
33
 * @link      http://www.techdivision.com
34
 */
35
class StockItemRepository extends AbstractRepository
36
{
37
38
    /**
39
     * The prepared statement to load the existing stock items.
40
     *
41
     * @var \PDOStatement
42
     */
43
    protected $stockItemStmt;
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->stockItemStmt = $this->getConnection()->prepare($utilityClassName::STOCK_ITEM);
58
    }
59
60
    /**
61
     * Load's and return's the stock item with the passed product/website/stock ID.
62
     *
63
     * @param integer $productId The product ID of the stock item to load
64
     * @param integer $websiteId The website ID of the stock item to load
65
     * @param integer $stockId   The stock ID of the stock item to load
66
     *
67
     * @return array The stock item
68
     */
69
    public function findOneByProductIdAndWebsiteIdAndStockId($productId, $websiteId, $stockId)
70
    {
71
72
        // prepare the params
73
        $params = array(
74
            MemberNames::PRODUCT_ID => $productId,
75
            MemberNames::WEBSITE_ID => $websiteId,
76
            MemberNames::STOCK_ID   => $stockId
77
        );
78
79
        // load and return the stock status with the passed product/website/stock ID
80
        $this->stockItemStmt->execute($params);
81
        return $this->stockItemStmt->fetch(\PDO::FETCH_ASSOC);
82
    }
83
}
84

src/Repositories/StockStatusRepository.php 1 location

@@ 35-83 (lines=49) @@
32
 * @link      https://github.com/techdivision/import
33
 * @link      http://www.techdivision.com
34
 */
35
class StockStatusRepository extends AbstractRepository
36
{
37
38
    /**
39
     * The prepared statement to load the existing stock status.
40
     *
41
     * @var \PDOStatement
42
     */
43
    protected $stockStatusStmt;
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->stockStatusStmt = $this->getConnection()->prepare($utilityClassName::STOCK_STATUS);
58
    }
59
60
    /**
61
     * Load's and return's the stock status with the passed product/website/stock ID.
62
     *
63
     * @param integer $productId The product ID of the stock status to load
64
     * @param integer $websiteId The website ID of the stock status to load
65
     * @param integer $stockId   The stock ID of the stock status to load
66
     *
67
     * @return array The stock status
68
     */
69
    public function findOneByProductIdAndWebsiteIdAndStockId($productId, $websiteId, $stockId)
70
    {
71
72
        // prepare the params
73
        $params = array(
74
            MemberNames::PRODUCT_ID => $productId,
75
            MemberNames::WEBSITE_ID => $websiteId,
76
            MemberNames::STOCK_ID   => $stockId
77
        );
78
79
        // load and return the stock status with the passed product/website/stock ID
80
        $this->stockStatusStmt->execute($params);
81
        return $this->stockStatusStmt->fetch(\PDO::FETCH_ASSOC);
82
    }
83
}
84