| @@ 35-81 (lines=47) @@ | ||
| 32 | * @link https://github.com/techdivision/import-product-media |
|
| 33 | * @link http://www.techdivision.com |
|
| 34 | */ |
|
| 35 | class ProductMediaGalleryRepository extends AbstractRepository |
|
| 36 | { |
|
| 37 | ||
| 38 | /** |
|
| 39 | * The prepared statement to load an existing product media gallery entity. |
|
| 40 | * |
|
| 41 | * @var \PDOStatement |
|
| 42 | */ |
|
| 43 | protected $productMediaGalleryStmt; |
|
| 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->productMediaGalleryStmt = $this->getConnection()->prepare($utilityClassName::PRODUCT_MEDIA_GALLERY); |
|
| 58 | } |
|
| 59 | ||
| 60 | /** |
|
| 61 | * Load's the product media gallery with the passed attribute ID + value. |
|
| 62 | * |
|
| 63 | * @param integer $attributeId The attribute ID of the product media gallery to load |
|
| 64 | * @param string $value The value of the product media gallery to load |
|
| 65 | * |
|
| 66 | * @return array The product media gallery |
|
| 67 | */ |
|
| 68 | public function findOneByAttributeIdAndValue($attributeId, $value) |
|
| 69 | { |
|
| 70 | ||
| 71 | // initialize the params |
|
| 72 | $params = array( |
|
| 73 | MemberNames::ATTRIBUTE_ID => $attributeId, |
|
| 74 | MemberNames::VALUE => $value |
|
| 75 | ); |
|
| 76 | ||
| 77 | // load and return the prodcut media gallery with the passed attribute ID + value |
|
| 78 | $this->productMediaGalleryStmt->execute($params); |
|
| 79 | return $this->productMediaGalleryStmt->fetch(\PDO::FETCH_ASSOC); |
|
| 80 | } |
|
| 81 | } |
|
| 82 | ||
| @@ 35-83 (lines=49) @@ | ||
| 32 | * @link https://github.com/techdivision/import-product-media |
|
| 33 | * @link http://www.techdivision.com |
|
| 34 | */ |
|
| 35 | class ProductMediaGalleryValueRepository extends AbstractRepository |
|
| 36 | { |
|
| 37 | ||
| 38 | /** |
|
| 39 | * The prepared statement to load an existing product media gallery value entity. |
|
| 40 | * |
|
| 41 | * @var \PDOStatement |
|
| 42 | */ |
|
| 43 | protected $productMediaGalleryStmt; |
|
| 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->productMediaGalleryValueStmt = $this->getConnection()->prepare($utilityClassName::PRODUCT_MEDIA_GALLERY_VALUE); |
|
| 58 | } |
|
| 59 | ||
| 60 | /** |
|
| 61 | * Load's the product media gallery value with the passed value/store/parent ID. |
|
| 62 | * |
|
| 63 | * @param integer $valueId The value ID of the product media gallery value to load |
|
| 64 | * @param string $storeId The store ID of the product media gallery value to load |
|
| 65 | * @param string $entityId The entity ID of the parent product of the product media gallery value to load |
|
| 66 | * |
|
| 67 | * @return array The product media gallery value |
|
| 68 | */ |
|
| 69 | public function findOneByValueIdAndStoreIdAndEntityId($valueId, $storeId, $entityId) |
|
| 70 | { |
|
| 71 | ||
| 72 | // initialize the params |
|
| 73 | $params = array( |
|
| 74 | MemberNames::VALUE_ID => $valueId, |
|
| 75 | MemberNames::STORE_ID => $storeId, |
|
| 76 | MemberNames::ENTITY_ID => $entityId |
|
| 77 | ); |
|
| 78 | ||
| 79 | // load and return the prodcut media gallery value with the passed value/store/parent ID |
|
| 80 | $this->productMediaGalleryValueStmt->execute($params); |
|
| 81 | return $this->productMediaGalleryValueStmt->fetch(\PDO::FETCH_ASSOC); |
|
| 82 | } |
|
| 83 | } |
|
| 84 | ||
| @@ 35-81 (lines=47) @@ | ||
| 32 | * @link https://github.com/techdivision/import-product-media |
|
| 33 | * @link http://www.techdivision.com |
|
| 34 | */ |
|
| 35 | class ProductMediaGalleryValueToEntityRepository extends AbstractRepository |
|
| 36 | { |
|
| 37 | ||
| 38 | /** |
|
| 39 | * The prepared statement to load an existing product media gallery value to entity entity. |
|
| 40 | * |
|
| 41 | * @var \PDOStatement |
|
| 42 | */ |
|
| 43 | protected $productMediaGalleryValueToEntityStmt; |
|
| 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->productMediaGalleryValueToEntityStmt = $this->getConnection()->prepare($utilityClassName::PRODUCT_MEDIA_GALLERY_VALUE_TO_ENTITY); |
|
| 58 | } |
|
| 59 | ||
| 60 | /** |
|
| 61 | * Load's the product media gallery with the passed value/entity ID. |
|
| 62 | * |
|
| 63 | * @param integer $valueId The value ID of the product media gallery value to entity to load |
|
| 64 | * @param integer $entityId The entity ID of the product media gallery value to entity to load |
|
| 65 | * |
|
| 66 | * @return array The product media gallery |
|
| 67 | */ |
|
| 68 | public function findOneByValueIdAndEntityId($valueId, $entityId) |
|
| 69 | { |
|
| 70 | ||
| 71 | // initialize the params |
|
| 72 | $params = array( |
|
| 73 | MemberNames::VALUE_ID => $valueId, |
|
| 74 | MemberNames::ENTITY_ID => $entityId |
|
| 75 | ); |
|
| 76 | ||
| 77 | // load and return the prodcut media gallery value to entity with the passed value/entity ID |
|
| 78 | $this->productMediaGalleryValueToEntityStmt->execute($params); |
|
| 79 | return $this->productMediaGalleryValueToEntityStmt->fetch(\PDO::FETCH_ASSOC); |
|
| 80 | } |
|
| 81 | } |
|
| 82 | ||