EntityBehaviorBuilder
in package
Tags
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
$commandHandler
public
Closure
$commandHandler
$connectionRelease
public
Closure|null
$connectionRelease
= null
$connectionSource
public
Closure|null
$connectionSource
= null
$emFactory
public
EntityManagerFactory|null
$emFactory
= null
$entityClass
public
string
$entityClass
$id
public
mixed
$id
$lockMode
public
LockMode|null
$lockMode
= null
$receiveTimeout
public
Duration|null
$receiveTimeout
= null
$replayPolicy
public
EntityReplayPolicy
$replayPolicy
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.
toBehavior()
public
toBehavior() : Behavior
Return values
BehaviorwithConnectionLifecycle()
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
selfwithConnectionSource()
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
selfwithDirectConnection()
public
withDirectConnection(array<string, mixed> $params) : self
Parameters
- $params : array<string, mixed>
Tags
Return values
selfwithEntityManagerFactory()
public
withEntityManagerFactory(EntityManagerFactory $factory) : self
Parameters
- $factory : EntityManagerFactory
Return values
selfwithLockMode()
public
withLockMode(LockMode $mode) : self
Parameters
- $mode : LockMode
Return values
selfwithReceiveTimeout()
public
withReceiveTimeout(Duration $timeout) : self
Parameters
- $timeout : Duration
Return values
selfwithReplayPolicy()
public
withReplayPolicy(EntityReplayPolicy $policy) : self
Parameters
- $policy : EntityReplayPolicy