| @@ 35-81 (lines=47) @@ | ||
| 32 | * @link https://github.com/techdivision/import-product-link |
|
| 33 | * @link http://www.techdivision.com |
|
| 34 | */ |
|
| 35 | class ProductLinkAttributeIntRepository extends AbstractRepository |
|
| 36 | { |
|
| 37 | ||
| 38 | /** |
|
| 39 | * The prepared statement to load a existing product link attribute integer attribute. |
|
| 40 | * |
|
| 41 | * @var \PDOStatement |
|
| 42 | */ |
|
| 43 | protected $productLinkAttributeIntStmt; |
|
| 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->productLinkAttributeIntStmt = $this->getConnection()->prepare($utilityClassName::PRODUCT_LINK_ATTRIBUTE_INT); |
|
| 58 | } |
|
| 59 | ||
| 60 | /** |
|
| 61 | * Return's the product link attribute integer value with the passed product link attribute/link ID. |
|
| 62 | * |
|
| 63 | * @param integer $productLinkAttributeId The product link attribute ID of the attributes |
|
| 64 | * @param integer $linkId The link ID of the attribute |
|
| 65 | * |
|
| 66 | * @return array The product link attribute integer value |
|
| 67 | */ |
|
| 68 | public function findOneByProductLinkAttributeIdAndLinkId($productLinkAttributeId, $linkId) |
|
| 69 | { |
|
| 70 | ||
| 71 | // initialize the params |
|
| 72 | $params = array( |
|
| 73 | MemberNames::PRODUCT_LINK_ATTRIBUTE_ID => $productLinkAttributeId, |
|
| 74 | MemberNames::LINK_ID => $linkId |
|
| 75 | ); |
|
| 76 | ||
| 77 | // load and return the prodcut link attribute integer attribute with the passed product link attribute/link ID |
|
| 78 | $this->productLinkAttributeIntStmt->execute($params); |
|
| 79 | return $this->productLinkAttributeIntStmt->fetch(\PDO::FETCH_ASSOC); |
|
| 80 | } |
|
| 81 | } |
|
| 82 | ||
| @@ 35-83 (lines=49) @@ | ||
| 32 | * @link https://github.com/techdivision/import-product-link |
|
| 33 | * @link http://www.techdivision.com |
|
| 34 | */ |
|
| 35 | class ProductLinkRepository extends AbstractRepository |
|
| 36 | { |
|
| 37 | ||
| 38 | /** |
|
| 39 | * The prepared statement to load a existing product link. |
|
| 40 | * |
|
| 41 | * @var \PDOStatement |
|
| 42 | */ |
|
| 43 | protected $linkStmt; |
|
| 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->productLinkStmt = $this->getConnection()->prepare($utilityClassName::PRODUCT_LINK); |
|
| 58 | } |
|
| 59 | ||
| 60 | /** |
|
| 61 | * Load's the product link with the passed product/linked product/link type ID. |
|
| 62 | * |
|
| 63 | * @param integer $productId The product ID of the link to load |
|
| 64 | * @param integer $linkedProductId The linked product ID of the link to load |
|
| 65 | * @param integer $linkTypeId The link type ID of the product to load |
|
| 66 | * |
|
| 67 | * @return array The link |
|
| 68 | */ |
|
| 69 | public function findOneByProductIdAndLinkedProductIdAndLinkTypeId($productId, $linkedProductId, $linkTypeId) |
|
| 70 | { |
|
| 71 | ||
| 72 | // initialize the params |
|
| 73 | $params = array( |
|
| 74 | MemberNames::PRODUCT_ID => $productId, |
|
| 75 | MemberNames::LINKED_PRODUCT_ID => $linkedProductId, |
|
| 76 | MemberNames::LINK_TYPE_ID => $linkTypeId |
|
| 77 | ); |
|
| 78 | ||
| 79 | // load and return the prodcut link with the passed product/linked product/link type ID |
|
| 80 | $this->productLinkStmt->execute($params); |
|
| 81 | return $this->productLinkStmt->fetch(\PDO::FETCH_ASSOC); |
|
| 82 | } |
|
| 83 | } |
|
| 84 | ||