forked from thelia/thelia
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CountryAreaQuery.php
42 lines (35 loc) · 1.08 KB
/
CountryAreaQuery.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
namespace Thelia\Model;
use Thelia\Model\Base\CountryAreaQuery as BaseCountryAreaQuery;
/**
* Skeleton subclass for performing query and update operations on the 'country_area' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
*/
class CountryAreaQuery extends BaseCountryAreaQuery
{
public static function findByCountryAndState(Country $country, State $state = null)
{
$response = null;
if (null !== $state) {
$countryAreaList = self::create()
->filterByCountryId($country->getId())
->filterByStateId($state->getId())
->find();
if (count($countryAreaList) > 0) {
return $countryAreaList;
}
}
$countryAreaList = self::create()
->filterByCountryId($country->getId())
->filterByStateId(null)
->find()
;
return $countryAreaList;
}
}