Conditions | 3 |
Paths | 4 |
Total Lines | 26 |
Code Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
39 | public function search() { |
||
40 | $types = SettingsSheet::getDictionaries(); |
||
41 | $type = explode('.', $this->type)[0]; |
||
42 | /** |
||
43 | * @var ActiveQuery $query |
||
44 | */ |
||
45 | if (isset($types[$type])) { |
||
46 | $query = $types[$type]; |
||
47 | } else { |
||
48 | $query = current($types); |
||
49 | $query->where('0=1'); |
||
50 | } |
||
51 | |||
52 | if ($this->name) { |
||
53 | $query->andWhere([ |
||
54 | 'ILIKE', |
||
55 | 'name', |
||
56 | $this->name |
||
57 | ]); |
||
58 | } |
||
59 | |||
60 | $dp = new ActiveDataProvider([ |
||
61 | 'query' => $query, |
||
62 | ]); |
||
63 | |||
64 | return $dp; |
||
65 | } |
||
71 | } |