[TYPO3-mvc] Domain model object localization in FE
Chatelain Jean-Christophe
Chatelain.Jean-Christophe at agridea.ch
Thu Feb 24 15:28:04 CET 2011
Hi,
I want to create a plugin that let users localize domain model object in
frontend.
I created an action < localize > in my model controller where I pass the
record to be localized and the language in wich it should be localized.
...
/**
* Create a localized culture.
*
* @param Tx_Pagextmvc_Domain_Model_Culture
$originalCulture the Culture to display
* @param string $sys_language_uid the language to
localize to (shortname - RFC 1766)
* @param Tx_Pagextmvc_Domain_Model_Culture
$localizedCulture a freshly localized Culture object which has not yet
been added to the repository
* @return string A form to localize a Culture
* @dontvalidate $localizedCulture
*/
public function
localizeAction(Tx_Pagextmvc_Domain_Model_Culture $originalCulture,
$sys_language_uid,
Tx_Pagextmvc_Domain_Model_Culture $localizedCulture = null ) {
$this->view->assign('language',$sys_language_uid);
$this->view->assign('originalCulture',
$originalCulture);
$this->view->assign('localizedCulture',
$localizedCulture);
}
Then I created my Localize view where I set a form to create a new
object and I added the properties for _languageUid and _localizedUid.
...
<f:form method="post" action="create" name="newCulture"
object="{localizedCulture}" >
<f:render partial="Culture/formFields"
arguments="{domainObject:domainObject}" />
<f:form.hidden property="_languageUid"
value="{language}" />
<f:form.hidden property="_localizedUid"
value="{originalCulture.uid}" />
<f:form.submit value="{f:translate( key:'save')}" />
</f:form>
This doesn't work at all, give me this error : The value must be of type
"Tx_Pagextmvc_Domain_Model_Culture", but was of type "NULL".
I would be glad if someone can point me to the right way to do this. I'm
learning extbase (and also DDD and MVC) and it's a little bit confusing.
Thanks in advance.
More information about the TYPO3-project-typo3v4mvc
mailing list