I have a form filter with few custom search fields.
In the addXXXQuery functions, I have to use join on a table which is the same for some fields.
Can I check if innerJoin for that particular table is already set in another addXXXQuery?
[EDIT] example:
public function addIsPaidColumnQuery(Doctrine_Query $query, $field, $values)
{
if ($values) {
$rootAlias = $query->getRootAlias();
$query->leftJoin($rootAlias.".Inscription i");
->andWhere("i.is_paid = ?", $values);
}
}
public function addActTypeColumnQuery(Doctrine_Query $query, $field, $values)
{
if ($values) {
$rootAlias = $query->getRootAlias();
$query->leftJoin($rootAlias.".Inscription i")
->leftJoin("i.Act a")
$query->addWhere("a.act_type_id = ?", $values);
}
}
Well, you can retrieve the
$paramsfrom the query, and check if the join is already there, something like this:You can see in the code, how a leftJoin in added.