public function findActiveBySlug($slug, $host)
    {
        $query = $this->createValuedQueryBuilder('c')
            ->leftJoin('c.site', 'os')
            ->leftJoin('os.domains', 'd')
            ->where('c.slug = :slug')
            ->andWhere('c.active = :active')
            ->andWhere('c.layout = :layout')
            ->andWhere('c.publishAt < :now OR c.publishAt IS NULL')
            ->andWhere('d.domain = :host OR c.site IS NULL')
            ->setParameters([
                'slug' => $slug,
                'active' => true,
                'layout' => false,
                'now' => new \DateTime(),
                'host' => $host
            ])
            ->getQuery();

        return $query->getSingleResult();
    }
public function findActiveBySlug($slug, $host)
    {
        $query = $this->createValuedQueryBuilder('c')
            ->leftJoin('c.site', 'os')
            ->leftJoin('os.domains', 'd')
            ->where('c.slug = :slug')
            ->andWhere('c.active = :active')
            ->andWhere('c.layout = :layout')
            ->andWhere('c.publishAt < :now OR c.publishAt IS NULL')
            ->andWhere('d.domain = :host OR c.site IS NULL')
            ->setParameters([
                'slug' => $slug,
                'active' => true,
                'layout' => false,
                'now' => new \DateTime(),
                'host' => $host
            ])
            ->getQuery();

        return $query->getSingleResult();
    }
public function findActiveBySlug ( $ slug , $ host ) { $ query = $ this -> createValuedQueryBuilder ( 'c' ) -> leftJoin ( 'c.site' , 'os' ) -> leftJoin ( 'os.domains' , 'd' ) -> where ( 'c.slug = :slug' ) -> andWhere ( 'c.active = :active' ) -> andWhere ( 'c.layout = :layout' ) -> andWhere ( 'c.publishAt < :now OR c.publishAt IS NULL' ) -> andWhere ( 'd.domain = :host OR c.site IS NULL' ) -> setParameters ( [ 'slug' => $ slug , 'active' => true , 'layout' => false , 'now' => new \ DateTime ( ) , 'host' => $ host ] ) -> getQuery ( ) ; return $ query -> getSingleResult ( ) ; }
Find one by slug with active status.

@param string $slug

@return ContentInterface
Find one by slug with active status .