[TYPO3-mvc] Mix Extbase Database Queries with raw query parts
Jonas Eberle
jonas.eberle at d-mind.de
Mon Dec 1 19:13:23 CET 2014
Hi,
I want to filter and sort Extbase elements. So far so good.
But I have some computations (parts of the filter and ordering-parts)
that I would like to have done on the database.
Is there a way to use the Extbase DBAL in parts of the query while using
raw MySQL-computations in others?
Specifically the filter could look like:
$q->logicalAnd(
$fulltextsearchConstraints,
$categoryConstraints,
$geolocationConstraints
)->execute()
where the first 2 are Extbase-constraints while a $geolocationConstraint
is some complex calculation of the distance of a 'record' from a given
point that needs to be done by the database.
Then the ordering:
$q->setOrderings(
array(
$sortByDistance => QueryInterface::ORDER_ASCENDING
)
)
where $sortByDistance should again be a database computation.
I have not found any such possibility here
http://docs.typo3.org/typo3cms/ExtbaseFluidBook/6-Persistence/3-implement-individual-database-queries.html
but there might be nonetheless.
If there is none, I would just switch completely to
repository->createQuery->statement('SELECT a FROM b'). I'd like to ask
first to see if there are better ways to handle that.
Regards,
Jonas
--
Neu: Portal Region Stuttgart - www.region-stuttgart.de
Neu: emobil-in-bw.de
Neukunde: Statistisches Landesamt BaWü
--------------------------------
d-mind bei Facebook: http://www.facebook.com/werbeagentur.internetagentur.stuttgart
--------------------------------
d-mind
Fuchs/Weiß/Strobel GbR
Mörikestraße 69
70199 Stuttgart
Tel.: +49 711 280481-1 (Durchwahl: -18)
Fax: +49 711 2804813
Inhaber: Jens Fuchs, Michael Weiß, Jens Strobel
www.d-mind.de
More information about the TYPO3-project-typo3v4mvc
mailing list