public function isValidSiteId($siteId, $checkActive = false)
    {
        if (empty($siteId) || !is_numeric($siteId)) {
            return false;
        }

        if ($checkActive && in_array($siteId, $this->activeSiteIdCache)) {
            return true;
        }

        $queryBuilder = $this->_em->createQueryBuilder();
        $queryBuilder->select('site.siteId')
            ->from(\Rcm\Entity\Site::class, 'site')
            ->where('site.siteId = :siteId')
            ->setParameter('siteId', $siteId);

        if ($checkActive) {
            $queryBuilder->andWhere('site.status = :status');
            $queryBuilder->setParameter('status', \Rcm\Entity\Site::STATUS_ACTIVE);
        }

        $result = $queryBuilder->getQuery()->getScalarResult();

        if (!empty($result)) {
            if ($checkActive) {
                $this->activeSiteIdCache[] = $siteId;
            }

            return true;
        }

        return false;
    }
public function isValidSiteId($siteId, $checkActive = false)
    {
        if (empty($siteId) || !is_numeric($siteId)) {
            return false;
        }

        if ($checkActive && in_array($siteId, $this->activeSiteIdCache)) {
            return true;
        }

        $queryBuilder = $this->_em->createQueryBuilder();
        $queryBuilder->select('site.siteId')
            ->from(\Rcm\Entity\Site::class, 'site')
            ->where('site.siteId = :siteId')
            ->setParameter('siteId', $siteId);

        if ($checkActive) {
            $queryBuilder->andWhere('site.status = :status');
            $queryBuilder->setParameter('status', \Rcm\Entity\Site::STATUS_ACTIVE);
        }

        $result = $queryBuilder->getQuery()->getScalarResult();

        if (!empty($result)) {
            if ($checkActive) {
                $this->activeSiteIdCache[] = $siteId;
            }

            return true;
        }

        return false;
    }
public function isValidSiteId ( $ siteId , $ checkActive = false ) { if ( empty ( $ siteId ) || ! is_numeric ( $ siteId ) ) { return false ; } if ( $ checkActive && in_array ( $ siteId , $ this -> activeSiteIdCache ) ) { return true ; } $ queryBuilder = $ this -> _em -> createQueryBuilder ( ) ; $ queryBuilder -> select ( 'site.siteId' ) -> from ( \ Rcm \ Entity \ Site :: class , 'site' ) -> where ( 'site.siteId = :siteId' ) -> setParameter ( 'siteId' , $ siteId ) ; if ( $ checkActive ) { $ queryBuilder -> andWhere ( 'site.status = :status' ) ; $ queryBuilder -> setParameter ( 'status' , \ Rcm \ Entity \ Site :: STATUS_ACTIVE ) ; } $ result = $ queryBuilder -> getQuery ( ) -> getScalarResult ( ) ; if ( ! empty ( $ result ) ) { if ( $ checkActive ) { $ this -> activeSiteIdCache [ ] = $ siteId ; } return true ; } return false ; }
Is Valid Site Id

@param integer $siteId      Site Id To Check
@param boolean $checkActive Should only check active sites.  Default: true

@return boolean
Is Valid Site Id