[TYPO3-mvc] updateAction not saving field extending another Model
Søren Malling
soren.malling at gmail.com
Fri Feb 19 11:23:57 CET 2010
I ended up solving the problem in another way, and I would like to
know whether to file a bug report on this - here goes:
class Tx_Groupmembers_Domain_Model_Member extends
Tx_Extbase_Domain_Model_FrontendUser
In my model I created a property called "number". This property was
ment to be used in the fe_users table as a member number. I then
manually write the field in ext_tables.php and ext_tables.sql so that
fe_users get extended.
I create the field in fe_users table with the name
tx_groupmembers_domain_model_member_number (all lowercase) due to the
naming convention ( question #1: is this the correct naming convention
used?)
The field and get shown in my backend when editing a fe_user and i can
save data to the field. So far, so good, in the backend..
I then create a Fluid template with the object "member" (my domain
model containing the above mentioned property) and creates a field
with the following code
<label for="number">Member number</label><br />
<f:form.textbox property="number" /><br /> (question #2: is this
the correct way to call the field, using the property name and not the
database field name?)
I expect this to show the content of the property "member" but i shows
blank, even though the field (with the long name) got a value. If i
submits the form without content the @validate notEmpty get handled
and a error shows. If i put som random content, the form get saved
with succes but still no data in the field (not in frontend nor in
backend). I then try to change the name of the field (in my fluid
template) to the long name (tx_groupmembers_....) but still no luck,
as there is no property in my model named that.
As a proof of concept i decied to change the name of the database
field to "number" and the same with the TCA definition and then reload
the Fluid form and then i got the content of the field and can save to
the database with success.
Now my question #3 is, is this a naming convention bug, a model bug, a
personal bug or something else?
Best regards,
Søren
On Fri, Feb 19, 2010 at 10:57 AM, Michael Staatz <info at mduttlinger.de> wrote:
> Am 19.02.2010 09:38, schrieb Søren Malling:
>>>
>>> Hi,
>>> i had a similar problem.
>>>
>>> i could fix it with these lines:
>>> $persistanceManager = Tx_Extbase_Dispatcher::getPersistenceManager();
>>> $persistanceManager->persistAll();
>>
>> Where did you place those lines? I've tried to place them in a
>> constructer in my repository but it made my extbase return a error
>> about calling a function on a non-member
>>
>> Regards,
>>
>> Søren
>
> Hi Søren,
>
> public function updateAction(){
>
> ...
>
> $format = new Tx_Mwcsvtable_Domain_Model_Format();
> $format->setTitle($title);
> $format->setFormatid($formatid);
> $this->formatRepository->add($format);
> $format->setGenerate($form);
> $this->formatRepository->update($format);
> $persistanceManager = Tx_Extbase_Dispatcher::getPersistenceManager();
> $persistanceManager->persistAll();
>
> ...
>
> }
>
> Best,
> Michael
>
> _______________________________________________
> TYPO3-project-typo3v4mvc mailing list
> TYPO3-project-typo3v4mvc at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc
>
--
Officially Certified TYPO3 Integrator
More information about the TYPO3-project-typo3v4mvc
mailing list