[TYPO3-dev] Custom query: select alias with constraints
Jigal van Hemert
jigal.van.hemert at typo3.org
Fri Jan 19 11:55:47 CET 2018
Hi Darryl,
Welcome to TYPO3 :-)
It's become rather quiet in these mailing lists/forum/newsgroups as most
questions are nowadays asked on Stackoverflow (use the tag "typo3"). For
quick instant messaging we use Slack (you can easily get an account at
https://forger.typo3.com/slack )
On 17/01/2018 23:05, Darryl Meganoski wrote:
> Hello all, I am a mildly experienced developer, just recently learning
> typo3.
> I am tasked with converting an older typo3 extension to the new extbase
> framework.
If you want to learn how to work with extbase and fluid there is an
excellent book http://extbase-book.org/ (printed versions are also
available at for example amazon).
> I am currently working with version 7.6.
>
> I need to be able to alias a field as some mathematical calculations are
> needed.
>
> I can do this with a raw sql statement, but I would also like to
> leverage the built-in escaping features of the query.
>
> It seems that when I use a raw sql statement with ->statement(), any
> constraints are ignored.
>
> What would be the suggested way to go about this?
I'm not sure what you try to achieve but specific questions like these
usually indicate that the approach is not like it should be done with
Domain Driven Design and extbase.
It could be that the "big" problem you try to solve is quite hard to fix
with extbase. It might be an option to keep the extension as it was,
based on piBase (the class was simply renamed now that everything has
namespaces) and only use Fluid to render the output.
Rewriting an extension in extbase takes more than creating some extbase
structures and copying existing code into new Action functions. It's
best to start all over and first write down the domain model on paper.
Database structures follow kind of automatically ones the various models
are created. In the end the database structures might be very different
from how they were in the original piBase extension.
--
Jigal van Hemert
TYPO3 CMS Core Team Member
TYPO3 .... inspiring people to share!
Get involved: typo3.org
More information about the TYPO3-dev
mailing list