| @@ 37-76 (lines=40) @@ | ||
| 34 | * @link https://github.com/techdivision/import-product-magic360 |
|
| 35 | * @link http://www.techdivision.com |
|
| 36 | */ |
|
| 37 | class ProductMagic360ColumnsRepository extends AbstractRepository |
|
| 38 | { |
|
| 39 | ||
| 40 | /** |
|
| 41 | * The prepared statement to load an existing product media gallery value entity. |
|
| 42 | * |
|
| 43 | * @var \PDOStatement |
|
| 44 | */ |
|
| 45 | protected $statement; |
|
| 46 | ||
| 47 | /** |
|
| 48 | * Initializes the repository's prepared statements. |
|
| 49 | * |
|
| 50 | * @return void |
|
| 51 | */ |
|
| 52 | public function init() |
|
| 53 | { |
|
| 54 | ||
| 55 | // load the utility class name |
|
| 56 | $utilityClassName = $this->getUtilityClassName(); |
|
| 57 | ||
| 58 | // initialize the prepared statements |
|
| 59 | $this->statement = $this->getConnection()->prepare($utilityClassName::MAGIC360_COLUMNS); |
|
| 60 | } |
|
| 61 | ||
| 62 | /** |
|
| 63 | * Load's the product media gallery value with the passed value/store/parent ID. |
|
| 64 | * |
|
| 65 | * @param integer $productId The value ID of the product media gallery value to load |
|
| 66 | * |
|
| 67 | * @return array The product media gallery value |
|
| 68 | */ |
|
| 69 | public function findOneByProductId($productId) |
|
| 70 | { |
|
| 71 | // load and return the prodcut media gallery value with the passed value/store/parent ID |
|
| 72 | $this->statement->execute(array(MemberNames::PRODUCT_ID => $productId)); |
|
| 73 | ||
| 74 | return $this->statement->fetch(\PDO::FETCH_ASSOC); |
|
| 75 | } |
|
| 76 | } |
|
| 77 | ||
| @@ 37-80 (lines=44) @@ | ||
| 34 | * @link https://github.com/techdivision/import-product-magic360 |
|
| 35 | * @link http://www.techdivision.com |
|
| 36 | */ |
|
| 37 | class ProductMagic360GalleryRepository extends AbstractRepository |
|
| 38 | { |
|
| 39 | ||
| 40 | /** |
|
| 41 | * The prepared statement to load an existing product media gallery entity. |
|
| 42 | * |
|
| 43 | * @var \PDOStatement |
|
| 44 | */ |
|
| 45 | protected $statement; |
|
| 46 | ||
| 47 | /** |
|
| 48 | * Initializes the repository's prepared statements. |
|
| 49 | * |
|
| 50 | * @return void |
|
| 51 | */ |
|
| 52 | public function init() |
|
| 53 | { |
|
| 54 | ||
| 55 | // load the utility class name |
|
| 56 | $utilityClassName = $this->getUtilityClassName(); |
|
| 57 | ||
| 58 | // initialize the prepared statements |
|
| 59 | $this->statement = $this->getConnection()->prepare($utilityClassName::MAGIC360_GALLERY); |
|
| 60 | } |
|
| 61 | ||
| 62 | /** |
|
| 63 | * Load's the product media gallery with the passed attribute ID + value. |
|
| 64 | * |
|
| 65 | * @param integer $productId The attribute ID of the product media gallery to load |
|
| 66 | * @param integer $position The value of the product media gallery to load |
|
| 67 | * |
|
| 68 | * @return array The product media gallery |
|
| 69 | */ |
|
| 70 | public function findOneByProductIdAndPosition($productId, $position) |
|
| 71 | { |
|
| 72 | // load and return the prodcut media gallery with the passed attribute ID + value |
|
| 73 | $this->statement->execute(array( |
|
| 74 | MemberNames::PRODUCT_ID => $productId, |
|
| 75 | MemberNames::POSITION => $position |
|
| 76 | )); |
|
| 77 | ||
| 78 | return $this->statement->fetch(\PDO::FETCH_ASSOC); |
|
| 79 | } |
|
| 80 | } |
|
| 81 | ||