findOneByProductId()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
3
/**
4
 * TechDivision\Import\Product\Magic360\Repositories\ProductMagic360ColumnsRepository
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
 * @author    Bernhard Wick <[email protected]>
16
 * @copyright 2017 TechDivision GmbH <[email protected]>
17
 * @license   http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
 * @link      https://github.com/techdivision/import-product-magic360
19
 * @link      http://www.techdivision.com
20
 */
21
22
namespace TechDivision\Import\Product\Magic360\Repositories;
23
24
use TechDivision\Import\Repositories\AbstractRepository;
25
use TechDivision\Import\Product\Magic360\Utils\ParamNames;
26
use TechDivision\Import\Product\Magic360\Utils\SqlStatementKeys;
27
28
/**
29
 * Repository implementation to load magic360 column data.
30
 *
31
 * @author    Tim Wagner <[email protected]>
32
 * @author    Bernhard Wick <[email protected]>
33
 * @copyright 2017 TechDivision GmbH <[email protected]>
34
 * @license   http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
35
 * @link      https://github.com/techdivision/import-product-magic360
36
 * @link      http://www.techdivision.com
37
 */
38
class ProductMagic360ColumnsRepository extends AbstractRepository implements ProductMagic360ColumnsRepositoryInterface
39
{
40
41
    /**
42
     * The prepared statement to load an existing product media gallery value entity.
43
     *
44
     * @var \PDOStatement
45
     */
46
    protected $statement;
47
48
    /**
49
     * Initializes the repository's prepared statements.
50
     *
51
     * @return void
52
     */
53
    public function init()
54
    {
55
56
        // initialize the prepared statements
57
        $this->statement =
58
            $this->getConnection()->prepare($this->loadStatement(SqlStatementKeys::MAGIC360_COLUMNS));
59
    }
60
61
    /**
62
     * Load's the product media gallery value with the passed value/store/parent ID.
63
     *
64
     * @param integer $productId The value ID of the product media gallery value to load
65
     *
66
     * @return array The product media gallery value
67
     */
68
    public function findOneByProductId($productId)
69
    {
70
71
        // load and return the prodcut media gallery value with the passed value/store/parent ID
72
        $this->statement->execute(array(ParamNames::PRODUCT_ID => $productId));
73
        return $this->statement->fetch(\PDO::FETCH_ASSOC);
74
    }
75
}
76