Repository/SmileCronRepository.php
public function addQueued($alias)
    {
        $query = $this->createQueryBuilder('c')
            ->where('c.alias = :alias')
            ->setParameter('alias', $alias)
            ->getQuery();

        /** @var SmileCron $smileCron */
        $smileCron = $query->setMaxResults(1)->getOneOrNullResult();

        if (!$smileCron) {
            $smileCron = new SmileCron();
            $smileCron->setAlias($alias);
        }

        $now = new \DateTime('now');
        $smileCron->setQueued($now);
        $smileCron->setStarted(null);
        $smileCron->setEnded(null);
        $smileCron->setStatus(0);

        $this->getEntityManager()->persist($smileCron);
        $this->getEntityManager()->flush();
    }
public function addQueued($alias)
    {
        $query = $this->createQueryBuilder('c')
            ->where('c.alias = :alias')
            ->setParameter('alias', $alias)
            ->getQuery();

        /** @var SmileCron $smileCron */
        $smileCron = $query->setMaxResults(1)->getOneOrNullResult();

        if (!$smileCron) {
            $smileCron = new SmileCron();
            $smileCron->setAlias($alias);
        }

        $now = new \DateTime('now');
        $smileCron->setQueued($now);
        $smileCron->setStarted(null);
        $smileCron->setEnded(null);
        $smileCron->setStatus(0);

        $this->getEntityManager()->persist($smileCron);
        $this->getEntityManager()->flush();
    }
public function addQueued ( $ alias ) { $ query = $ this -> createQueryBuilder ( 'c' ) -> where ( 'c.alias = :alias' ) -> setParameter ( 'alias' , $ alias ) -> getQuery ( ) ; /** @var SmileCron $smileCron */ $ smileCron = $ query -> setMaxResults ( 1 ) -> getOneOrNullResult ( ) ; if ( ! $ smileCron ) { $ smileCron = new SmileCron ( ) ; $ smileCron -> setAlias ( $ alias ) ; } $ now = new \ DateTime ( 'now' ) ; $ smileCron -> setQueued ( $ now ) ; $ smileCron -> setStarted ( null ) ; $ smileCron -> setEnded ( null ) ; $ smileCron -> setStatus ( 0 ) ; $ this -> getEntityManager ( ) -> persist ( $ smileCron ) ; $ this -> getEntityManager ( ) -> flush ( ) ; }
Add cron to queued

@param string $alias cron alias
Add cron to queued