1 <?php
2
3 /* --------------------------------------------------------------
4 CategoryListProviderFactory.inc.php 2015-11-27
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 CategoryListProviderFactory
15 *
16 * This class creates CategoryListProvider objects for a specific language and filter of customer status permissions
17 * with its dependencies.
18 *
19 * @category System
20 * @package Category
21 * @subpackage Factories
22 */
23 class CategoryListProviderFactory implements CategoryListProviderFactoryInterface
24 {
25 /**
26 * Category repository.
27 *
28 * @var CategoryRepositoryInterface
29 */
30 protected $categoryRepo;
31
32 /**
33 * Database connector.
34 *
35 * @var CI_DB_query_builder
36 */
37 protected $db;
38
39
40 /**
41 * CategoryListProviderFactory constructor.
42 *
43 * @param CategoryRepositoryInterface $categoryRepo Category repository.
44 * @param CI_DB_query_builder $db Database connector.
45 */
46 public function __construct(CategoryRepositoryInterface $categoryRepo, CI_DB_query_builder $db)
47 {
48 $this->categoryRepo = $categoryRepo;
49 $this->db = $db;
50 }
51
52
53 /**
54 * Creates a CategoryListProvider for retrieving lists.
55 *
56 * @param LanguageCode $languageCode Two letter language code.
57 * @param array $conditions Optional conditions for data request.
58 *
59 * @return CategoryListProviderInterface
60 */
61 public function createCategoryListProvider(LanguageCode $languageCode, array $conditions = array())
62 {
63 return MainFactory::create('CategoryListProvider', $languageCode, $conditions, $this->categoryRepo, $this->db);
64 }
65 }