Library-Distribution / ALD-API

the API (backend) for the ALD system
http://about.libba.net/docs/api/current
0 stars 0 forks source link

Rework filter implementation #31

Closed maul-esel closed 11 years ago

maul-esel commented 11 years ago

Replace the old clumsy and unreadable way of appending to a $db_cond variable by a cleaner way to define possible filters and evaluate them based on the actually present filters.

This PR adds a FilterHelper class whose add() method lets the caller define possible filters in various, but still readable ways. In the end, the array of actually present filters is given to evaluate(), which compares it to the stored filters and returns a ready-to-use MySQL WHERE condition.