public static function findPublishedByIdOrAlias($idOrAlias)
    {
        $values = [];
        $columns = [];
        $t = static::getTableAlias();

        // Determine the alias condition
        if (is_numeric($idOrAlias)) {
            $columns[] = "$t.id=?";
            $values[] = (int) $idOrAlias;
        } else {
            if (MultilingualHelper::isActive()) {
                $columns[] = '(t1.alias=? OR t2.alias=?)';
                $values[] = $idOrAlias;
                $values[] = $idOrAlias;
            } else {
                $columns[] = "$t.alias=?";
                $values[] = $idOrAlias;
            }
        }

        if (!BE_USER_LOGGED_IN) {
            $columns[] = "$t.published=?";
            $values[] = 1;
        }

        return static::findOneBy($columns, $values);
    }
public static function findPublishedByIdOrAlias($idOrAlias)
    {
        $values = [];
        $columns = [];
        $t = static::getTableAlias();

        // Determine the alias condition
        if (is_numeric($idOrAlias)) {
            $columns[] = "$t.id=?";
            $values[] = (int) $idOrAlias;
        } else {
            if (MultilingualHelper::isActive()) {
                $columns[] = '(t1.alias=? OR t2.alias=?)';
                $values[] = $idOrAlias;
                $values[] = $idOrAlias;
            } else {
                $columns[] = "$t.alias=?";
                $values[] = $idOrAlias;
            }
        }

        if (!BE_USER_LOGGED_IN) {
            $columns[] = "$t.published=?";
            $values[] = 1;
        }

        return static::findOneBy($columns, $values);
    }
public static function findPublishedByIdOrAlias ( $ idOrAlias ) { $ values = [ ] ; $ columns = [ ] ; $ t = static :: getTableAlias ( ) ; // Determine the alias condition if ( is_numeric ( $ idOrAlias ) ) { $ columns [ ] = "$t.id=?" ; $ values [ ] = ( int ) $ idOrAlias ; } else { if ( MultilingualHelper :: isActive ( ) ) { $ columns [ ] = '(t1.alias=? OR t2.alias=?)' ; $ values [ ] = $ idOrAlias ; $ values [ ] = $ idOrAlias ; } else { $ columns [ ] = "$t.alias=?" ; $ values [ ] = $ idOrAlias ; } } if ( ! BE_USER_LOGGED_IN ) { $ columns [ ] = "$t.published=?" ; $ values [ ] = 1 ; } return static :: findOneBy ( $ columns , $ values ) ; }
Find published category by ID or alias.

@param string $idOrAlias

@return NewsCategoryModel|null
Find published category by ID or alias .