1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace roaresearch\yii2\formgenerator\roa\models; |
4
|
|
|
|
5
|
|
|
use roaresearch\yii2\formgenerator\models as base; |
6
|
|
|
use roaresearch\yii2\roa\hal\Contract; |
7
|
|
|
use roaresearch\yii2\roa\hal\ContractTrait; |
8
|
|
|
use yii\helpers\Url; |
9
|
|
|
use yii\web\Link; |
10
|
|
|
|
11
|
|
|
/** |
12
|
|
|
* ROA contract handling FieldRule records. |
13
|
|
|
*/ |
14
|
|
|
class FieldRule extends base\FieldRule implements Contract |
15
|
|
|
{ |
16
|
|
|
use ContractTrait { |
17
|
|
|
getLinks as getContractLinks; |
18
|
|
|
} |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* @inheritdoc |
22
|
|
|
*/ |
23
|
|
|
protected $fieldClass = Field::class; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* @inheritdoc |
27
|
|
|
*/ |
28
|
|
|
|
29
|
|
|
protected $propertyClass = FieldRuleProperty::class; |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* @inheritdoc |
33
|
|
|
*/ |
34
|
9 |
|
protected function slugBehaviorConfig(): array |
35
|
|
|
{ |
36
|
|
|
return [ |
37
|
9 |
|
'resourceName' => 'rule', |
38
|
9 |
|
'parentSlugRelation' => 'field', |
39
|
9 |
|
'checkAccess' => function ($params) { |
40
|
8 |
|
if ( |
41
|
8 |
|
isset($params['rule_id']) |
42
|
|
|
&& $params['rule_id'] != $this->id |
43
|
|
|
) { |
44
|
|
|
throw new NotFoundHttpException( |
|
|
|
|
45
|
|
|
'Field Rule doesnt contain the requested route.' |
46
|
|
|
); |
47
|
9 |
|
} |
48
|
|
|
} |
49
|
|
|
]; |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* @inheritdoc |
54
|
4 |
|
*/ |
55
|
|
|
public function getLinks() |
56
|
4 |
|
{ |
57
|
|
|
$selfLink = $this->getSelfLink(); |
58
|
4 |
|
|
59
|
4 |
|
return array_merge($this->getContractLinks(), [ |
60
|
|
|
'properties' => $selfLink . '/property', |
61
|
4 |
|
'curies' => [ |
62
|
4 |
|
new Link([ |
63
|
4 |
|
'name' => 'embeddable', |
64
|
4 |
|
'href' => Url::to($selfLink, ['expand' => '{rel}']), |
|
|
|
|
65
|
|
|
'title' => 'Embeddable and not Nestable related resources.', |
66
|
4 |
|
]), |
67
|
4 |
|
new Link([ |
68
|
4 |
|
'name' => 'nestable', |
69
|
4 |
|
'href' => Url::to($selfLink, ['expand' => '{rel}']), |
70
|
|
|
'title' => 'Embeddable and Nestable related resources.', |
71
|
|
|
]), |
72
|
4 |
|
], |
73
|
4 |
|
'embeddable:properties' => 'properties', |
74
|
|
|
'nestable:field' => 'field', |
75
|
|
|
]); |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
/** |
79
|
|
|
* @inheritdoc |
80
|
4 |
|
*/ |
81
|
|
|
public function extraFields() |
82
|
4 |
|
{ |
83
|
|
|
return ['field', 'properties']; |
84
|
|
|
} |
85
|
|
|
} |
86
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths