bdunogier/ez-fieldtype-generator-bundle

dev-master 2017-04-27 10:45 UTC

This package is auto-updated.

Last update: 2024-09-19 11:21:49 UTC


README

状态

这是一个概念验证/原型。它生成一个 Type 和一个 Value 类,以及一个 fieldtypes.yml 文件来注册字段类型,但类名、命名空间等仍然不正确。

安装

由于该包尚未在 packagist 上注册,您需要向 \ composer.json 文件中添加一个 VCS 条目

将 ezobject/wrapperbundle 包添加到您的 composer.json 文件中

{
    "repositories": [
        { "type": "vcs", "url": "https://github.com/bdunogier/ez-fieldtype-generator-bundle.git" }
    ],
    "require": {
        "bdunogier": "dev-master"
    }
}

BDEzFieldTypeGeneratorBundle 添加到 EzPublishKernel.php

$bundles = array(
    // ...
    new BD\EzFieldTypeGeneratorBundle\BDEzFieldTypeGeneratorBundle(),
);

用法

php ezpublish/console generate:ez:fieldtype

当询问包名时,使用现有的包。如果您没有,请首先使用 generate:bundle 命令生成。

然后脚本将询问字段类型的名称,这实际上是字段类型的标识符。

确认生成,然后文件将被写入到包中

$ php app/console generate:ez:fieldtype

  Welcome to the eZ FieldType generator

Your FieldType must be created in a bundle.

If you don't have a bundle for it, please create one using generate:bundle first
Target bundle name: BDTestBundle

A FieldType requires a unique identifier.
Identifiers can contain alphanumeric characters as well as underscores

FieldType name: bdtest

  Summary before generation


You are going to generate a "bdtest" FieldType in the "BDTestBundle" bundle.

Do you confirm generation [yes]?
Generating the FieldType code: OK