---
title: "Extending an Extbase model"
manual: "TYPO3 Explained"
version: "14.3"
permalink: "https://docs.typo3.org/permalink/t3coreapi:extending-extbase-model@14.3"
source: "ExtensionArchitecture/HowTo/ExtendExtbaseModel/Index.rst"
rendered: "2026-09-21T13:25:26+00:00"
---

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

Once you have added a new field to the
[TCA](https://docs.typo3.org/permalink/t3coreapi:extending-tca@14.3) it 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-extension-framework@14.3) 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 {#extending-extbase-model-quick-overview}

Follow these steps:

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

## Step by step {#extending-extbase-model-steps}

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

Search for other classes in your installation that extend
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 rest of this tutorial use the extended model
as the original model.

If the model has different [record types](https://docs.typo3.org/permalink/t3coreapi:extbase-domain-model-mapping@14.3)
you can add a new type and
only extend that one type. This is commonly done when extending
the [`georgringer/news`](https://packagist.org/packages/georgringer/news) model.

If you are planning to publish this extension, search
[Packagist](https://packagist.org/) and the
[TER (TYPO3 extension repository)](https://extensions.typo3.org/) for
extensions that also extend the original model. If necessary, put them in
the `conflict` sections of your extension's `composer.json`.

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

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

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

You can also try debugging the model with 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 will give you further hints on where to find
the associated class. You could, for example, do a full text search for the
namespace of the 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 using the instructions in this tutorial. Refer to the documentation of
the original extension.

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

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

For example, if the model is [`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 can't find the repository but have found the model, the extension might
    not be using an Extbase repository. This tutorial will not help you in this
    case as it is only relevant for Extbase repositories.
-   -   **If you find a repository according to this naming scheme but it does not extend**

        the class

    `\TYPO3\CMS\Extbase\Persistence\Repository` directly or indirectly, it
    is also not an Extbase repository.
-   If the repository is final it cannot be extended.

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

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

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

**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 the additional fields that you require. By convention the database
fields and the model names are prefixed with the name of your extension.

### 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-domain-model-mapping@14.3) in files
[`Configuration/Extbase/Persistence/Classes.php`](../../FileStructure/Configuration/Extbase/Persistence/Index.md#file-extension-configuration-extbase-persistence-classes-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 (optional) {#extending-extbase-model-extend-original-repository}

Similarly, 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 naming schema of the model also
applies when extending model and repository. So the new repository's name must
end with "Repository" and it must be in the `Domain/Repository` directory.

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

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

The extended repository needs to be registered with Extbase in your extension file
[`EXT:my_extension/ext_localconf.php`](../../FileStructure/ExtLocalconf.md#file-extension-ext-localconf-php). This 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 {#extending-extbase-model-alternative-strategies}

There is a TYPO3 extension that extends 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 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), for example.

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