public function addJob(Job\WrappedJob $job, $queue) {
        $qb = $this->conn->createQueryBuilder();
        $qb->insert($this->table_name);
        $qb->values([
            'status' => ':status',
            'job' => ':job',
            'name' => ':name',
            'queue' => ':queue',
            'created_at' => ':created_at',
            'available_at' => ':available_at',
        ]);
        $qb->setParameters([
            'status' => self::JOB_STATUS_CREATED,
            'queue' => $queue,
            'job' => (string) $job,
            'name' => $job->getName(),
        ]);
        $qb->setParameter(':created_at', new \DateTime(), Type::DATETIME);
        $available_at = $job->getDelay()
            ? new \DateTime(sprintf('+%d seconds', $job->getDelay()))
            : new \DateTime();
        $qb->setParameter(':available_at', $available_at, Type::DATETIME);
        $qb->execute();

        return $job->withAddedPayload([
            '_doctrine' => [
                'id' => $this->conn->lastInsertId()
            ]
        ]);
    }
public function addJob(Job\WrappedJob $job, $queue) {
        $qb = $this->conn->createQueryBuilder();
        $qb->insert($this->table_name);
        $qb->values([
            'status' => ':status',
            'job' => ':job',
            'name' => ':name',
            'queue' => ':queue',
            'created_at' => ':created_at',
            'available_at' => ':available_at',
        ]);
        $qb->setParameters([
            'status' => self::JOB_STATUS_CREATED,
            'queue' => $queue,
            'job' => (string) $job,
            'name' => $job->getName(),
        ]);
        $qb->setParameter(':created_at', new \DateTime(), Type::DATETIME);
        $available_at = $job->getDelay()
            ? new \DateTime(sprintf('+%d seconds', $job->getDelay()))
            : new \DateTime();
        $qb->setParameter(':available_at', $available_at, Type::DATETIME);
        $qb->execute();

        return $job->withAddedPayload([
            '_doctrine' => [
                'id' => $this->conn->lastInsertId()
            ]
        ]);
    }
public function addJob ( Job \ WrappedJob $ job , $ queue ) { $ qb = $ this -> conn -> createQueryBuilder ( ) ; $ qb -> insert ( $ this -> table_name ) ; $ qb -> values ( [ 'status' => ':status' , 'job' => ':job' , 'name' => ':name' , 'queue' => ':queue' , 'created_at' => ':created_at' , 'available_at' => ':available_at' , ] ) ; $ qb -> setParameters ( [ 'status' => self :: JOB_STATUS_CREATED , 'queue' => $ queue , 'job' => ( string ) $ job , 'name' => $ job -> getName ( ) , ] ) ; $ qb -> setParameter ( ':created_at' , new \ DateTime ( ) , Type :: DATETIME ) ; $ available_at = $ job -> getDelay ( ) ? new \ DateTime ( sprintf ( '+%d seconds' , $ job -> getDelay ( ) ) ) : new \ DateTime ( ) ; $ qb -> setParameter ( ':available_at' , $ available_at , Type :: DATETIME ) ; $ qb -> execute ( ) ; return $ job -> withAddedPayload ( [ '_doctrine' => [ 'id' => $ this -> conn -> lastInsertId ( ) ] ] ) ; }
add a new wrapped job
add a new wrapped job