atomatis/ofm
Composer 安装命令:
composer require atomatis/ofm
包简介
Object file mapper
关键字:
README 文档
README
Object file manipulator inspired by doctrine/ORM package
Warning. I write this for personal use. Documentation is really poor. If you are interested for use this package, contact me at alexandre.tomatis@gmail.com for get better documentation.
Installation
composer req atomatis/OFM
Usage
Create entity
Example with yaml file
<?php declare(strict_types=1); namespace App\Entity; use Atomatis\OFM as OFM; #[OFM\Entity(OFM\Entity::TYPE_YAML)] final class Configuration { #[OFM\Parameter] private ?string $foo; #[OFM\Parameter] private ?array $bar; ... // getter/setter ...
Configuration
// init registry with Entity file path. $registry = new Registry(); $registry->addFile(Configuration::class, (new RegistryConfiguration())->setPath('my/file/path/configuration.yaml')); $entityManager = new EntityManager($registry);
Load file
# my/file/path/configuration.yaml foo: 'hello here'
$configuration = $entityManager->load(Configuration::class); $configuration->getFoo(); // return 'hello here' $configuration->getBar(); // return null
Flush file
# my/file/path/configuration.yaml foo: 'hello here'
$configuration = $entityManager->load(Configuration::class); $configuration->setFoo('see you later'); $entityManager->flush($configuration);
# my/file/path/configuration.yaml foo: 'see you later'
统计信息
- 总下载量: 7
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2022-05-11