CoolCMS API

EntityOf
in package

FinalYes

Declares the target class of a single (ToOne) association for {@see \App\Core\Utils\Hydrators\EntityHydrator}.

The module hydrator does not read Doctrine targetEntity, and the type hint often differs from the concrete class: the property is untyped, or typed to a shared base class (?BaseMenu $menu) while _references and the cache use the concrete module class. This attribute supplies that class so the {id: ...} reference is found in the right cache, and it takes precedence over the type hint. Counterpart of CollectionOf.

Usage:

#[EntityOf(\App\UI\Front\System\Models\Entities\Page::class)]
protected $page = null;
Attributes
#[Attribute]
\Attribute::TARGET_PROPERTY

Table of Contents

Properties

$entityClass  : string

Methods

__construct()  : mixed

Properties

$entityClass read-only

public string $entityClass

Methods

__construct()

public __construct(class-string $entityClass) : mixed
Parameters
$entityClass : class-string

concrete target entity of the association

On this page

Search results