[TYPO3-mvc] updateAction not saving field extending another Model

Jochen Rau jochen.rau at typoplanet.de
Fri Feb 19 16:42:14 CET 2010


Hi.

On 19.02.10 11:23, Søren Malling wrote:
> 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:

IMO that's worth a bug report ;-)

> 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?)

I vote for

tx_groupmembers_foo_bar

as we already have (too) long database table names (at least for 
Oracle). I will implement an automatic mapping of field names starting 
with "tx_":

field name                  property name
tx_groupmembers_foo_bar ->  fooBar

That solves the problem of naming annoyances in extended tables *and* 
enables the usage of reserved words like "usage" as field names.

> 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?)

Yes. Outside the database table think in objects and properties.

> I expect this to show the content of the property "member" but i shows
> blank, even though the field (with the long name)

You have to define a mapping rule to ease your domain object and your 
pain :-) . An example with tx_groupmember_number as field name:

config.tx_extbase {
  persistence{
   classes {
    Tx_Groupmembers_Domain_Model_Members {
     mapping {
       columns {
        tx_groupmembers_number.mapOnProperty = number
       }
      }
     }
    }
   }
  }
}


  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?

;-) Let's be diplomatic: "something else".

Jochen




More information about the TYPO3-project-typo3v4mvc mailing list