public static function findPublishedByIds(array $ids, $pid = null)
    {
        if (0 === \count($ids)) {
            return null;
        }

        $t = static::getTableAlias();
        $columns = ["$t.id IN (".\implode(',', \array_map('intval', $ids)).')'];
        $values = [];

        // Filter by pid
        if (null !== $pid) {
            $columns[] = "$t.pid=?";
            $values[] = $pid;
        }

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

        return static::findBy($columns, $values, ['order' => "$t.sorting"]);
    }
public static function findPublishedByIds(array $ids, $pid = null)
    {
        if (0 === \count($ids)) {
            return null;
        }

        $t = static::getTableAlias();
        $columns = ["$t.id IN (".\implode(',', \array_map('intval', $ids)).')'];
        $values = [];

        // Filter by pid
        if (null !== $pid) {
            $columns[] = "$t.pid=?";
            $values[] = $pid;
        }

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

        return static::findBy($columns, $values, ['order' => "$t.sorting"]);
    }
public static function findPublishedByIds ( array $ ids , $ pid = null ) { if ( 0 === \ count ( $ ids ) ) { return null ; } $ t = static :: getTableAlias ( ) ; $ columns = [ "$t.id IN (" . \ implode ( ',' , \ array_map ( 'intval' , $ ids ) ) . ')' ] ; $ values = [ ] ; // Filter by pid if ( null !== $ pid ) { $ columns [ ] = "$t.pid=?" ; $ values [ ] = $ pid ; } if ( ! BE_USER_LOGGED_IN ) { $ columns [ ] = "$t.published=?" ; $ values [ ] = 1 ; } return static :: findBy ( $ columns , $ values , [ 'order' => "$t.sorting" ] ) ; }
Find published news categories by parent ID and IDs.

@param array    $ids
@param int|null $pid

@return Collection|null
Find published news categories by parent ID and IDs .