sitegeist / rollup
v2.0.0
2022-05-03 18:06 UTC
Requires
- php: > 8.0
- neos/fusion: ~7.0 || ~8.0 || dev-master
This package is auto-updated.
Last update: 2024-08-30 01:32:32 UTC
README
将融合原型实例化为PHP对象。
作者与赞助商
- Martin Ficzel - ficzel@sitegeist.de
- Bernhard Schmitt - schmitt@sitegeist.de
此包的开发和公共发布得到了我们雇主http://www.sitegeist.de的慷慨赞助。
用法
以下php对象
<?php
declare(strict_types=1);
namespace Vendor\Example;
use Neos\Flow\Annotations as Flow;
#[Flow\Proxy(false)]
class Thing
{
public function __construct(
public string $foo,
public int $bar
) {}
}
可以通过Fusion进行实例化。如果没有定义factoryMethod
,则将参数传递给类的构造函数。
thing = Sitegeist.Rollup:Object {
className = 'Vendor\\Example\\Thing'
arguments {
foo = 'hello'
bar = 124
}
}
要实例化值对象或枚举,也可以指定factoryMethod
。
other = Sitegeist.Rollup:Object {
className = 'Vendor\\Example\\Thing'
factoryMethod = 'from'
arguments.0 = "XS"
}
stuff = Sitegeist.Rollup:Object {
className = 'Vendor\\Example\\SizeEnum'
factoryMethod = 'fromArray'
arguments.0 = Neos.Fusion:DataStructure {
foo = 'hello'
bar = 124
}
}
贡献
我们乐于接受贡献。请发送给我们pull请求。