value = $value; } public function getValue(): string { return $this->value; } } /** * Main class of your application. */ final class Application { use DbAutoProperties; /** * This field is automatically connected to the database using the specified Settings. * * @var DbArray */ #[OrmMappedArray(KeyType::STRING, ValueType::OBJECT)] private DbArray $dbProperty1; /** * This field is automatically connected to the database using the specified Settings. * * @var DbArray */ #[OrmMappedArray(KeyType::STRING, ValueType::INT)] private DbArray $dbProperty2; public function __construct( Settings $settings, string $tablePrefix ) { $this->initDbProperties($settings, $tablePrefix); } public function businessLogic(): void { $this->dbProperty1['someOtherKey'] = new MyObject("initialValue"); // Can store integers, strings, arrays or objects depending on the specified ValueType $this->dbProperty2['someKey'] = 123; var_dump($this->dbProperty2['someKey']); } public function businessLogic2(string $value): void { $obj = $this->dbProperty1['someOtherKey']; $obj->setValue($value); $obj->save(); } public function businessLogic3(): string { return $this->dbProperty1['someOtherKey']->getValue(); } public function shutdown(): void { // Flush all database caches, saving all changes. $this->saveDbProperties(); } } $app = new Application($settings, 'tablePrefix'); $app->businessLogic(); $app->businessLogic2("newValue"); var_dump($app->businessLogic3()); $app->shutdown();