protected function getPrimaryDomain($domain)
    {
        /** @var \Rcm\Entity\Domain $domain */
        $domain = $this->_em->getRepository(\Rcm\Entity\Domain::class)
            ->findOneBy(['domain' => $domain]);

        if (empty($domain)) {
            return null;
        }

        $primary = $domain->getPrimary();

        if (!$primary->getPrimary()) {
            return $primary;
        }

        return $this->getPrimaryDomain($primary->getDomainName());
    }
protected function getPrimaryDomain($domain)
    {
        /** @var \Rcm\Entity\Domain $domain */
        $domain = $this->_em->getRepository(\Rcm\Entity\Domain::class)
            ->findOneBy(['domain' => $domain]);

        if (empty($domain)) {
            return null;
        }

        $primary = $domain->getPrimary();

        if (!$primary->getPrimary()) {
            return $primary;
        }

        return $this->getPrimaryDomain($primary->getDomainName());
    }
protected function getPrimaryDomain ( $ domain ) { /** @var \Rcm\Entity\Domain $domain */ $ domain = $ this -> _em -> getRepository ( \ Rcm \ Entity \ Domain :: class ) -> findOneBy ( [ 'domain' => $ domain ] ) ; if ( empty ( $ domain ) ) { return null ; } $ primary = $ domain -> getPrimary ( ) ; if ( ! $ primary -> getPrimary ( ) ) { return $ primary ; } return $ this -> getPrimaryDomain ( $ primary -> getDomainName ( ) ) ; }
Get the Primary Domain for site lookup

@param $domain

@return null|\Rcm\Entity\Domain
Get the Primary Domain for site lookup