findAllByEntityId()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 9
ccs 0
cts 4
cp 0
rs 10
cc 1
nc 1
nop 1
crap 2
1
<?php
2
3
/**
4
 * TechDivision\Import\Customer\Address\Repositories\CustomerAddressDecimalRepository
5
 *
6
 * PHP version 7
7
 *
8
 * @author    Tim Wagner <[email protected]>
9
 * @copyright 2018 TechDivision GmbH <[email protected]>
10
 * @license   https://opensource.org/licenses/MIT
11
 * @link      https://github.com/techdivision/import-customer-address
12
 * @link      http://www.techdivision.com
13
 */
14
15
namespace TechDivision\Import\Customer\Address\Repositories;
16
17
use TechDivision\Import\Customer\Address\Utils\ParamNames;
18
use TechDivision\Import\Customer\Address\Utils\SqlStatementKeys;
19
use TechDivision\Import\Dbal\Collection\Repositories\AbstractRepository;
20
21
/**
22
 * Repository implementation to load customer address decimal attribute data.
23
 *
24
 * @author    Tim Wagner <[email protected]>
25
 * @copyright 2018 TechDivision GmbH <[email protected]>
26
 * @license   https://opensource.org/licenses/MIT
27
 * @link      https://github.com/techdivision/import-customer-address
28
 * @link      http://www.techdivision.com
29
 */
30
class CustomerAddressDecimalRepository extends AbstractRepository implements CustomerAddressDecimalRepositoryInterface
31
{
32
33
    /**
34
     * The prepared statement to load the existing customer address decimal attributes with the passed entity/store ID.
35
     *
36
     * @var \PDOStatement
37
     */
38
    protected $customerAddressDecimalsStmt;
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->customerAddressDecimalsStmt =
50
            $this->getConnection()->prepare($this->loadStatement(SqlStatementKeys::CUSTOMER_ADDRESS_DECIMALS));
51
    }
52
53
    /**
54
     * Load's and return's the decimal attributes for the passed entity ID.
55
     *
56
     * @param integer $entityId The entity ID of the attributes
57
     *
58
     * @return array The decimal attributes
59
     */
60
    public function findAllByEntityId($entityId)
61
    {
62
63
        // prepare the params
64
        $params = array(ParamNames::ENTITY_ID => $entityId);
65
66
        // load and return the customer decimal attributes with the passed entity ID
67
        $this->customerAddressDecimalsStmt->execute($params);
68
        return $this->customerAddressDecimalsStmt->fetchAll(\PDO::FETCH_ASSOC);
69
    }
70
}
71