|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* TechDivision\Import\Customer\Repositories\CustomerIntRepository |
|
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 |
|
12
|
|
|
* @link http://www.techdivision.com |
|
13
|
|
|
*/ |
|
14
|
|
|
|
|
15
|
|
|
namespace TechDivision\Import\Customer\Repositories; |
|
16
|
|
|
|
|
17
|
|
|
use TechDivision\Import\Customer\Utils\ParamNames; |
|
18
|
|
|
use TechDivision\Import\Customer\Utils\SqlStatementKeys; |
|
19
|
|
|
use TechDivision\Import\Dbal\Collection\Repositories\AbstractRepository; |
|
20
|
|
|
|
|
21
|
|
|
/** |
|
22
|
|
|
* Repository implementation to load customer integer 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 |
|
28
|
|
|
* @link http://www.techdivision.com |
|
29
|
|
|
*/ |
|
30
|
|
|
class CustomerIntRepository extends AbstractRepository implements CustomerIntRepositoryInterface |
|
31
|
|
|
{ |
|
32
|
|
|
|
|
33
|
|
|
/** |
|
34
|
|
|
* The prepared statement to load the existing customer integer attributes with the passed entity/store ID. |
|
35
|
|
|
* |
|
36
|
|
|
* @var \PDOStatement |
|
37
|
|
|
*/ |
|
38
|
|
|
protected $customerIntsStmt; |
|
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->customerIntsStmt = |
|
50
|
|
|
$this->getConnection()->prepare($this->loadStatement(SqlStatementKeys::CUSTOMER_INTS)); |
|
51
|
|
|
} |
|
52
|
|
|
|
|
53
|
|
|
/** |
|
54
|
|
|
* Load's and return's the integer attributes for the passed entity ID. |
|
55
|
|
|
* |
|
56
|
|
|
* @param integer $entityId The entity ID of the attributes |
|
57
|
|
|
* |
|
58
|
|
|
* @return array The integer 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 integer attributes with the passed entity ID |
|
67
|
|
|
$this->customerIntsStmt->execute($params); |
|
68
|
|
|
return $this->customerIntsStmt->fetchAll(\PDO::FETCH_ASSOC); |
|
69
|
|
|
} |
|
70
|
|
|
} |
|
71
|
|
|
|