1
|
|
|
<?php |
2
|
|
|
/* |
3
|
|
|
* WellCommerce Open-Source E-Commerce Platform |
4
|
|
|
* |
5
|
|
|
* This file is part of the WellCommerce package. |
6
|
|
|
* |
7
|
|
|
* (c) Adam Piotrowski <[email protected]> |
8
|
|
|
* |
9
|
|
|
* For the full copyright and license information, |
10
|
|
|
* please view the LICENSE file that was distributed with this source code. |
11
|
|
|
*/ |
12
|
|
|
|
13
|
|
|
namespace WellCommerce\Bundle\CatalogBundle\Controller\Box; |
14
|
|
|
|
15
|
|
|
use Symfony\Component\HttpFoundation\Response; |
16
|
|
|
use WellCommerce\Bundle\CoreBundle\Controller\Box\AbstractBoxController; |
17
|
|
|
use WellCommerce\Component\Layout\Collection\LayoutBoxSettingsCollection; |
18
|
|
|
use WellCommerce\Component\DataSet\Conditions\Condition\Eq; |
19
|
|
|
use WellCommerce\Component\DataSet\Conditions\ConditionsCollection; |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* Class ProducerCollectionMenuBoxController |
23
|
|
|
* |
24
|
|
|
* @author Rafał Martonik <[email protected]> |
25
|
|
|
*/ |
26
|
|
|
class ProducerCollectionMenuBoxController extends AbstractBoxController |
27
|
|
|
{ |
28
|
|
|
/** |
29
|
|
|
* {@inheritdoc} |
30
|
|
|
*/ |
31
|
|
|
public function indexAction(LayoutBoxSettingsCollection $boxSettings) : Response |
32
|
|
|
{ |
33
|
|
|
$conditions = $this->getCurrentProducerCollectionMenuConditions(); |
34
|
|
|
$producerCollections = $this->get('producer_collection.dataset.front')->getResult('array', ['conditions' => $conditions], |
35
|
|
|
['pagination' => false]); |
36
|
|
|
|
37
|
|
|
return $this->displayTemplate('index', [ |
38
|
|
|
'producerCollections' => $producerCollections, |
39
|
|
|
'activeProducerCollection' => $this->getProducerCollectionStorage()->getCurrentProducerCollection(), |
40
|
|
|
'producer' => $this->getProducerCollectionStorage()->getCurrentProducerCollection()->getProducer(), |
41
|
|
|
]); |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* @return ConditionsCollection |
46
|
|
|
*/ |
47
|
|
|
protected function getCurrentProducerCollectionMenuConditions() : ConditionsCollection |
48
|
|
|
{ |
49
|
|
|
$conditions = new ConditionsCollection(); |
50
|
|
|
$conditions->add(new Eq('producerId', |
51
|
|
|
$this->getProducerCollectionStorage()->getCurrentProducerCollection()->getProducer()->getId())); |
52
|
|
|
|
53
|
|
|
return $conditions; |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
} |
57
|
|
|
|