I have a situation where I want to assemble a Doctrine select query based on weather certain params are empty or not For example, if there was a $slug variable that was optional, i'd want something like this:
function get_bio($slug = '')
{
$q = Doctrine_Query::create()
->from('Bio b');
if (!empty($slug))
{
$q .= $q->where('b.slug = ?', $slug);
}
}
I know thats not the correct syntax, but how would I assemble something like that?