public static function getItems($filter = []): array
    {
        $res = [];

        /* @var $class LightModel */
        $className = get_called_class();
        $class = new $className;

        $sql = 'SELECT * FROM ' . $class->getTableName() . ' WHERE 1=1';
        $params = self::handleFilter($sql, $filter, $class);

        $query = DB::getConnection()->prepare($sql);
        $query->execute($params);

        foreach ($query->fetchAll(PDO::FETCH_CLASS, $className) as $item)
        {
            $res[] = self::typeCastModel($item);
        }

        return $res;
    }
public static function getItems($filter = []): array
    {
        $res = [];

        /* @var $class LightModel */
        $className = get_called_class();
        $class = new $className;

        $sql = 'SELECT * FROM ' . $class->getTableName() . ' WHERE 1=1';
        $params = self::handleFilter($sql, $filter, $class);

        $query = DB::getConnection()->prepare($sql);
        $query->execute($params);

        foreach ($query->fetchAll(PDO::FETCH_CLASS, $className) as $item)
        {
            $res[] = self::typeCastModel($item);
        }

        return $res;
    }
public static function getItems ( $ filter = [ ] ) : array { $ res = [ ] ; /* @var $class LightModel */ $ className = get_called_class ( ) ; $ class = new $ className ; $ sql = 'SELECT * FROM ' . $ class -> getTableName ( ) . ' WHERE 1=1' ; $ params = self :: handleFilter ( $ sql , $ filter , $ class ) ; $ query = DB :: getConnection ( ) -> prepare ( $ sql ) ; $ query -> execute ( $ params ) ; foreach ( $ query -> fetchAll ( PDO :: FETCH_CLASS , $ className ) as $ item ) { $ res [ ] = self :: typeCastModel ( $ item ) ; } return $ res ; }
Get all items based on filter

@param array $filter
@return array
Get all items based on filter