|
1
|
|
|
<?php |
|
2
|
|
|
/*************************************************************************************/ |
|
3
|
|
|
/* This file is part of the Thelia package. */ |
|
4
|
|
|
/* */ |
|
5
|
|
|
/* Copyright (c) OpenStudio */ |
|
6
|
|
|
/* email : [email protected] */ |
|
7
|
|
|
/* web : http://www.thelia.net */ |
|
8
|
|
|
/* */ |
|
9
|
|
|
/* For the full copyright and license information, please view the LICENSE.txt */ |
|
10
|
|
|
/* file that was distributed with this source code. */ |
|
11
|
|
|
/*************************************************************************************/ |
|
12
|
|
|
/*************************************************************************************/ |
|
13
|
|
|
|
|
14
|
|
|
namespace Dealer\Loop; |
|
15
|
|
|
|
|
16
|
|
|
use Dealer\Model\Map\DealerBrandTableMap; |
|
17
|
|
|
use Propel\Runtime\ActiveQuery\Criteria; |
|
18
|
|
|
use Propel\Runtime\ActiveQuery\Join; |
|
19
|
|
|
use Thelia\Core\Template\Loop\Argument\Argument; |
|
20
|
|
|
use Thelia\Core\Template\Loop\Argument\ArgumentCollection; |
|
21
|
|
|
use Thelia\Core\Template\Loop\Brand; |
|
22
|
|
|
use Thelia\Model\Map\BrandTableMap; |
|
23
|
|
|
|
|
24
|
|
|
/** |
|
25
|
|
|
* Class BrandLoop |
|
26
|
|
|
* @package Dealer\Loop |
|
27
|
|
|
*/ |
|
28
|
|
|
class BrandLoop extends Brand |
|
29
|
|
|
{ |
|
30
|
|
|
/** |
|
31
|
|
|
* @inheritDoc |
|
32
|
|
|
*/ |
|
33
|
|
|
protected function getArgDefinitions() |
|
34
|
|
|
{ |
|
35
|
|
|
/** @var ArgumentCollection $arguments */ |
|
36
|
|
|
$arguments = parent::getArgDefinitions(); |
|
37
|
|
|
|
|
38
|
|
|
$arguments->addArgument( |
|
39
|
|
|
Argument::createIntListTypeArgument("dealer_id") |
|
40
|
|
|
); |
|
41
|
|
|
|
|
42
|
|
|
return $arguments; |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
|
|
public function buildModelCriteria() |
|
46
|
|
|
{ |
|
47
|
|
|
$query = parent::buildModelCriteria(); |
|
48
|
|
|
|
|
49
|
|
|
if (null != $id = $this->getDealerId()) { |
|
50
|
|
|
if (is_array($id)) { |
|
51
|
|
|
$id = implode(",", $id); |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
$dealerJoin = new Join(BrandTableMap::ID, DealerBrandTableMap::BRAND_ID, Criteria::LEFT_JOIN); |
|
55
|
|
|
$query |
|
56
|
|
|
->addJoinObject($dealerJoin, "dealerJoin") |
|
57
|
|
|
->where(DealerBrandTableMap::DEALER_ID . " " . Criteria::IN . " (" . $id . ")"); |
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
|
|
return $query; |
|
61
|
|
|
} |
|
62
|
|
|
} |
|
63
|
|
|
|