CyberfusionIO / cyberfusion-cluster-api-client

Cyberfusion Core API client
https://core-api.cyberfusion.io
MIT License
5 stars 3 forks source link

Improve ListFilter #22

Closed dvdheiden closed 1 year ago

dvdheiden commented 1 year ago

Closes #17

Changes

Improve the usability of filtering the data:

$listFilter = Cluster::listFilter()
    ->filter(new FilterEntry('name', 'test'))
    ->filter(new FilterEntry('groups', 'test2'))
    ->sort(new SortEntry('name', Sort::DESC));

But the original way still works:

$listFilter = ListFilter::forModel(new Cluster())
    ->addFilter('name', 'test')
    ->addFilter('groups', 'test2')
    ->addSort('name', Sort::DESC);

Or combine those:

$listFilter = Cluster::listFilter()
    ->addFilter('name', 'test')
    ->addFilter('groups', 'test2')
    ->addSort('name', Sort::DESC);

Changed

Checks