i need this for an news-website. Users can search into news. But before the application executes an search, we have to check, if there are enough serach-parameter available.
some pseudo-code as an example:
public function checkIfSearchIsUseful()
{$model = new myModel(); //myModel includes definitions for an search inside news-messages
if $model->PRIORITY has an value
or $model->HEADLINE has an value
or $model->SEARCHTERM hsa an value
->than return true //because you have minimum one information for what you can search
->else return false //the three main-attributes are empty - not enough information for an search.
}
Instead of the if construct maybe $model->validate is the better idea? (if it is possible)
On an custom validator per default th system checks the validation of only on attribute (wich is passed trough by an parameter). That means, if i use something like that: