Reputation: 10010
I am using this code:
$queryBuilder
->add('select', 'd.type')
->add('from', 'Entities:TypeDetail d')
->add('where', 'IDENTITY(d.typeName) = ' . $typeName->getId())
->add('andWhere', 'd.dateValue > ' . $dates['start'])
->add('andWhere', 'd.dateValue < ' . $dates['end']);
But I get this error: Notice: Undefined index: andWhere in...
I figure "andWhere" is not the correct name to use, but everywhere I read online suggests it is. But that is using the form ->andWhere()
, not using ->add()
like I am.
What am I doing wrong? Thanks
Upvotes: 1
Views: 610
Reputation: 6430
Have you tried this? -
$queryBuilder
->add('select', 'd.type')
->add('from', 'Entities:TypeDetail d')
->add('where', $queryBuilder->expr()->andx(
$queryBuilder->expr()->eq('IDENTITY(d.typeName)', $typeName->getId()),
$queryBuilder->expr()->gt('d.dateValue', $dates['start']),
$queryBuilder->expr()->lt('d.dateValue', $dates['end'])
));
Links here -
Upvotes: 1