for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace roaresearch\yii2\workflow\roa\models;
use roaresearch\yii2\roa\ResourceSearch;
use yii\{data\ActiveDataProvider, web\NotFoundHttpException};
/**
* Contract to filter and sort collections of `Transition` records.
*
* @author Angel (Faryshta) Guevara <[email protected]>
*/
class TransitionSearch extends Transition implements ResourceSearch
{
* @inhertidoc
public function rules()
return [
[['source_stage_id', 'created_by'], 'integer'],
[['name'], 'string'],
];
}
public function search(
array $params,
?string $formName = ''
): ?ActiveDataProvider {
$this->load($params, $formName);
if (!$this->validate()) {
return null;
if (
null === $this->sourceStage
|| $this->sourceStage->workflow_id != $params['workflow_id']
) {
throw new NotFoundHttpException('Unexistant stage path.');
$class = get_parent_class();
return new ActiveDataProvider([
'query' => $class::find()->andFilterWhere([
'source_stage_id' => $this->source_stage_id,
'created_by' => $this->created_by,
created_by
roaresearch\yii2\workflo...models\TransitionSearch
__get
])
->andFilterWhere(['like', 'name', $this->name]),
]);