| @@ 35-83 (lines=49) @@ | ||
| 32 | * @link https://github.com/techdivision/import-product-bundle |
|
| 33 | * @link http://www.techdivision.com |
|
| 34 | */ |
|
| 35 | class BundleOptionRepository extends AbstractRepository |
|
| 36 | { |
|
| 37 | ||
| 38 | /** |
|
| 39 | * The prepared statement to load a existing bundle option. |
|
| 40 | * |
|
| 41 | * @var \PDOStatement |
|
| 42 | */ |
|
| 43 | protected $bundleOptionStmt; |
|
| 44 | ||
| 45 | /** |
|
| 46 | * Initializes the repository's prepared statements. |
|
| 47 | * |
|
| 48 | * @return void |
|
| 49 | */ |
|
| 50 | public function init() |
|
| 51 | { |
|
| 52 | ||
| 53 | // load the utility class name |
|
| 54 | $utilityClassName = $this->getUtilityClassName(); |
|
| 55 | ||
| 56 | // initialize the prepared statements |
|
| 57 | $this->bundleOptionStmt = $this->getConnection()->prepare($utilityClassName::BUNDLE_OPTION); |
|
| 58 | } |
|
| 59 | ||
| 60 | /** |
|
| 61 | * Load's the bundle option with the passed name, store + parent ID. |
|
| 62 | * |
|
| 63 | * @param string $title The title of the bundle option to be returned |
|
| 64 | * @param integer $storeId The store ID of the bundle option to be returned |
|
| 65 | * @param integer $parentId The entity of the product the bundle option is related with |
|
| 66 | * |
|
| 67 | * @return array The bundle option |
|
| 68 | */ |
|
| 69 | public function findOneByNameAndStoreIdAndParentId($title, $storeId, $parentId) |
|
| 70 | { |
|
| 71 | ||
| 72 | // initialize the params |
|
| 73 | $params = array( |
|
| 74 | MemberNames::PARENT_ID => $parentId, |
|
| 75 | MemberNames::TITLE => $title, |
|
| 76 | MemberNames::STORE_ID => $storeId |
|
| 77 | ); |
|
| 78 | ||
| 79 | // load and return the bundle option with the passed name/store/parent ID |
|
| 80 | $this->bundleOptionStmt->execute($params); |
|
| 81 | return $this->bundleOptionStmt->fetch(\PDO::FETCH_ASSOC); |
|
| 82 | } |
|
| 83 | } |
|
| 84 | ||
| @@ 35-83 (lines=49) @@ | ||
| 32 | * @link https://github.com/techdivision/import-product-bundle |
|
| 33 | * @link http://www.techdivision.com |
|
| 34 | */ |
|
| 35 | class BundleOptionValueRepository extends AbstractRepository |
|
| 36 | { |
|
| 37 | ||
| 38 | /** |
|
| 39 | * The prepared statement to load a existing bundle option. |
|
| 40 | * |
|
| 41 | * @var \PDOStatement |
|
| 42 | */ |
|
| 43 | protected $bundleOptionValueStmt; |
|
| 44 | ||
| 45 | /** |
|
| 46 | * Initializes the repository's prepared statements. |
|
| 47 | * |
|
| 48 | * @return void |
|
| 49 | */ |
|
| 50 | public function init() |
|
| 51 | { |
|
| 52 | ||
| 53 | // load the utility class name |
|
| 54 | $utilityClassName = $this->getUtilityClassName(); |
|
| 55 | ||
| 56 | // initialize the prepared statements |
|
| 57 | $this->bundleOptionValueStmt = $this->getConnection()->prepare($utilityClassName::BUNDLE_OPTION_VALUE); |
|
| 58 | } |
|
| 59 | ||
| 60 | /** |
|
| 61 | * Load's the bundle option with the passed name, store + parent ID. |
|
| 62 | * |
|
| 63 | * @param string $title The title of the bundle option to be returned |
|
| 64 | * @param integer $storeId The store ID of the bundle option to be returned |
|
| 65 | * @param integer $parentId The entity of the product the bundle option is related with |
|
| 66 | * |
|
| 67 | * @return array The bundle option |
|
| 68 | */ |
|
| 69 | public function findOneByNameAndStoreIdAndParentId($title, $storeId, $parentId) |
|
| 70 | { |
|
| 71 | ||
| 72 | // initialize the params |
|
| 73 | $params = array( |
|
| 74 | MemberNames::PARENT_ID => $parentId, |
|
| 75 | MemberNames::TITLE => $title, |
|
| 76 | MemberNames::STORE_ID => $storeId |
|
| 77 | ); |
|
| 78 | ||
| 79 | // load and return the bundle option value with the passed name/store/parent ID |
|
| 80 | $this->bundleOptionValueStmt->execute($params); |
|
| 81 | return $this->bundleOptionValueStmt->fetch(\PDO::FETCH_ASSOC); |
|
| 82 | } |
|
| 83 | } |
|
| 84 | ||
| @@ 35-81 (lines=47) @@ | ||
| 32 | * @link https://github.com/techdivision/import-product-bundle |
|
| 33 | * @link http://www.techdivision.com |
|
| 34 | */ |
|
| 35 | class BundleSelectionPriceRepository extends AbstractRepository |
|
| 36 | { |
|
| 37 | ||
| 38 | /** |
|
| 39 | * The prepared statement to load a existing bundle selection. |
|
| 40 | * |
|
| 41 | * @var \PDOStatement |
|
| 42 | */ |
|
| 43 | protected $bundleSelectionPriceStmt; |
|
| 44 | ||
| 45 | /** |
|
| 46 | * Initializes the repository's prepared statements. |
|
| 47 | * |
|
| 48 | * @return void |
|
| 49 | */ |
|
| 50 | public function init() |
|
| 51 | { |
|
| 52 | ||
| 53 | // load the utility class name |
|
| 54 | $utilityClassName = $this->getUtilityClassName(); |
|
| 55 | ||
| 56 | // initialize the prepared statements |
|
| 57 | $this->bundleSelectionPriceStmt = $this->getConnection()->prepare($utilityClassName::BUNDLE_SELECTION_PRICE); |
|
| 58 | } |
|
| 59 | ||
| 60 | /** |
|
| 61 | * Load's the bundle selection price with the passed selection/website ID. |
|
| 62 | * |
|
| 63 | * @param integer $selectionId The selection ID of the bundle selection price to be returned |
|
| 64 | * @param integer $websiteId The website ID of the bundle selection price to be returned |
|
| 65 | * |
|
| 66 | * @return array The bundle selection price |
|
| 67 | */ |
|
| 68 | public function findOneByOptionIdAndProductIdAndParentProductId($selectionId, $websiteId) |
|
| 69 | { |
|
| 70 | ||
| 71 | // initialize the params |
|
| 72 | $params = array( |
|
| 73 | MemberNames::SELECTION_ID => $selectionId, |
|
| 74 | MemberNames::WEBSITE_ID => $websiteId |
|
| 75 | ); |
|
| 76 | ||
| 77 | // load and return the bundle option with the passed selection/website ID |
|
| 78 | $this->bundleSelectionPriceStmt->execute($params); |
|
| 79 | return $this->bundleSelectionPriceStmt->fetch(\PDO::FETCH_ASSOC); |
|
| 80 | } |
|
| 81 | } |
|
| 82 | ||
| @@ 35-83 (lines=49) @@ | ||
| 32 | * @link https://github.com/techdivision/import-product-bundle |
|
| 33 | * @link http://www.techdivision.com |
|
| 34 | */ |
|
| 35 | class BundleSelectionRepository extends AbstractRepository |
|
| 36 | { |
|
| 37 | ||
| 38 | /** |
|
| 39 | * The prepared statement to load a existing bundle selection. |
|
| 40 | * |
|
| 41 | * @var \PDOStatement |
|
| 42 | */ |
|
| 43 | protected $bundleSelectionStmt; |
|
| 44 | ||
| 45 | /** |
|
| 46 | * Initializes the repository's prepared statements. |
|
| 47 | * |
|
| 48 | * @return void |
|
| 49 | */ |
|
| 50 | public function init() |
|
| 51 | { |
|
| 52 | ||
| 53 | // load the utility class name |
|
| 54 | $utilityClassName = $this->getUtilityClassName(); |
|
| 55 | ||
| 56 | // initialize the prepared statements |
|
| 57 | $this->bundleSelectionStmt = $this->getConnection()->prepare($utilityClassName::BUNDLE_SELECTION); |
|
| 58 | } |
|
| 59 | ||
| 60 | /** |
|
| 61 | * Load's the bundle selection value with the passed option/product/parent product ID. |
|
| 62 | * |
|
| 63 | * @param integer $optionId The option ID of the bundle selection to be returned |
|
| 64 | * @param integer $productId The product ID of the bundle selection to be returned |
|
| 65 | * @param integer $parentProductId The parent product ID of the bundle selection to be returned |
|
| 66 | * |
|
| 67 | * @return array The bundle selection |
|
| 68 | */ |
|
| 69 | public function findOneByOptionIdAndProductIdAndParentProductId($optionId, $productId, $parentProductId) |
|
| 70 | { |
|
| 71 | ||
| 72 | // initialize the params |
|
| 73 | $params = array( |
|
| 74 | MemberNames::OPTION_ID => $optionId, |
|
| 75 | MemberNames::PARENT_PRODUCT_ID => $parentProductId, |
|
| 76 | MemberNames::PRODUCT_ID => $productId |
|
| 77 | ); |
|
| 78 | ||
| 79 | // load and return the bundle option with the passed option/product/parent product ID |
|
| 80 | $this->bundleSelectionStmt->execute($params); |
|
| 81 | return $this->bundleSelectionStmt->fetch(\PDO::FETCH_ASSOC); |
|
| 82 | } |
|
| 83 | } |
|
| 84 | ||