Fix query builder for getting tasks by status
st.deletedAt line was ignored, because the "->where" on the next line replaced it. Resulting query was also wrongy built because of mixing of OR and AND conditions. [MAILPOET-5755]
This commit is contained in:
committed by
Ján Mikláš
parent
d4e42eead7
commit
9236c0ee6a
@@ -244,11 +244,12 @@ class ScheduledTasksRepository extends Repository {
|
|||||||
foreach ($statuses as $status) {
|
foreach ($statuses as $status) {
|
||||||
$tasksQuery = $this->doctrineRepository->createQueryBuilder('st')
|
$tasksQuery = $this->doctrineRepository->createQueryBuilder('st')
|
||||||
->select('st')
|
->select('st')
|
||||||
->where('st.deletedAt IS NULL')
|
->where('st.deletedAt IS NULL');
|
||||||
->where('st.status = :status');
|
|
||||||
|
|
||||||
if ($status === ScheduledTaskEntity::VIRTUAL_STATUS_RUNNING) {
|
if ($status === ScheduledTaskEntity::VIRTUAL_STATUS_RUNNING) {
|
||||||
$tasksQuery = $tasksQuery->orWhere('st.status IS NULL');
|
$tasksQuery = $tasksQuery->andWhere('st.status = :status OR st.status IS NULL');
|
||||||
|
} else {
|
||||||
|
$tasksQuery = $tasksQuery->andWhere('st.status = :status');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($type) {
|
if ($type) {
|
||||||
|
Reference in New Issue
Block a user