eventsourced / valueobjects-transpiler
值对象的代码生成器
dev-master
2016-07-29 08:28 UTC
Requires
- eventsourced/valueobjects: dev-master
- league/flysystem-memory: ^1.0
- league/plates: ^3.1
- symfony/yaml: ^3.1
Requires (Dev)
- phpunit/phpunit: 5.2.1
This package is not auto-updated.
Last update: 2024-09-14 19:36:42 UTC
README
一个命令行工具,根据Yaml配置文件生成ValueObjects、实体、命令和事件的PHP类。
配置文件
以下是一个示例配置文件
# ValueObjects value\Integer: is intVal value\Quantity: is intval and between 1, 20 value\Range: min: value\Integer max: value\Integer # Collections value\Products: contains entity\Product # Entites entity\User: id: value\Id name: value\Name entity\Product: id: value\Id product_id: value\ProductId quantity: value\Quantity # Commands command\CreateUser: id: value\Id user: entity\User # Events event\ProductCreated: id: value\Id product: entity\Product quantity: value\Quantity
配置文件的位置
将配置文件放在应包含生成的代码的文件夹中。
命名空间
脚本将根据文件夹结构确定命名空间(符合PSR0规范)。如果您将根设置为"/home/project/",并且在该根目录下发现一个名为"/home/project/cart/values/vos.yaml"的配置文件,那么它将命名空间设置为"
生成
要生成代码,只需在控制台中调用以下命令。
php generate.php [path_of_your_project_root]
系统将扫描该文件夹及其所有子文件夹中的任何vos.yaml文件。