public function findDue()
    {
        /** @var Cron[] $active */
        $active = $this->createQueryBuilder('c')
            ->where('c.state <> :canceled')
            ->andWhere('c.state <> :running OR (c.state = :running AND c.startedAt < :hourAgo)')
            ->orderBy('c.priority', 'DESC')
            ->setParameters([
                'canceled' => Cron::STATE_CANCELED,
                'running' => Cron::STATE_RUNNING,
                'hourAgo' => new \DateTime('-67 minutes'),
            ])
            ->getQuery()
            ->getResult()
        ;

        $due = [];
        foreach ($active as $cron) {
            if ($cron->isDue()) {
                $due[] = $cron;
            }
        }

        return new ArrayCollection($due);
    }
public function findDue()
    {
        /** @var Cron[] $active */
        $active = $this->createQueryBuilder('c')
            ->where('c.state <> :canceled')
            ->andWhere('c.state <> :running OR (c.state = :running AND c.startedAt < :hourAgo)')
            ->orderBy('c.priority', 'DESC')
            ->setParameters([
                'canceled' => Cron::STATE_CANCELED,
                'running' => Cron::STATE_RUNNING,
                'hourAgo' => new \DateTime('-67 minutes'),
            ])
            ->getQuery()
            ->getResult()
        ;

        $due = [];
        foreach ($active as $cron) {
            if ($cron->isDue()) {
                $due[] = $cron;
            }
        }

        return new ArrayCollection($due);
    }
public function findDue ( ) { /** @var Cron[] $active */ $ active = $ this -> createQueryBuilder ( 'c' ) -> where ( 'c.state <> :canceled' ) -> andWhere ( 'c.state <> :running OR (c.state = :running AND c.startedAt < :hourAgo)' ) -> orderBy ( 'c.priority' , 'DESC' ) -> setParameters ( [ 'canceled' => Cron :: STATE_CANCELED , 'running' => Cron :: STATE_RUNNING , 'hourAgo' => new \ DateTime ( '-67 minutes' ) , ] ) -> getQuery ( ) -> getResult ( ) ; $ due = [ ] ; foreach ( $ active as $ cron ) { if ( $ cron -> isDue ( ) ) { $ due [ ] = $ cron ; } } return new ArrayCollection ( $ due ) ; }
Find all cronjobs which are due.

@return \Doctrine\Common\Collections\ArrayCollection
Find all cronjobs which are due .