EntityQueryService
in package
Standalone entity query service -- replaces QubitObject::getBySlug(), QubitQuery, and MPTT hierarchy traversal for standalone Heratio mode.
All methods return plain objects (stdClass) or arrays, never Propel objects. Compatible with template rendering via LightweightResource __get() magic.
Tags
Table of Contents
Methods
- buildResource() : LightweightResource|null
- Build a lightweight resource object that works in templates.
- buildResourceBySlug() : LightweightResource|null
- Build a lightweight resource from a slug.
- countDescendants() : int
- Count descendants using MPTT.
- findById() : object|null
- Load an entity by ID with i18n data.
- findByIds() : array<string|int, object>
- Load multiple entities by IDs.
- findBySlug() : object|null
- Load an entity by slug with i18n data.
- getAncestors() : array<string|int, object>
- Get ancestors (path from root to this node) using MPTT.
- getChildren() : array<string|int, object>
- Get direct children of an object.
- getClassForTable() : string|null
- Get the class name for a table.
- getDescendants() : array<string|int, object>
- Get all descendants of an object (using MPTT lft/rgt on the entity table).
- getDigitalObjects() : array<string|int, object>
- Get digital objects for an information object.
- getEvents() : array<string|int, object>
- Get events for an information object (dates, creation events, etc.).
- getNotes() : array<string|int, object>
- Get notes for an object.
- getParent() : object|null
- Get the parent of an object.
- getProperties() : array<string|int, object>
- Get properties for an object.
- getRelations() : array<string|int, object>
- Get related objects via the relation table.
- getSlug() : string|null
- Get the slug for an object ID.
- getTableForClass() : string|null
- Get the table name for a class.
- isClassMapped() : bool
- Check if a class is mapped.
- resolveSlug() : array{id: int, class_name: string, slug: string}|null
- Resolve a slug to an object ID + class_name.
Methods
buildResource()
Build a lightweight resource object that works in templates.
public
static buildResource(int $id[, string|null $className = null ][, string $culture = 'en' ]) : LightweightResource|null
Supports __get(), __isset(), __toString() for template compatibility. This replaces ActionBridge's buildLightweightResource with a more complete implementation.
Parameters
- $id : int
- $className : string|null = null
- $culture : string = 'en'
Return values
LightweightResource|nullbuildResourceBySlug()
Build a lightweight resource from a slug.
public
static buildResourceBySlug(string $slug[, string $culture = 'en' ]) : LightweightResource|null
Parameters
- $slug : string
- $culture : string = 'en'
Return values
LightweightResource|nullcountDescendants()
Count descendants using MPTT.
public
static countDescendants(int $objectId, string $className) : int
Parameters
- $objectId : int
- $className : string
Return values
intfindById()
Load an entity by ID with i18n data.
public
static findById(int $id[, string|null $className = null ][, string $culture = 'en' ]) : object|null
Returns a stdClass with all table fields + i18n fields merged. If className is not provided, it is looked up from the object table.
Parameters
- $id : int
- $className : string|null = null
- $culture : string = 'en'
Return values
object|nullfindByIds()
Load multiple entities by IDs.
public
static findByIds(array<string|int, int> $ids[, string|null $className = null ][, string $culture = 'en' ]) : array<string|int, object>
Parameters
- $ids : array<string|int, int>
- $className : string|null = null
- $culture : string = 'en'
Return values
array<string|int, object> —Indexed by ID
findBySlug()
Load an entity by slug with i18n data.
public
static findBySlug(string $slug[, string $culture = 'en' ]) : object|null
Parameters
- $slug : string
- $culture : string = 'en'
Return values
object|nullgetAncestors()
Get ancestors (path from root to this node) using MPTT.
public
static getAncestors(int $objectId, string $className[, string $culture = 'en' ]) : array<string|int, object>
Returns ancestors ordered from root to immediate parent.
Parameters
- $objectId : int
- $className : string
- $culture : string = 'en'
Return values
array<string|int, object>getChildren()
Get direct children of an object.
public
static getChildren(int $parentId, string $className[, string $culture = 'en' ]) : array<string|int, object>
Parameters
- $parentId : int
- $className : string
- $culture : string = 'en'
Return values
array<string|int, object>getClassForTable()
Get the class name for a table.
public
static getClassForTable(string $table) : string|null
Parameters
- $table : string
Return values
string|nullgetDescendants()
Get all descendants of an object (using MPTT lft/rgt on the entity table).
public
static getDescendants(int $objectId, string $className[, string $culture = 'en' ]) : array<string|int, object>
AtoM stores lft/rgt on information_object and term tables.
Parameters
- $objectId : int
- $className : string
- $culture : string = 'en'
Return values
array<string|int, object>getDigitalObjects()
Get digital objects for an information object.
public
static getDigitalObjects(int $informationObjectId) : array<string|int, object>
Parameters
- $informationObjectId : int
Return values
array<string|int, object>getEvents()
Get events for an information object (dates, creation events, etc.).
public
static getEvents(int $informationObjectId[, string $culture = 'en' ]) : array<string|int, object>
event table: id, start_date, start_time, end_date, end_time, type_id, object_id (FK to information_object), actor_id, source_culture event_i18n: id, culture, name, description, date
Parameters
- $informationObjectId : int
- $culture : string = 'en'
Return values
array<string|int, object>getNotes()
Get notes for an object.
public
static getNotes(int $objectId[, int|null $typeId = null ][, string $culture = 'en' ]) : array<string|int, object>
note table: id, object_id, type_id, scope, user_id, source_culture note_i18n: id, culture, content
Parameters
- $objectId : int
- $typeId : int|null = null
- $culture : string = 'en'
Return values
array<string|int, object>getParent()
Get the parent of an object.
public
static getParent(int $objectId, string $className[, string $culture = 'en' ]) : object|null
Parameters
- $objectId : int
- $className : string
- $culture : string = 'en'
Return values
object|nullgetProperties()
Get properties for an object.
public
static getProperties(int $objectId[, string|null $name = null ][, string $culture = 'en' ]) : array<string|int, object>
property table: id, object_id, scope, name, source_culture property_i18n: id, culture, value
Parameters
- $objectId : int
- $name : string|null = null
- $culture : string = 'en'
Return values
array<string|int, object>getRelations()
Get related objects via the relation table.
public
static getRelations(int $objectId[, int|null $typeId = null ][, string $culture = 'en' ]) : array<string|int, object>
relation table: id, subject_id, object_id, type_id, start_date, end_date, source_culture
Parameters
- $objectId : int
- $typeId : int|null = null
- $culture : string = 'en'
Return values
array<string|int, object>getSlug()
Get the slug for an object ID.
public
static getSlug(int $objectId) : string|null
Parameters
- $objectId : int
Return values
string|nullgetTableForClass()
Get the table name for a class.
public
static getTableForClass(string $className) : string|null
Parameters
- $className : string
Return values
string|nullisClassMapped()
Check if a class is mapped.
public
static isClassMapped(string $className) : bool
Parameters
- $className : string
Return values
boolresolveSlug()
Resolve a slug to an object ID + class_name.
public
static resolveSlug(string $slug) : array{id: int, class_name: string, slug: string}|null
Parameters
- $slug : string