[TYPO3-mvc] Dynamic queries in repository
Michael Ruhdorfer
michael.ruhdorfer.1line at gmail.com
Thu Sep 9 11:07:07 CEST 2010
Hi all,
[SITUATION]
I want to perform a dynamical query depending on the user input of the
search form. atm my query looks like:
$query = $this->createQuery();
$query->matching(
$query->logicalAnd(
$query->logicalAnd(
$query->logicalAnd(
$query->logicalAnd(
$query->equals($this->getWhere($branch,
'branch'), $this->getWhere($branch)),
$query->equals($this->getWhere($country,
'country'), $this->getWhere($country))
),
$query->equals($this->getWhere($region, 'region'),
$this->getWhere($region))
),
$query->lessThanOrEqual('employeeCount',
$employeeCountMax)
),
$query->greaterThanOrEqual('employeeCount',
$employeeCountMin)
)
);
looks a bit weird but I'm afraid that's the way it should look like afaik :P
so I want to filter my companies :) btw: my getWhere looks like:
protected function getWhere($value, $field = NULL)
{
if(!$value)
return !$field ? '0' : 'hidden';
else
return !$field ? $value : $field;
}
[PROBLEM]
but now I got the problem that I want to implememnt a full text search where
branch, country and region should be searched.
the user is able to put in as many search criteria he/she likes, so I can't
do it the way I did - it has to be dynamically...
and i don't want to use SELECT * FROM .... even though that would have saved
lots of time by now :/
has anyone an idea?
thx in advance,
Michael
More information about the TYPO3-project-typo3v4mvc
mailing list