Index

LogQuery

MMO\core\entities · 1 symbol · generated 30 Sep 2026

class

LogQuery

LogQuery.php:21

A repository operation, recorded (and dispatchable as an event, so a listener can inspect/veto it via

class MMO\core\entities\LogQuery extends MMO\core\entities\Entity implements MMO\core\interfaces\iEvent, MMO\core\interfaces\iStoppableEvent use MMO\core\classes\tEvent, MMO\core\classes\tStoppableEvent
Namespace
MMO\core\entities
Extends
Entity
Implements
iEvent, iStoppableEvent
Uses traits
tEvent, tStoppableEvent
See
iStoppableEvent) whenever an entity is inserted/updated/deleted/status-changed. Itself an Entity, so it can be persisted as an audit log entry.

Index

HIDDENWhat $data holds in place of a hidden property's value (ArrayProperty::isHidden): the log tells it was written, never with what (aRepository::c…
collectionName
data
entity
filters
limit
Listeners static
offset
origin
sorts
stopped
type
AddListener($handler, $order) staticRegister a listener directly (as opposed to ConnectListeners's attribute-based discovery).
ConnectListeners($obj) staticScan $obj's methods for #[Listen(EventClass::class)] attributes and register each one as a listener on the matching event class.
DisconnectListeners($obj) staticUndo a previous ConnectListeners: removes every listener that connect had registered for $obj on this event class.
dispatch()Invoke every GetListeners listener with $this.
getEntity()
GetListeners() staticCollect every listener for this class, including those registered on its parent classes (so a subclass event is also caught by listeners of its parent event), sorted by ascending $order (ties keep …
getOrigin()
HasListener($handler) static
ignore($stop)Veto the operation this LogQuery describes.
isPropagationStopped()
RemoveListener($handler) staticRemove the last added handler from the listeners.
Send($args) staticConstruct a new instance of this class with $args, then dispatch it to every listener.
setEntity($entity)Explicitly set the entity this operation targets (bypassing the by-id lookup in getEntity).
SetListenerOrder($handler, $order) staticChange the order of an already-registered listener, whether added directly via AddListener or indirectly via ConnectListeners (which also stores its [$obj, $methodName] callables here).
stopPropagation()Prevent any remaining listener in the current dispatch chain from being called.
__clone()A cloned event starts fresh: propagation is never considered stopped on the clone, even if it was on the original instance.

Constants1

Properties11

collectionName

#[MMO\core\attributes\ArrayProperty()] protected string $collectionName
Type
string

data

#[MMO\core\attributes\ArrayProperty()] protected array $data = []
Type
array

entity

protected ?MMO\core\entities\Entity $entity = null
Type
null | Entity

filters

#[MMO\core\attributes\ArrayProperty()] protected array $filters = []
Type
array

limit

#[MMO\core\attributes\ArrayProperty()] protected ?int $limit = null
Type
null | int

Listeners

static
protected static array $Listeners = []
Type
array

offset

#[MMO\core\attributes\ArrayProperty()] protected ?int $offset = null
Type
null | int

origin

#[MMO\core\attributes\ArrayProperty()] protected object|string $origin
Type
object | string

sorts

#[MMO\core\attributes\ArrayProperty()] protected string $sorts = ''
Type
string

stopped

protected $stopped = false

type

#[MMO\core\attributes\ArrayProperty()] protected MMO\core\entities\cLogQuery $type
Type
cLogQuery

Methods16

AddListener($handler, $order)

statictEvent.php:62

Register a listener directly (as opposed to ConnectListeners's attribute-based discovery).

static function AddListener(callable $handler, int $order = 0): void
$handlercallablecalled as $handler($eventInstance) when this event class is Send / dispatch-ed
$order = 0intlisteners run in ascending order (lower first); listeners with an equal order run in the order they were added
returnsvoid
UserCreated::AddListener(function (UserCreated $e) {...}, 10);

ConnectListeners($obj)

statictEvent.php:37

Scan $obj's methods for #[Listen(EventClass::class)] attributes and register each one as a listener on the matching event class. connect does the actual reflection/registration.

static function ConnectListeners(object|string $obj): void
$objobject | stringan instance (or class name, for static-only listener methods)
returnsvoid
throws
class UserService { #[Listen(UserCreated::class, order: 1)] public function onUserCreated(UserCreated $e): void {...} } UserCreated::ConnectListeners(new UserService()); // onUserCreated() is now called on every UserCreated::Send()

DisconnectListeners($obj)

statictEvent.php:49

Undo a previous ConnectListeners: removes every listener that connect had registered for $obj on this event class.

static function DisconnectListeners(object|string $obj): void
$objobject | string
returnsvoid
throws
UserCreated::DisconnectListeners($service); // $service's #[Listen] methods stop firing

dispatch()

tEvent.php:153

Invoke every GetListeners listener with $this. If the class also implements PSR-14's StoppableEventInterface, dispatch stops early as soon as isPropagationStopped() becomes true.

function dispatch(): static
returnsstatic$this, for chaining
(new UserCreated('Marc'))->dispatch(); // what Send() does internally

getEntity()

LogQuery.php:94
function getEntity(): ?MMO\core\entities\Entity
returnsnull | Entitythe entity this operation targets, if one was explicitly set (setEntity) or can be looked up (by id, from $filters) via this LogQuery's own repository (only available once this LogQuery is itself attached to a collection -- see Entity::getRepository); null otherwise.

GetListeners()

statictEvent.php:123

Collect every listener for this class, including those registered on its parent classes (so a subclass event is also caught by listeners of its parent event), sorted by ascending $order (ties keep insertion order).

static function GetListeners(): array
returnsarray[[callable $handler, int $order], ...]
UserCreated::GetListeners(); // [[$handlerB, 5], [$handlerA, 10]] -- lower order first

getOrigin()

LogQuery.php:79
function getOrigin(): object|string
returnsobject | stringwhat triggered this operation (an object, or a function/method name).

HasListener($handler)

statictEvent.php:109
static function HasListener(callable|object $handler): bool
$handlercallable | objecteither the exact callable passed to AddListener, or (for a [$obj, $methodName] listener registered via ConnectListeners) just the object, to check whether any of its methods are currently listening
returnsbool
UserCreated::HasListener($handler); // true if $handler is currently registeredUserCreated::HasListener($service); // true if any of $service's methods were connected via #[Listen]

ignore($stop)

LogQuery.php:84

Veto the operation this LogQuery describes. @param bool $stop if true (default), also stop propagation so no later listener sees it.

function ignore(bool $stop = true): void
$stop = truebool
returnsvoid

RemoveListener($handler)

statictEvent.php:91

Remove the last added handler from the listeners.

static function RemoveListener(callable $handler): boolNOTE: if you added the same handler multiple time, you need to call this function the same amount of times.
$handlercallable
returnsbooltrue if a listener was removed

Send($args)

statictEvent.php:143

Construct a new instance of this class with $args, then dispatch it to every listener.

static function Send(mixed ...$args): static
...$argsmixed
returnsstaticthe constructed (and dispatched) event instance
UserCreated::Send('Marc'); // equivalent to (new UserCreated('Marc'))->dispatch()

setEntity($entity)

LogQuery.php:105

Explicitly set the entity this operation targets (bypassing the by-id lookup in getEntity).

function setEntity(?MMO\core\entities\Entity $entity): void
$entitynull | Entity
returnsvoid

SetListenerOrder($handler, $order)

statictEvent.php:75

Change the order of an already-registered listener, whether added directly via AddListener or indirectly via ConnectListeners (which also stores its [$obj, $methodName] callables here).

static function SetListenerOrder(callable $handler, int $order): bool
$handlercallable
$orderint
returnsbooltrue if $handler was found and its order changed
UserCreated::SetListenerOrder($handler, 20); // moves $handler later in the dispatch order

stopPropagation()

tStoppableEvent.php:29

Prevent any remaining listener in the current dispatch chain from being called.

function stopPropagation()
returns

__clone()

tStoppableEvent.php:38

A cloned event starts fresh: propagation is never considered stopped on the clone, even if it was on the original instance.

function __clone()
returns
Inherited members (110)
ConstantsDeclared byDescription
FLAG_CHANGEDiEntity
FLAG_CREATEDiEntity
FLAG_IGNORE_CHANGEiEntity
FLAG_IGNORE_ENTITYiEntity
FLAG_OPACIFYiEntity
FLAG_REMOVEDiEntity
PropertiesDeclared byDescription
ArrayPropertiesaEntity
changesaEntity
collectionEntity
ctimeEntity
errorsaEntity
flagsaEntity
idEntityidentifier in collection
labelEntityshort name
linksaEntity
mtimeEntity
SearchPropertiesaEntity
statusaEntity
titleEntitylong name
MethodsDeclared byDescription
addFlags($flags)aEntity
addLink($link)aEntityAppend a link.
archive()aEntityThis function is called to 'delete' the entity.
ArrayProperties()aEntityBuild (once per class, then cached in the static $ArrayProperties array) the list of every #[ArrayProperty] declared on this class, its parent classes, and the traits they use -- by reflection…
ArrayProperty($name)aEntity
CheckData($data, $errors)aEntityCheck data before it touches any entity: would an entity made from $data be valid?
clearChanges()aEntityReset change tracking: clears iEntity::FLAG_CHANGED and forgets every recorded change.
compareTo($value)aEntityCompare value
conversionError($key, $e)aEntityThe error recorded for a value that could not be set at all (usually: it could not be converted to its property's type), in the same form as a validation error.
Copy($entity, $properties)EntityBuild a new entity from $entity's own stored data (a duplicate, minus its id -- so saving it creates a genuinely new record -- in the same collection).
debugName()aEntity
get($path, $default)aEntityRead a (possibly nested) value by json-path, e.g.
getArrayProperty($key, $isRef, $store)aEntityRead a single array property's current value, through its getter (a direct property, a path alias, or a method).
getChanges($asArray, $store)aEntity
getCollection()Entity
getCtime()Entity
getErrors()aEntity
getFlags()aEntity
getId()Entity
getLabel()Entity
getLinks()aEntity
getLinksByRel($rels, $all)aEntityGet a list of Reference that have a specific relationship.
getMetadata()aEntity
getMtime()Entity
getRepository()Entity
getStatus()aEntity
getTitle()Entity
getView()aEntity
hasChanged($keys)aEntity
hasFlags($flags, $strict)aEntity
hasStatusChanged()aEntity
HiddenPath($path)aEntityThe hidden property (ArrayProperty::isHidden) a json-path goes through, known from the declared types alone: of this class, or of a class a property on the way may hold -- every class of its t…
ignoreChanges($value)aEntityTemporarily suppress markChanged (used e.g.
isActive()aEntity
isArchive()aEntity
isArrayPropertySet($key, $store)EntitySame as aEntity::isArrayPropertySet, but 'ctime'/'mtime' are never reported as "set" (they're always present, so listing them adds no information), and neither is 'id' once the entity is alrea…
isChanged()aEntity
isCreated()aEntity
isDraft()aEntity
isEmpty()aEntity
isFinal()aEntity
isHiddenPath($path)aEntity
isIgnored()Entity
isOpacified()aEntity
isPending()aEntity
isRemoved()aEntity
isSimilar($value)Entity
isUnique()aEntityTells if an entity has enough information to be unique (at least one unique group has no null)
isValid()aEntity
isValidated()aEntity
ListClassReferences($onlyStorable)aEntityGet a list of all the classes and their properties that are using references to this class.
loadArray($data, $coerceOptions, $fromStore)aEntitySet every entry of $data as an array property, through setArrayProperty (so each value is coerced by its property's schema).
loadFromStore($data)EntityRestore from stored data, setting 'ctime'/'mtime' directly (bypassing their normal setters -- see setCtime/setMtime, which are read-only via #[ArrayProperty]).
localName()Entity
loopReferences()EntityYield all the entities in the repository that have a reference on this one.
markChanged($keys)EntitySame as aEntity::markChanged, also bumping $mtime to now -- unless the change itself was to 'ctime'/'mtime' (avoiding infinite recursion via setMtime's own markChanged call).
mutate($type, $path, $value, $oldValue)aEntity\MMO\core\interfaces\iMutationObserver::mutate -- besides the normal tArrayProperties::mutate behavior, walks up $path to find the nearest enclosing aEntity (the mutation may have happened dee…
offsetExists($key)aEntity\ArrayAccess::offsetExists -- tells whether $key is a *declared* #[ArrayProperty], not whether it currently holds a non-default value (use isArrayPropertySet for that).
offsetGet($key)aEntity\ArrayAccess::offsetGet
offsetSet($key, $value)aEntity\ArrayAccess::offsetSet
offsetUnset($key)aEntity\ArrayAccess::offsetUnset -- equivalent to setting the property to null (its coerced value depends on the property's schema: e.g.
opacify($value)aEntityHide this entity's properties from toArray output (typically used to redact an entity the current viewer isn't allowed to see the details of, while still letting it be referenced by uid/metadata).
push($path, $value)aEntityAppend a value to a (possibly nested) list property by json-path.
reload()EntityReload entity from its repository
removeFlags($flags)aEntity
removeLink($link)aEntityRemove a link (by identity).
removePermanently($force)EntityRemove entity from database
replaceBy($replace, $mergeData)EntityReplace this entity by another one, trying to change all references to this entity to the new one.
Schema()aEntityThe JSON-Schema describing every #[ArrayProperty] of this class (built once and cached by ArrayProperties).
SearchProperty($name)aEntity
set($path, $value)aEntityWrite a (possibly nested) value by json-path, creating intermediate structure as needed.
setArrayProperty($key, $value, $coerceOptions, $ignoreReadonly)aEntitySame as tArrayProperties::setArrayProperty, plus: any coercion/validation failure is caught and recorded in getErrors (making the entity isValid()-false) instead of propagating as an…
setArrayPropertyOffset($key, $offset, $value, $coerceOptions)aEntitySame as tArrayProperties::setArrayPropertyOffset, plus: when pushing (offset === null) a new entity onto a list property, if an existing item is isSimilar to the new value, that item's of…
setCollection($collection, $removeFromCollection)EntityMove this entity to (or out of, if null) a collection.
setCtime($date, $force)EntitySet creation time
setId($id)EntitySet the id, re-registering this entity in its $collection under the new id (Collection's entities are keyed by id).
setLinks($links)aEntityReplace every link with $links.
setMtime($date, $force)EntitySet modification time
setStatus($status)aEntity
store()aEntityExport all array properties with store set to true.
test($filter)aEntity
toArray($fields, $flatten, $recursive)aEntitySame as tArrayProperties::toArray, except an isOpacified entity always exports only its 'uid' and 'metadata' (its other properties are hidden from output).
toLink($attributes)aEntity
traitMutate($type, $path, $value, $oldValue)aEntity\MMO\core\interfaces\iMutationObserver::mutate -- reacts to a mutation that happened deep inside one of this object's array properties (e.g.
traitSetArrayProperty($key, $value, $coerceOptions, $fromStore)aEntitySet array property
traitSetArrayPropertyOffset($key, $offset, $value, $coerceOptions)aEntitySet/push a value into an array property
traitToArray($fields, $flatten, $recursive)aEntityExport fields to an array.
uid()Entity
validate($errors)aEntityValidate this entity: its current values against its own tArrayProperties::Schema, plus every value that could not even be set -- one that could not be converted to its property's type never r…
View()aEntity
__construct($data, $collection)Entity