---
title: "Extending an Extbase model"
manual: "TYPO3 Explained"
version: "12.4"
permalink: "https://docs.typo3.org/permalink/t3coreapi:extending-extbase-model@12.4"
source: "ExtensionArchitecture/HowTo/ExtendExtbaseModel/Index.rst"
rendered: "2026-10-21T15:29:37+00:00"
---

> [!WARNING]
> **Attention**
>
> TYPO3 v12 has reached end-of-life as of April 30th 2026 and
> is no longer being maintained. Use the version switcher on the top
> left of this page to select documentation for a supported version of TYPO3.
>
> Need more time before upgrading?
> You can purchase Extended Long Term Support (ELTS) for TYPO3 v12 here:
> [TYPO3 ELTS](https://typo3.com/services/extended-support-elts).

# Extending an Extbase model {#extending-extbase-model}

Once you have added an additional field to the
[TCA](https://docs.typo3.org/permalink/t3coreapi:extending-tca@12.4) the new field will be displayed in the backend forms.

However, if the extension you are trying to extend is based on [Extbase](https://docs.typo3.org/permalink/t3coreapi:extbase@12.4) the new
field is not available in the frontend out of the box. Further steps are
needed to make the fields available. These steps will not work in all cases.

## Quick overview {#quick-overview}

Follow these steps:

1.  Is your extension the [only one trying to
    extend](https://docs.typo3.org/permalink/t3coreapi:extending-extbase-model-find-other-extending-models@12.4) the original
    model within your installation?
1.  [Find the original model](https://docs.typo3.org/permalink/t3coreapi:extending-extbase-model-find-original-model@12.4).
    If this model has the modifier `final` refer
    to the extension's documentation on how to display additional fields.
1.  [Find the original repository](https://docs.typo3.org/permalink/t3coreapi:extending-extbase-model-find-original-repository@12.4).
    Again, if the repository is `final` refer
    to the extension's documentation on how to display additional fields.
1.  [Extend the original model](https://docs.typo3.org/permalink/t3coreapi:extending-extbase-model-extend-original-model@12.4)
    in your custom extension or [sitepackage](https://docs.typo3.org/permalink/t3coreapi:site-package@12.4).
1.  [Register your extended model](https://docs.typo3.org/permalink/t3coreapi:extending-extbase-model-register-extended-model@12.4)
    with the according database table in
    [`EXT:my_extension/Configuration/Extbase/Persistence/Classes.php`](../../FileStructure/Configuration/Extbase/Persistence/Index.md#file-extension-configuration-extbase-persistence-classes-phpclasses-php).
1.  [Extend the original repository](https://docs.typo3.org/permalink/t3coreapi:extending-extbase-model-register-extended-model@12.4)
    in your custom extension or sitepackage.
1.  [Register your extended repository](https://docs.typo3.org/permalink/t3coreapi:extending-extbase-model-register-extended-repository@12.4)
    to be used instead of the original one.

## Step by step {#step-by-step}

### Are you the only one trying to extend that model? {#extending-extbase-model-find-other-extending-models}

Within your installation you can search for other classes that are extending
the original model or repository (see below).

If the model is already extended but you only need to create the fields for
your current installation you can proceed by extending the extended model.
In the following steps of this tutorial use the previously extended model
as original model.

If the model has different [Record types](https://docs.typo3.org/permalink/t3coreapi:extbase-persistance-record-types@12.4)
you can decide to introduce a new type and
only extend that one type. This is, for example, commonly done when extending
the model of [EXT:news](https://extensions.typo3.org/extension/news).

If you are planning to publish your extension that extends another extensions
model, research on [Packagist](https://packagist.org/) and the
[TER (TYPO3 extension repository)](https://extensions.typo3.org/) for
extensions that are already extending the model. If necessary, put them in
the `conflict` sections of you extensions [composer.json](https://docs.typo3.org/permalink/t3coreapi:composer-json@12.4) and
[ext_emconf.php](https://docs.typo3.org/permalink/t3coreapi:ext-emconf-php@12.4).

### Find the original model {#extending-extbase-model-find-original-model}

The model should be located in the original extension at path
`EXT:original_extension/Classes/Domain/Model/` or a subdirectory
thereof. If the model is not found here it might

-   be situated in a different extension
-   not be an Extbase model (you cannot follow this tutorial then)

You can also try to debug the model in a Fluid template that outputs the model:

**Some Fluid template that uses the model**

```html
<f:debug>{someModel}</f:debug>
```

If you debugged the correct object the fully qualified PHP name of the model
will appear in the debug output. This gives you further hints on where to find
the associated class. You could, for example, do a full text search for the
namespace of this class.

If the class of the model is final:

**EXT:original_extension/Classes/Domain/Model/SomeModel.php**

```php
final class SomeModel {
    // ...
}
```

It cannot be extended by means of this tutorial. Refer to the documentation of
the original extension.

### Find the original repository {#extending-extbase-model-find-original-repository}

In Extbase the repository of a model mostly has to have the same class name as
the model, prefixed with "Repository". It has to be located in the same domain
directory as the model, but in the subfolder `Repository`.

For example, if the model is found in [`Classes/Domain/Model/SomeModel.php`](../../FileStructure/Classes/Index.md#file-extension-classes-domain-model-something-php)
the repository is located in
[`Classes/Domain/Repository/SomeModelRepository.php`](../../FileStructure/Classes/Index.md#file-extension-classes-domain-repository-somethingrepository-php).

-   If you do not find this repository but found the model the extension might
    not use an Extbase repository. This tutorial does not help you in this
    case as it can only be applied to Extbase repositories.
-   If you find a repository in this name scheme but it does not extend
    directly or indirectly the class
    `\TYPO3\CMS\Extbase\Persistence\Repository` you are also not dealing
    with an Extbase repository.
-   If the repository is final it cannot be extended.

In all these cases refer to the extension's documentation on how to extend it.

### Extend the original model {#extending-extbase-model-extend-original-model}

We assume you already extended the database table and TCA (table configuration array)
as described in [Extending TCA](https://docs.typo3.org/permalink/t3coreapi:extending-tca@12.4). Extend the
original model by a custom class in your extension:

**EXT:my_extension/Classes/Domain/Model/MyExtendedModel.php**

```php
<?php

declare(strict_types=1);

namespace MyVendor\MyExtension\Domain\Model;

use OriginalVendor\OriginalExtension\Domain\Model\SomeModel;

class MyExtendedModel extends SomeModel
{
    protected string $txMyExtensionAdditionalField;

    public function getTxMyExtensionAdditionalField(): string
    {
        return $this->txMyExtensionAdditionalField;
    }

    public function setTxMyExtensionAdditionalField(string $txMyExtensionAdditionalField): void
    {
        $this->txMyExtensionAdditionalField = $txMyExtensionAdditionalField;
    }
}

```

Add all additional fields that you require. By convention the database
fields are usually prefixed with your extension's name and so are the
names in the model.

### Register the extended model {#extending-extbase-model-register-extended-model}

The extended model needs to be registered for [Extbase persistence](https://docs.typo3.org/permalink/t3coreapi:extbase-persistence@12.4) in file
[`Configuration/Extbase/Persistence/Classes.php`](../../FileStructure/Configuration/Extbase/Persistence/Index.md#file-extension-configuration-extbase-persistence-classes-phpclasses-php) and [`ext_localconf.php`](../../FileStructure/ExtLocalconf.md#file-extension-ext-localconf-php).

**EXT:my_extension/Configuration/Extbase/Persistence/Classes.php**

```php
<?php

declare(strict_types=1);

use MyVendor\MyExtension\Domain\Model\MyExtendedModel;

return [
    MyExtendedModel::class => [
        'tableName' => 'tx_originalextension_somemodel',
    ],
];

```

**EXT:my_extension/ext_localconf.php**

```php
<?php

declare(strict_types=1);

use MyVendor\MyExtension\Domain\Model\MyExtendedModel;
use OriginalVendor\OriginalExtension\Domain\Model\SomeModel;

defined('TYPO3') or die('Access denied.');

$GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects'][SomeModel::class] = [
    'className' => MyExtendedModel::class,
];

```

### Extend the original repository {#extending-extbase-model-extend-original-repository}

Likewise extend the original repository:

**EXT:my_extension/Classes/Domain/Repository/MyExtendedModelRepository.php**

```php
<?php

declare(strict_types=1);

namespace MyVendor\MyExtension\Domain\Repository;

use OriginalVendor\OriginalExtension\Domain\Repository\SomeModelRepository;

class MyExtendedModelRepository extends SomeModelRepository
{
    /* Unless you need additional methods you can leave the class body empty */
}

```

The rule that a repository must follow the name schema of the model also
applies when extending model and repository. So the new repository's name must
end on "Repository" and it must be in the directory `Domain/Repository`.

If you have no need for additional repository methods you can leave the body of
this class empty. However, for Extbase internal reasons you have to create this
repository even if you need no additional functionality.

### Register the extended repository {#extending-extbase-model-register-extended-repository}

The extended repository needs to be registered with Extbase in your extensions
[`EXT:my_extension/ext_localconf.php`](../../FileStructure/ExtLocalconf.md#file-extension-ext-localconf-php). This step tells
Extbase to use your repository instead of the original one whenever the original
repository is requested via Dependency Injection in a controller or service.

**EXT:my_extension/ext_localconf.php**

```php
<?php

declare(strict_types=1);

use MyVendor\MyExtension\Domain\Repository\MyExtendedRepository;
use OriginalVendor\OriginalExtension\Domain\Repository\SomeRepository;

defined('TYPO3') or die('Access denied.');

$GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects'][SomeRepository::class] = [
    'className' => MyExtendedRepository::class,
];

```

## Alternative strategies to extend Extbase models {#alternative-strategies-to-extend-extbase-models}

There is a dedicated TYPO3 extension to extend models and functions to classes by
implementing the proxy pattern: [Extbase Domain Model Extender
(evoweb/extender)](https://extensions.typo3.org/extension/extender).

This extension can - for example - be used to
[Extend models of tt_address](https://docs.typo3.org/p/friendsoftypo3/tt-address/main/en-us/Development/ExtendTtAddress/Index.html#development-extend-ttaddress).

The commonly used extension `EXT:news (georgringer/news)` supplies a special
generator that can be used to [add custom fields to news models](https://docs.typo3.org/p/georgringer/news/main/en-us/Tutorials/ExtendNews/ProxyClassGenerator/Index.html#proxyClassGenerator).
