Details
Description
The problem is in Doctrine_Table::buildFindByWhere, line 2715. I put the code here for clarity:
public function buildFindByWhere($fieldName)
{
$ands = array();
$e = explode('And', $fieldName);
foreach ($e as $k => $v) {
$and = '';
$e2 = explode('Or', $v);<- LINE 2715
$ors = array();
foreach ($e2 as $k2 => $v2) {
if ($v2 = $this->_resolveFindByFieldName($v2))
else
{ throw new Doctrine_Table_Exception('Invalid field name to find by: ' . $v2); } }
$and .= implode(' OR ', $ors);
$and = count($ors) > 1 ? '(' . $and . ')':$and;
$ands[] = $and;
}
$where = implode(' AND ', $ands);
return $where;
}
In my proyect I have a table called OrigenesOportunidadCliente, which id field name is idOrigenOportunidadCliente. As you have probably noticed, the name contains Or: idOrigenOportunidadCliente. And there is where it fails, it gets as if there where an OR statement, not finding a valid field name in the below foreach as the field is "OrigenOportunidad".
fixed http://github.com/estahn/doctrine1/compare/master...DC-794