sitegeist/rollup

安装: 1

依赖: 0

建议者: 0

安全性: 0

星标: 0

关注者: 3

分支: 0

开放问题: 0

类型:neos-package

v2.0.0 2022-05-03 18:06 UTC

This package is auto-updated.

Last update: 2024-08-30 01:32:32 UTC


README

将融合原型实例化为PHP对象。

作者与赞助商

此包的开发和公共发布得到了我们雇主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请求。