Extending domain objects or map to existing tables

Since the TYPO3 Core already contains a number of database tables and domain object classes, it may prove useful to reuse or extend existing domain objects instead of creating new ones:

Extending domain objects

The Extension Builder supports single table inheritance. This means you can extend domain object classes, either from your current extension or from other extensions. You must enter the fully qualified class name of the domain object you want to extend in the Extend existing model class field in the domain object settings form. The class must be loadable, i.e. you can only extend classes of extensions that are installed. After saving and updating the database (if necessary), you should find a drop-down list Record Type and a new tab with the new properties in the backend record form.

In this example, the frontend user domain object was extended:

Extend Frontend user

Mapping to tables

If you want to store a domain object in an existing table, for example if there is no domain object class for that table yet (like tt_address), then you can enter the table name in the Map to existing table field in the domain object settings form. The Extension Builder will then add fields to this table for each property you added to your domain object. If you name the properties according to the existing field names, you can access the existing fields with the getters and setters of your domain object class, and no new fields are created.

In this example the domain object is mapped to table tt_address:

Mapping to tt_address

and these are the resulting database updates:

Database updates of tt_address mapping

and this is the backend form of the extended frontend user:

Backend form of mapped domain object

Relations to domain objects of other extensions

If you want to add a relation to a domain object that is not part of your current extension, you must enter the fully qualified class name of that object in the relation settings form. The related class must be loadable, so you can only add domain objects from installed extensions.