public function getNext()
{
$tableName = $this->tableName();
$query = $this->find()->andWhere(['and', ["{$tableName}.[[pid]]" => $this->pid], ['>', "{$tableName}.[[priority]]", $this->priority]])->orderBy(["{$tableName}.[[priority]]" => SORT_ASC])->limit(1);
$query->multiple = false;
return $query;
}