|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* _ __ __ _____ _____ ___ ____ _____ |
|
5
|
|
|
* | | / // // ___//_ _// || __||_ _| |
|
6
|
|
|
* | |/ // /(__ ) / / / /| || | | | |
|
7
|
|
|
* |___//_//____/ /_/ /_/ |_||_| |_| |
|
8
|
|
|
* @link http://vistart.name/ |
|
9
|
|
|
* @copyright Copyright (c) 2016 vistart |
|
10
|
|
|
* @license http://vistart.name/license/ |
|
11
|
|
|
*/ |
|
12
|
|
|
|
|
13
|
|
|
namespace vistart\Models\queries; |
|
14
|
|
|
|
|
15
|
|
|
use vistart\Models\models\BaseUserRelationModel; |
|
16
|
|
|
use vistart\Models\traits\MutualQueryTrait; |
|
17
|
|
|
|
|
18
|
|
|
/** |
|
19
|
|
|
* Description of BaseUserRelationQuery |
|
20
|
|
|
* |
|
21
|
|
|
* Note: You must specify $modelClass property, and the class must be the subclass |
|
22
|
|
|
* of `\vistart\Models\models\BaseUserRelationModel`. |
|
23
|
|
|
* @version 2.0 |
|
24
|
|
|
* @author vistart <[email protected]> |
|
25
|
|
|
*/ |
|
26
|
|
|
class BaseUserRelationQuery extends BaseBlameableQuery |
|
27
|
|
|
{ |
|
28
|
|
|
use MutualQueryTrait; |
|
29
|
|
|
|
|
30
|
|
|
/** |
|
31
|
|
|
* Specify groups. |
|
32
|
|
|
* This method will be skipped if not enable the group features (`$multiBlamesAttribute = false`). |
|
33
|
|
|
* @param string|array $groups the guid of group If string, or guid array of |
|
34
|
|
|
* groups if array. If you want to get ungrouped relation(s), please assign |
|
35
|
|
|
* empty array, or if you do not want to delimit group(s), please do not |
|
36
|
|
|
* access this method, or assign null. |
|
37
|
|
|
* @return static $this |
|
38
|
|
|
*/ |
|
39
|
1 |
|
public function groups($groups = []) |
|
40
|
|
|
{ |
|
41
|
1 |
|
if ($groups === null) { |
|
42
|
|
|
return $this; |
|
43
|
|
|
} |
|
44
|
1 |
|
$model = $this->noInitModel; |
|
45
|
1 |
|
if (!is_string($model->multiBlamesAttribute)) { |
|
46
|
|
|
return $this; |
|
47
|
|
|
} |
|
48
|
1 |
|
if (empty($groups)) { |
|
49
|
1 |
|
return $this->andWhere([$model->multiBlamesAttribute => BaseUserRelationModel::getEmptyGroupJson()]); |
|
|
|
|
|
|
50
|
|
|
} |
|
51
|
1 |
|
return $this->andWhere(['or like', $model->multiBlamesAttribute, $groups]); |
|
52
|
|
|
} |
|
53
|
|
|
} |
|
54
|
|
|
|
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.