[TYPO3-mvc] updateAction not saving field extending another Model
Michael Staatz
info at mduttlinger.de
Fri Feb 19 09:13:53 CET 2010
Am 18.02.2010 14:25, schrieb Søren Malling:
> Hi,
>
> I've created a Model extending the FrontendUserRepository
>
> class Tx_Groupmembers_Domain_Model_Member extends
> Tx_Extbase_Domain_Model_FrontendUser {
> .....
> }
>
> and added the field in ext_tables.php and ext_tables.sql
> (tx_groupmembers_domain_model_number) and it's shown perfectly in the
> backend.
>
> In my frontend, I can't get the content of the field nor save to the field.
>
> In my model the field is described as
>
> /**
> * Member number
> * @var string
> * @validate NotEmpty
> */
> protected $number;
>
> and my updateAction is as follows
>
> public function updateAction(Tx_Groupmembers_Domain_Model_Member $member) {
> $this->memberRepository->update($member);
> $this->flashMessages->add('Your member details have been saved');
> $this->redirect('index');
> }
>
> and I got setters and getters for the field. But nothing is updated in
> the database.
>
> When i print_r from the form i get the following value for the field
> [number] => 23 but wouldn't that be tx_groupmembers_domain_model?
>
> So in short, what is the correct way to name a field extending a
> table, in my model?
>
> Regards,
>
> Søren
Hi,
i had a similar problem.
i could fix it with these lines:
$persistanceManager = Tx_Extbase_Dispatcher::getPersistenceManager();
$persistanceManager->persistAll();
Best,
Michael
More information about the TYPO3-project-typo3v4mvc
mailing list