->where('a.guid = n.id');
if ($hasDf && !$hasDt) {
- $dateExists->andWhere(['a.date_from' => $df]);
+ $dateExists//->andWhere(['a.date_from' => $df])
+ ->andWhere(['>=', 'a.date_to', $df]);;
} elseif (!$hasDf && $hasDt) {
- $dateExists->andWhere(['a.date_to' => $dt]);
+ $dateExists//->andWhere(['a.date_to' => $dt])
+ ->andWhere(['<=', 'a.date_from', $dt]);
} else {
$dateExists
- ->andWhere(['>=', 'a.date_from', $df])
- ->andWhere(['<=', 'a.date_to', $dt]);
+ ->andWhere(['>=', 'a.date_to', $df])
+ ->andWhere(['<=', 'a.date_from', $dt]);
}
if (!empty($filter->onlyInactive)) {
$query->with(['actualities' => function ($q) use ($hasDf, $hasDt, $df, $dt) {
if ($hasDf && !$hasDt) {
- $q->andWhere(['date_from' => $df]);
+ $q//->andWhere(['date_from' => $df])
+ ->andWhere(['>=', 'date_to', $df]);
} elseif (!$hasDf && $hasDt) {
- $q->andWhere(['date_to' => $dt]);
+ $q//->andWhere(['date_to' => $dt])
+ ->andWhere(['<=', 'date_from', $dt]);
} else {
- $q->andWhere(['>=', 'date_from', $df])
- ->andWhere(['<=', 'date_to', $dt]);
+ $q->andWhere(['>=', 'date_to', $df])
+ ->andWhere(['<=', 'date_from', $dt]);
}
$q->orderBy(['date_from' => SORT_ASC]);
}]);