Attributes in Extbase 

All available attributes for Extbase delivered by TYPO3 Core are placed within the namespace \TYPO3\CMS\Extbase\Annotation for historic reasons. Until TYPO3 version 11 they could only be used a an annotation, a comment in the code that was interpreted (using the doctrine/annotations package, which is now abandoned).

Example in EXT:blog_example for the attribute Lazy:

EXT:blog_example/Classes/Domain/Model/Blog.php, modified
<?php

declare(strict_types=1);

namespace T3docs\BlogExample\Domain\Model;

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

class Post extends AbstractEntity
{
    /**
     * @var ObjectStorage<Post>
     */
    #[Lazy()]
    public ObjectStorage $relatedPosts;
}
Copied!

Attributes provided by Extbase 

The following attributes are provided Extbase:

Validate 

\TYPO3\CMS\Extbase\Annotation\Validate : Allows to configure validators for properties and method arguments. See Using validation for Extbase models and controllers for details.

Can be used in the context of a model property.

Example:

EXT:blog_example/Classes/Domain/Model/Blog.php, modified
<?php

declare(strict_types=1);

namespace T3docs\BlogExample\Domain\Model;

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

class Blog extends AbstractEntity
{
    #[Validate([
        'validator' => 'StringLength',
        'options' => ['maximum' => 150],
    ])]
    public string $description = '';
}
Copied!

Validate attributes for a controller action are executed additionally to possible domain model validators.

IgnoreValidation 

\TYPO3\CMS\Extbase\Annotation\IgnoreValidation(): Allows to ignore all Extbase default validations for a given argument (for example a domain model object).

Used in context of a controller action.

Example:

EXT:blog_example/Classes/Controller/BlogController.php, modified
<?php

declare(strict_types=1);

namespace T3docs\BlogExample\Controller;

use Psr\Http\Message\ResponseInterface;
use T3docs\BlogExample\Domain\Model\Blog;
use TYPO3\CMS\Extbase\Annotation\IgnoreValidation;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;

final class BlogController extends ActionController
{
    #[IgnoreValidation(['argumentName' => 'blog'])]
    public function editAction(Blog $blog): ResponseInterface
    {
        // Do something
        $this->view->assign('blog', $blog);
        return $this->htmlResponse();
    }
}
Copied!

You can not exclude specific properties of a object specified in an argument.

If you need to exclude certain validators of a domain model, you could adapt the concept of a "Data Transfer Object" (DTO). You would create a distinct model variant of the main domain model, and exclude all the properties that you do not want validation for in your Extbase context, and transport the contents from and between your original domain model to this instance. Read more about this on https://usetypo3.com/dtos-in-extbase/ or see a CRUD example for this on https://github.com/garvinhicking/gh_validationdummy/

ORM (object relational model) attributes 

The following attributes can only be used on model properties:

Cascade 

\TYPO3\CMS\Extbase\Annotation\ORM\Cascade("remove"): Allows to remove child entities during deletion of aggregate root.

Extbase only supports the option "remove".

Example:

EXT:blog_example/Classes/Domain/Model/Blog.php, modified
<?php

declare(strict_types=1);

namespace T3docs\BlogExample\Domain\Model;

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

final class Blog extends AbstractEntity
{
    /**
     * @var ObjectStorage<Post>
     */
    #[Cascade(['value' => 'remove'])]
    public $posts;
}
Copied!

Transient 

\TYPO3\CMS\Extbase\Annotation\ORM\Transient : Marks property as transient (not persisted).

Example:

EXT:blog_example/Classes/Domain/Model/Post.php, modified
<?php

declare(strict_types=1);

namespace T3docs\BlogExample\Domain\Model;

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

final class Person extends AbstractEntity
{
    #[Transient()]
    protected string $fullname = '';
}
Copied!

Lazy 

\TYPO3\CMS\Extbase\Annotation\ORM\Lazy : Marks model property to be loaded lazily on first access.

Example:

EXT:blog_example/Classes/Domain/Model/Post.php, modified
<?php

declare(strict_types=1);

namespace T3docs\BlogExample\Domain\Model;

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

class Post extends AbstractEntity
{
    /**
     * @var ObjectStorage<Post>
     */
    #[Lazy()]
    public ObjectStorage $relatedPosts;
}
Copied!

Combining attributes 

Attributes can be combined. For example, "lazy loading" and "removal on cascade" are frequently combined:

EXT:blog_example/Classes/Domain/Model/Post.php, modified
<?php

declare(strict_types=1);

namespace T3docs\BlogExample\Domain\Model;

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

class Post extends AbstractEntity
{
    #[Lazy()]
    #[Cascade(['value' => 'remove'])]
    /**
     * @var ObjectStorage<Comment>
     */
    public ObjectStorage $comments;
}
Copied!

Several validations can also be combined. See Using validation for Extbase models and controllers for details.