1 <?php
2
3 /* --------------------------------------------------------------
4 ProductListProviderFactory.inc.php 2015-12-18
5 Gambio GmbH
6 http://www.gambio.de
7 Copyright (c) 2015 Gambio GmbH
8 Released under the GNU General Public License (Version 2)
9 [http://www.gnu.org/licenses/gpl-2.0.html]
10 --------------------------------------------------------------
11 */
12
13 /**
14 * Class ProductListProviderFactory
15 *
16 * @category System
17 * @package Product
18 * @subpackage Factories
19 */
20 class ProductListProviderFactory implements ProductListProviderFactoryInterface
21 {
22 /**
23 * Product Repository.
24 *
25 * @var ProductRepositoryInterface
26 */
27 private $productRepo;
28
29 /**
30 * The database connection.
31 *
32 * @var CI_DB_query_builder
33 */
34 private $db;
35
36
37 /**
38 * ProductListProviderFactory constructor.
39 *
40 * @param ProductRepositoryInterface $productRepo Product repository.
41 * @param CI_DB_query_builder $db Database connection.
42 */
43 public function __construct(ProductRepositoryInterface $productRepo, CI_DB_query_builder $db)
44 {
45 $this->productRepo = $productRepo;
46 $this->db = $db;
47 }
48
49
50 /**
51 * Create Product List Provider
52 *
53 * Creates and returns a product list provider.
54 *
55 * @param LanguageCode $languageCode Language code, for the language in which the product list provider should be
56 * returned.
57 * @param array $conditions Database request conditions as an associative array.
58 *
59 * @return ProductListProviderInterface
60 */
61 public function createProductListProvider(LanguageCode $languageCode, array $conditions = array())
62 {
63 return MainFactory::create('ProductListProvider', $languageCode, $conditions, $this->productRepo, $this->db);
64 }
65 }