Can you really craft a wildcard WHERE query with Doctrine, like so:

->where('this_field = ?', ANYTHING);

I'd be utilising this to construct searching query dynamically from unknown user-selected parameters and for that reason will have to possess the symptom in place but able to accepting the worthiness "anything".

To include, I'm able to get this work:

$field = 'this_field = ?';
$value = 5;
...
->where($field, $value);

... but it is still does not let me use "anything" as value in order to get rid of the entire query condition. The next fails:

$field = NULL;
$value = NULL;
...
->where($field, $value);

Thanks

Should you build the query dynamically you may also check wther $value includes a value or otherwise after which add the where part if required. E.g.

$q; // Your query object.

if(isset($value)) {   // or empty() or maybe just if($value) depending on your needs.
    $q->where('this_field = ?', $value);
}

This really is simpler to know and simpler to debug imo.

[Response to own question]

After experimenting with this particular, found an answer that actually works, posting for others.

Using ->whereIn enables Doctrine to disregard a question condition completely:

$empty = array();
...
->andWhereIn('this_field', $empty)

The above mentioned condition does not get incorporated within the resulting SQL whatsoever.