$this->bga->itemManagerFactory
Create an ItemManager that persists instances of one of your PHP item classes.
API
createItemManager(string $className, ?callable $classNameResolver = null, array $locations = [], ?callable $dbUpdateCallback = null, ?callable $countChangeCallback = null): ItemManager
$className: an item class with#[Item]and persisted properties marked with#[ItemField].$classNameResolver: an optional function receiving a database row, ornull, and returning the class to instantiate, ornullto use the base class.$locations: an array ofItemLocationdefinitions to register immediately.$dbUpdateCallback: an optional callback receiving the table name, inserted or updated rows keyed by item ID, and the operation (INSERTorUPDATE).$countChangeCallback: an optional callback receiving the table name and changed location counts, keyed by encoded location.
Example
After defining your Card class, create its manager in the Game constructor:
Declare the manager property on Game, register locations, and initialize its database table during game setup. See ItemManager for item attributes, location definitions, callbacks, and a complete example.