CoolCMS API

GetTrait

Provides `find()`.

Tags
template

Table of Contents

Methods

find()  : SingleQuery<string|int, T>
Finds one entity by ID and returns a `SingleQuery` object.

Methods

find()

Finds one entity by ID and returns a `SingleQuery` object.

public find(int $id[, string|array<string|int, mixed> $includes = [] ]) : SingleQuery<string|int, T>

Usage:

$query = $manager->find(1, ['translations']);
$entity = $query->include(['routes'])->execute(); // or ->get()
$title = $query->getTitle(); // magic call, forwarded to the entity
Parameters
$id : int

entity ID

$includes : string|array<string|int, mixed> = []

relations to load ['translations', 'routes'], or '*' for all

Return values
SingleQuery<string|int, T>
On this page

Search results