Code Duplication    Length = 68-68 lines in 4 locations

src/Repositories/ProductDatetimeRepository.php 1 location

@@ 37-104 (lines=68) @@
34
 * @link      https://github.com/techdivision/import-product
35
 * @link      http://www.techdivision.com
36
 */
37
class ProductDatetimeRepository extends AbstractFinderRepository implements ProductDatetimeRepositoryInterface
38
{
39
40
    /**
41
     * Initializes the repository's prepared statements.
42
     *
43
     * @return void
44
     */
45
    public function init()
46
    {
47
48
        // initialize the prepared statements
49
        $this->addFinder($this->finderFactory->createFinder($this, SqlStatementKeys::PRODUCT_DATETIMES));
50
        $this->addFinder($this->finderFactory->createFinder($this, SqlStatementKeys::PRODUCT_DATETIMES_BY_PK_AND_STORE_ID));
51
    }
52
53
    /**
54
     * Return's the primary key name of the entity.
55
     *
56
     * @return string The name of the entity's primary key
57
     */
58
    public function getPrimaryKeyName()
59
    {
60
        return MemberNames::VALUE_ID;
61
    }
62
63
    /**
64
     * Return's the finder's entity name.
65
     *
66
     * @return string The finder's entity name
67
     */
68
    public function getEntityName()
69
    {
70
        return CacheKeys::PRODUCT_DATETIME;
71
    }
72
73
    /**
74
     * Load's and return's the available datetime attributes.
75
     *
76
     * @return array The integer attributes
77
     */
78
    public function findAll()
79
    {
80
        foreach ($this->getFinder(SqlStatementKeys::PRODUCT_DATETIMES)->find() as $result) {
81
            yield $result;
82
        }
83
    }
84
85
    /**
86
     * Load's and return's the datetime attributes for the passed primary key/store ID.
87
     *
88
     * @param integer $pk      The primary key of the attributes
89
     * @param integer $storeId The store ID of the attributes
90
     *
91
     * @return array The datetime attributes
92
     */
93
    public function findAllByPrimaryKeyAndStoreId($pk, $storeId)
94
    {
95
96
        // prepare the params
97
        $params = array(MemberNames::PK => $pk, MemberNames::STORE_ID => $storeId);
98
99
        // load the entities and return them
100
        foreach ($this->getFinder(SqlStatementKeys::PRODUCT_DATETIMES_BY_PK_AND_STORE_ID)->find($params) as $result) {
101
            yield $result;
102
        }
103
    }
104
}
105

src/Repositories/ProductDecimalRepository.php 1 location

@@ 37-104 (lines=68) @@
34
 * @link      https://github.com/techdivision/import-product
35
 * @link      http://www.techdivision.com
36
 */
37
class ProductDecimalRepository extends AbstractFinderRepository implements ProductDecimalRepositoryInterface
38
{
39
40
    /**
41
     * Initializes the repository's prepared statements.
42
     *
43
     * @return void
44
     */
45
    public function init()
46
    {
47
48
        // initialize the prepared statements
49
        $this->addFinder($this->finderFactory->createFinder($this, SqlStatementKeys::PRODUCT_DECIMALS));
50
        $this->addFinder($this->finderFactory->createFinder($this, SqlStatementKeys::PRODUCT_DECIMALS_BY_PK_AND_STORE_ID));
51
    }
52
53
    /**
54
     * Return's the primary key name of the entity.
55
     *
56
     * @return string The name of the entity's primary key
57
     */
58
    public function getPrimaryKeyName()
59
    {
60
        return MemberNames::VALUE_ID;
61
    }
62
63
    /**
64
     * Return's the finder's entity name.
65
     *
66
     * @return string The finder's entity name
67
     */
68
    public function getEntityName()
69
    {
70
        return CacheKeys::PRODUCT_DECIMAL;
71
    }
72
73
    /**
74
     * Load's and return's the available decimals attributes.
75
     *
76
     * @return array The decimal attributes
77
     */
78
    public function findAll()
79
    {
80
        foreach ($this->getFinder(SqlStatementKeys::PRODUCT_DECIMALS)->find() as $result) {
81
            yield $result;
82
        }
83
    }
84
85
    /**
86
     * Load's and return's the decimal attributes for the passed primary key/store ID.
87
     *
88
     * @param integer $pk      The primary key of the attributes
89
     * @param integer $storeId The store ID of the attributes
90
     *
91
     * @return array The decimal attributes
92
     */
93
    public function findAllByPrimaryKeyAndStoreId($pk, $storeId)
94
    {
95
96
        // prepare the params
97
        $params = array(MemberNames::PK => $pk, MemberNames::STORE_ID => $storeId);
98
99
        // load the entities and return them
100
        foreach ($this->getFinder(SqlStatementKeys::PRODUCT_DECIMALS_BY_PK_AND_STORE_ID)->find($params) as $result) {
101
            yield $result;
102
        }
103
    }
104
}
105

