Extbase PHP attributes reference 

This page is a quick-reference for all PHP attributes defined and handled by the Extbase framework itself. It covers ORM attributes (used on model properties), validation attributes (used on model properties and action parameters), and controller-level attributes (used on action methods).

It does not cover attributes defined by TYPO3 Core outside of Extbase, or PHP built-in attributes.

ORM (object relational mapping) attributes (persistence) 

ORM (Object-Relational Mapping) is the mechanism that lets you work with PHP objects instead of raw database rows. Therefor Extbase maps database fields to Object Model properties and back. The attributes described below are used to control this process.

The attributes are declared in the \TYPO3\CMS\Extbase\Attribute\ORM namespace and are placed on model properties.

#[Lazy] 

Target

Model property

Fully qualified namespace

\TYPO3\CMS\Extbase\Attribute\ORM\Lazy

Parameters

none

By default, relations are resolved and processed by loading all related objects together with the parent, which can harm performance and trigger N+1 queries, for example in list views. #[Lazy] tells Extbase to load the related object only when it is actively accessed — by calling its methods or reading its properties.

The lazy relation is a native PHP lazy object of the target class, so the property keeps its plain type and the getter needs no special handling. See Lazy loading.

EXT:my_extension/Classes/Domain/Model/Conference.php
<?php

declare(strict_types=1);

namespace MyVendor\MyExtension\Domain\Model;

use TYPO3\CMS\Extbase\Attribute\ORM\Lazy;
use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;

class Conference extends AbstractEntity
{
  #[Lazy]
  protected ?Location $location = null;

  public function getLocation(): ?Location
  {
    return $this->location;
  }
}
Copied!

#[Cascade] 

Target

Model property

Fully qualified namespace

\TYPO3\CMS\Extbase\Attribute\ORM\Cascade

Parameters

string|null $value = null

Controls what happens to related objects when the parent object is deleted. Currently only 'remove' is supported:

EXT:my_extension/Classes/Domain/Model/Conference.php
<?php

declare(strict_types=1);

namespace MyVendor\MyExtension\Domain\Model;

use TYPO3\CMS\Extbase\Attribute\ORM\Cascade;
use TYPO3\CMS\Extbase\Attribute\ORM\Lazy;
use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;
use TYPO3\CMS\Extbase\Persistence\ObjectStorage;

class Conference extends AbstractEntity
{
  #[Lazy]
  #[Cascade('remove')]
  protected ObjectStorage $comments;
}
Copied!

Without #[Cascade('remove')] , deleting the parent object leaves related records in the database as orphans. With it, Extbase deletes the related objects automatically via the repository.

#[Transient] 

Target

Model property

Fully qualified namespace

\TYPO3\CMS\Extbase\Attribute\ORM\Transient

Parameters

none

Excludes a property from persistence entirely. Extbase never reads or writes the corresponding column. Use for computed values or temporary state:

EXT:my_extension/Classes/Domain/Model/Conference.php
<?php

declare(strict_types=1);

namespace MyVendor\MyExtension\Domain\Model;

use TYPO3\CMS\Extbase\Attribute\ORM\Transient;
use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;

class Conference extends AbstractEntity
{
  #[Transient]
  protected ?string $displayLabel = null;
}
Copied!

Validation attributes 

These attributes are declared in the \TYPO3\CMS\Extbase\Attribute namespace and control validation behavior on model properties and controller action parameters.

#[Validate] 

Target

Model property, action method parameter

Fully qualified namespace

\TYPO3\CMS\Extbase\Attribute\Validate

Repeatable

yes — apply multiple #[Validate] to one target

Parameters
 
string $validator
The validator class name or short name (for example 'NotEmpty', 'StringLength'). Short names resolve against the built-in validators in \TYPO3\CMS\Extbase\Validation\Validator .
array $options = []
Options passed to the validator constructor. The available options depend on the validator.
EXT:my_extension/Classes/Domain/Model/Conference.php
<?php

declare(strict_types=1);

namespace MyVendor\MyExtension\Domain\Model;

use TYPO3\CMS\Extbase\Attribute\Validate;
use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;

class Conference extends AbstractEntity
{
  #[Validate(validator: 'NotEmpty')]
  #[Validate(
    validator: 'StringLength',
    options: ['minimum' => 3, 'maximum' => 50],
  )]
  protected string $title = '';
}
Copied!

#[IgnoreValidation] 

Target

Action method parameter

Fully qualified namespace

\TYPO3\CMS\Extbase\Attribute\IgnoreValidation

Parameters

none (place directly on the parameter)

Suppresses validation for one action parameter. Useful in multi-step forms where partial state is forwarded between actions:

EXT:my_extension/Classes/Controller/ConferenceController.php
<?php

declare(strict_types=1);

namespace MyVendor\MyExtension\Controller;

use MyVendor\MyExtension\Domain\Model\Conference;
use Psr\Http\Message\ResponseInterface;
use TYPO3\CMS\Extbase\Attribute\IgnoreValidation;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;

class ConferenceController extends ActionController
{
  public function previewAction(
    #[IgnoreValidation]
    Conference $conference,
  ): ResponseInterface {
    // validation skipped for $conference
    return $this->htmlResponse();
  }
}
Copied!

Changed in version 15.0 Breaking: #109783 - Deprecated functionality removed

Place #[IgnoreValidation] directly on the parameter.

Controller attributes 

These attributes are declared in the \TYPO3\CMS\Extbase\Attribute namespace and are applied to controller action methods to control access and rate limiting.

#[Authorize] 

Target

Controller action method

Fully qualified namespace

\TYPO3\CMS\Extbase\Attribute\Authorize

Declares access requirements for an action method. Extbase checks the requirements before calling the action and answers with HTTP 403 if they are not met. See Protecting Extbase actions with #[Authorize] for the options and an example.

#[RateLimit] 

Target

Controller action method

Fully qualified namespace

\TYPO3\CMS\Extbase\Attribute\RateLimit

Limits how often an action may be called within a time window, per visitor. Useful for protecting form submission endpoints against brute-force and spam. See Rate-limiting Extbase actions with #[RateLimit] for the options and an example.