Nexus API Reference

EntityBehaviorBuilder
in package

Read onlyYes
FinalYes
Tags
template

T of object

template

C of object

psalm-api

Table of Contents

Properties

$commandHandler  : Closure
$connectionRelease  : Closure|null
$connectionSource  : Closure|null
$emFactory  : EntityManagerFactory|null
$entityClass  : string
$id  : mixed
$lockMode  : LockMode|null
$receiveTimeout  : Duration|null
$replayPolicy  : EntityReplayPolicy

Methods

__construct()  : mixed
toBehavior()  : Behavior
withConnectionLifecycle()  : self
Pool-backed mode: the runner acquires via `$acquire`, hands off, and calls `$release($conn)` on PostStop instead of `close()`. Use this when the connection comes from a `ConnectionPool` so the slot is returned to the pool when the actor passivates.
withConnectionSource()  : self
Dedicated-connection mode: the runner takes ownership of the connection returned by `$source` and `close()`s it on PostStop. Use this when the source creates a fresh connection (e.g. `DriverManager::getConnection`).
withDirectConnection()  : self
withEntityManagerFactory()  : self
withLockMode()  : self
withReceiveTimeout()  : self
withReplayPolicy()  : self

Properties

Methods

__construct()

public __construct(T> $entityClass, mixed $id, callable(ActorContext<string|int, C>, C, T): EntityEffect<string|int, T$commandHandler[, EntityManagerFactory|null $emFactory = null ][, EntityReplayPolicy|null $replayPolicy = null ][, LockMode|null $lockMode = null ][, callable(): Connection|null $connectionSource = null ][, Duration|null $receiveTimeout = null ][, callable(Connection): void|null $connectionRelease = null ]) : mixed
Parameters
$entityClass : T>
$id : mixed
$commandHandler : callable(ActorContext<string|int, C>, C, T): EntityEffect<string|int, T>
$emFactory : EntityManagerFactory|null = null
$replayPolicy : EntityReplayPolicy|null = null
$lockMode : LockMode|null = null
$connectionSource : callable(): Connection|null = null
$receiveTimeout : Duration|null = null
$connectionRelease : callable(Connection): void|null = null

Optional release hook invoked on PostStop. When null the runner falls back to $connection->close() (dedicated-connection mode). Pass a release callback when the connection comes from an external pool, so the slot is returned instead of permanently consumed.

withConnectionLifecycle()

Pool-backed mode: the runner acquires via `$acquire`, hands off, and calls `$release($conn)` on PostStop instead of `close()`. Use this when the connection comes from a `ConnectionPool` so the slot is returned to the pool when the actor passivates.

public withConnectionLifecycle(callable(): Connection $acquire, callable(Connection): void $release) : self
Parameters
$acquire : callable(): Connection
$release : callable(Connection): void
Return values
self

withConnectionSource()

Dedicated-connection mode: the runner takes ownership of the connection returned by `$source` and `close()`s it on PostStop. Use this when the source creates a fresh connection (e.g. `DriverManager::getConnection`).

public withConnectionSource(callable(): Connection $source) : self

For pool-backed connections use self::withConnectionLifecycle() so the slot is released instead of closed.

Parameters
$source : callable(): Connection
Return values
self

withDirectConnection()

public withDirectConnection(array<string, mixed> $params) : self
Parameters
$params : array<string, mixed>
Tags
psalm-suppress

ArgumentTypeCoercion

Return values
self

withLockMode()

public withLockMode(LockMode $mode) : self
Parameters
$mode : LockMode
Return values
self

        
On this page

Search results