src/Repositories/ProductIntRepository.php 1 location

@@ 37-104 (lines=68) @@
34
 * @link      https://github.com/techdivision/import-product
35
 * @link      http://www.techdivision.com
36
 */
37
class ProductIntRepository extends AbstractFinderRepository implements ProductIntRepositoryInterface
38
{
39
40
    /**
41
     * Initializes the repository's prepared statements.
42
     *
43
     * @return void
44
     */
45
    public function init()
46
    {
47
48
        // initialize the prepared statements
49
        $this->addFinder($this->finderFactory->createFinder($this, SqlStatementKeys::PRODUCT_INTS));
50
        $this->addFinder($this->finderFactory->createFinder($this, SqlStatementKeys::PRODUCT_INTS_BY_PK_AND_STORE_ID));
51
    }
52
53
    /**
54
     * Return's the primary key name of the entity.
55
     *
56
     * @return string The name of the entity's primary key
57
     */
58
    public function getPrimaryKeyName()
59
    {
60
        return MemberNames::VALUE_ID;
61
    }
62
63
    /**
64
     * Return's the finder's entity name.
65
     *
66
     * @return string The finder's entity name
67
     */
68
    public function getEntityName()
69
    {
70
        return CacheKeys::PRODUCT_INT;
71
    }
72
73
    /**
74
     * Load's and return's the available integer attributes.
75
     *
76
     * @return array The integer attributes
77
     */
78
    public function findAll()
79
    {
80
        foreach ($this->getFinder(SqlStatementKeys::PRODUCT_INTS)->find() as $result) {
81
            yield $result;
82
        }
83
    }
84
85
    /**
86
     * Load's and return's the text attributes with the passed primary key/store ID.
87
     *
88
     * @param integer $pk      The primary key of the attributes
89
     * @param integer $storeId The store ID of the attributes
90
     *
91
     * @return array The text attributes
92
     */
93
    public function findAllByPrimaryKeyAndStoreId($pk, $storeId)
94
    {
95
96
        // prepare the params
97
        $params = array(MemberNames::PK => $pk, MemberNames::STORE_ID => $storeId);
98
99
        // load the entities and return them
100
        foreach ($this->getFinder(SqlStatementKeys::PRODUCT_INTS_BY_PK_AND_STORE_ID)->find($params) as $result) {
101
            yield $result;
102
        }
103
    }
104
}
105

src/Repositories/ProductTextRepository.php 1 location

@@ 37-104 (lines=68) @@
34
 * @link      https://github.com/techdivision/import-product
35
 * @link      http://www.techdivision.com
36
 */
37
class ProductTextRepository extends AbstractFinderRepository implements ProductTextRepositoryInterface
38
{
39
40
    /**
41
     * Initializes the repository's prepared statements.
42
     *
43
     * @return void
44
     */
45
    public function init()
46
    {
47
48
        // initialize the prepared statements
49
        $this->addFinder($this->finderFactory->createFinder($this, SqlStatementKeys::PRODUCT_TEXTS));
50
        $this->addFinder($this->finderFactory->createFinder($this, SqlStatementKeys::PRODUCT_TEXTS_BY_PK_AND_STORE_ID));
51
    }
52
53
    /**
54
     * Return's the primary key name of the entity.
55
     *
56
     * @return string The name of the entity's primary key
57
     */
58
    public function getPrimaryKeyName()
59
    {
60
        return MemberNames::VALUE_ID;
61
    }
62
63
    /**
64
     * Return's the finder's entity name.
65
     *
66
     * @return string The finder's entity name
67
     */
68
    public function getEntityName()
69
    {
70
        return CacheKeys::PRODUCT_TEXT;
71
    }
72
73
    /**
74
     * Load's and return's the available text attributes.
75
     *
76
     * @return array The text attributes
77
     */
78
    public function findAll()
79
    {
80
        foreach ($this->getFinder(SqlStatementKeys::PRODUCT_TEXTS)->find() as $result) {
81
            yield $result;
82
        }
83
    }
84
85
    /**
86
     * Load's and return's the text attributes with the passed primary key/store ID.
87
     *
88
     * @param integer $pk      The primary key of the attributes
89
     * @param integer $storeId The store ID of the attributes
90
     *
91
     * @return array The text attributes
92
     */
93
    public function findAllByPrimaryKeyAndStoreId($pk, $storeId)
94
    {
95
96
        // prepare the params
97
        $params = array(MemberNames::PK => $pk, MemberNames::STORE_ID => $storeId);
98
99
        // load the entities and return them
100
        foreach ($this->getFinder(SqlStatementKeys::PRODUCT_TEXTS_BY_PK_AND_STORE_ID)->find($params) as $result) {
101
            yield $result;
102
        }
103
    }
104
}
105