[TYPO3-mvc] FED SQL Query with sys_language_uid

Helmut Hummel helmut.hummel at typo3.org
Fri Feb 3 14:38:06 CET 2012


Hi,

sorry, but reading this I have to rant. Please don't take it personal, 
but just rethink the approach.

Claus Due wrote:

 >> I use FED for selecting the record as below:
 >>
 >> <fed:data.sql as="categories" table="tx_news_domain_model_category"
 >> fields="uid,title" condition="deleted=0 AND hidden=0"
 >> orderBy="title" order="ASC" />

> First of all you need the currently active language's UID assigned as a template variable somehow (approach depends on your implementation method).
>
> Then, in your query's condition add this:
>
> … " AND (sys_language_uid IN (-1,0) OR (sys_language_uid = '{theVariableWithLanguageUid}' AND l18n_parent = '0'))"

Oh boy. Why do you even think of doing such things?
It reduces the MVC pattern to absurdity.

And when I see the variable passed to this view helper I instantly 
complete the controller code in my brain:

public function showAction() {
[...]
	$this->view->assign('theVariableWithLanguageUid', $_GET['L']);
}

You don't want to do that. Period.

Kind regards,
Helmut

-- 
Helmut Hummel
TYPO3 Security Team Leader, TYPO3 v4 Core Team Member

TYPO3 .... inspiring people to share!
Get involved: typo3.org


More information about the TYPO3-project-typo3v4mvc mailing list