| @@ 39-83 (lines=45) @@ | ||
| 36 | * @link https://www.techdivision.com |
|
| 37 | * @link https://www.refusion.com |
|
| 38 | */ |
|
| 39 | class CustomerGroupRepository extends AbstractRepository implements CustomerGroupRepositoryInterface |
|
| 40 | { |
|
| 41 | ||
| 42 | /** |
|
| 43 | * The prepared statement to load the customer groups. |
|
| 44 | * |
|
| 45 | * @var \PDOStatement |
|
| 46 | */ |
|
| 47 | protected $customerGroupsStmt; |
|
| 48 | ||
| 49 | /** |
|
| 50 | * Initializes the repository's prepared statements. |
|
| 51 | * |
|
| 52 | * @return void |
|
| 53 | */ |
|
| 54 | public function init() |
|
| 55 | { |
|
| 56 | // initialize the prepared statements |
|
| 57 | $this->customerGroupsStmt = |
|
| 58 | $this->getConnection()->prepare($this->loadStatement(SqlStatementKeys::CUSTOMER_GROUPS)); |
|
| 59 | } |
|
| 60 | ||
| 61 | /** |
|
| 62 | * Returns an array with the available customer groups and their code as keys. |
|
| 63 | * |
|
| 64 | * @return array The array with the customer groups |
|
| 65 | */ |
|
| 66 | public function findAll() |
|
| 67 | { |
|
| 68 | ||
| 69 | // initialize the array for the customer groups |
|
| 70 | $customerGroups = []; |
|
| 71 | ||
| 72 | // execute the prepared statement |
|
| 73 | $this->customerGroupsStmt->execute(); |
|
| 74 | ||
| 75 | // fetch the customer groups and assemble them as array with the codes as key |
|
| 76 | foreach ($this->customerGroupsStmt->fetchAll() as $customerGroup) { |
|
| 77 | $customerGroups[$customerGroup[MemberNames::CUSTOMER_GROUP_CODE]] = $customerGroup; |
|
| 78 | } |
|
| 79 | ||
| 80 | // return the customer groups |
|
| 81 | return $customerGroups; |
|
| 82 | } |
|
| 83 | } |
|
| 84 | ||
| @@ 35-81 (lines=47) @@ | ||
| 32 | * @link https://github.com/techdivision/import |
|
| 33 | * @link http://www.techdivision.com |
|
| 34 | */ |
|
| 35 | class StoreWebsiteRepository extends AbstractRepository implements StoreWebsiteRepositoryInterface |
|
| 36 | { |
|
| 37 | ||
| 38 | /** |
|
| 39 | * The prepared statement to load the store websites. |
|
| 40 | * |
|
| 41 | * @var \PDOStatement |
|
| 42 | */ |
|
| 43 | protected $storeWebsitesStmt; |
|
| 44 | ||
| 45 | /** |
|
| 46 | * Initializes the repository's prepared statements. |
|
| 47 | * |
|
| 48 | * @return void |
|
| 49 | */ |
|
| 50 | public function init() |
|
| 51 | { |
|
| 52 | ||
| 53 | // initialize the prepared statements |
|
| 54 | $this->storeWebsitesStmt = |
|
| 55 | $this->getConnection()->prepare($this->loadStatement(SqlStatementKeys::STORE_WEBSITES)); |
|
| 56 | } |
|
| 57 | ||
| 58 | /** |
|
| 59 | * Return's an array with the available store websites and their |
|
| 60 | * code as keys. |
|
| 61 | * |
|
| 62 | * @return array The array with all available store websites |
|
| 63 | */ |
|
| 64 | public function findAll() |
|
| 65 | { |
|
| 66 | ||
| 67 | // initialize the array with the available store websites |
|
| 68 | $storeWebsites = array(); |
|
| 69 | ||
| 70 | // execute the prepared statement |
|
| 71 | $this->storeWebsitesStmt->execute(); |
|
| 72 | ||
| 73 | // fetch the store websites and assemble them as array with the codes as key |
|
| 74 | foreach ($this->storeWebsitesStmt->fetchAll() as $storeWebsite) { |
|
| 75 | $storeWebsites[$storeWebsite[MemberNames::CODE]] = $storeWebsite; |
|
| 76 | } |
|
| 77 | ||
| 78 | // return the array with the store websites |
|
| 79 | return $storeWebsites; |
|
| 80 | } |
|
| 81 | } |
|
| 82 | ||
| @@ 35-74 (lines=40) @@ | ||
| 32 | * @link https://github.com/techdivision/import |
|
| 33 | * @link http://www.techdivision.com |
|
| 34 | */ |
|
| 35 | class TaxClassRepository extends AbstractRepository implements TaxClassRepositoryInterface |
|
| 36 | { |
|
| 37 | ||
| 38 | /** |
|
| 39 | * Initializes the repository's prepared statements. |
|
| 40 | * |
|
| 41 | * @return void |
|
| 42 | */ |
|
| 43 | public function init() |
|
| 44 | { |
|
| 45 | ||
| 46 | // initialize the prepared statements |
|
| 47 | $this->taxClassesStmt = |
|
| 48 | $this->getConnection()->prepare($this->loadStatement(SqlStatementKeys::TAX_CLASSES)); |
|
| 49 | } |
|
| 50 | ||
| 51 | /** |
|
| 52 | * Return's an array with the available tax classes and their |
|
| 53 | * class names as keys. |
|
| 54 | * |
|
| 55 | * @return array The array with all available tax classes |
|
| 56 | */ |
|
| 57 | public function findAll() |
|
| 58 | { |
|
| 59 | ||
| 60 | // initialize the array with the available tax classes |
|
| 61 | $taxClasses = array(); |
|
| 62 | ||
| 63 | // execute the prepared statement |
|
| 64 | $this->taxClassesStmt->execute(); |
|
| 65 | ||
| 66 | // fetch the tax classes and assemble them as array with the class name as key |
|
| 67 | foreach ($this->taxClassesStmt->fetchAll() as $taxClass) { |
|
| 68 | $taxClasses[$taxClass[MemberNames::CLASS_NAME]] = $taxClass; |
|
| 69 | } |
|
| 70 | ||
| 71 | // return the array with the tax classes |
|
| 72 | return $taxClasses; |
|
| 73 | } |
|
| 74 | } |
|
| 75 | ||