Newscoop\Service\Implementation\OutputSettingIssueServiceDoctrine::isThemeUsed PHP Method

isThemeUsed() public method

public isThemeUsed ( $theme, &$themes = NULL )
    public function isThemeUsed($theme, &$themes = NULL)
    {
        Validation::notEmpty($theme, 'theme');
        if ($theme instanceof Theme) {
            $themePath = $theme->getPath();
        } else {
            $themePath = $theme;
        }
        if ($themes === NULL) {
            $themes = array();
        }
        $em = $this->getManager();
        // we need to find if the theme is used by anyoane.
        $q = $em->createQueryBuilder();
        $q->select('i.name')->from(OutputSettingsIssue::NAME_1, 'osi')->join('osi.issue', 'i')->join('osi.themePath', 'th')->where('th.path = :themePath');
        $q->setParameter('themePath', $themePath);
        foreach ($q->getQuery()->getResult() as $row) {
            $themes[] = $row['name'];
        }
        return sizeof($themes) > 0;
    }