定制 popo/symfony-bridge 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

popo/symfony-bridge

最新稳定版本:1.0.1

Composer 安装命令:

composer require popo/symfony-bridge

包简介

Symfony bundle for POPO generator

README 文档

README

Build and run tests

Symfony bundle for POPO Generator.

Installation

composer require popo/symfony-bridge --dev

Setup

Create config/packages/popo.yaml, and setup location of POPO schema files (e.g. config/packages/popo).

Simple version

# config/packages/popo.yaml
popo:
  config:
    - schemaPath: config/packages/popo

Full version

schemaPath is required, all other options can be overwritten.

# config/packages/popo.yaml
# schemaPath is required, other options can be defined in POPO schema file
popo:
  default:
    # namespace: ExampleVendor\App\Example
    outputPath: tests
    namespaceRoot: ExampleVendor\
    schemaPathFilter: # e.g. bundles
    schemaConfigFilename: # e.g. bundles/project.config.yml
    ignoreNonExistingSchemaFolder: false
    schemaFilenameMask: '*.popo.yaml'
    classPluginCollection: []
    mappingPolicyPluginCollection: []
    namespacePluginCollection: []
    phpFilePluginCollection: []
    propertyPluginCollection: []

  config:
    # customer, settings here overwrite the default values
    - schemaPath: config/packages/popo/customer.popo.yaml

    # order, settings here overwrite the default values
    - schemaPath: config/packages/popo/order.popo.yaml

    # product, settings here overwrite the default values
    - schemaPath: config/packages/popo/product.popo.yaml

    # or simply load all at once
    - schemaPath: config/packages/popo

Usage

bin/console popo:generate
Generating POPO files...
Customer:ExampleVendor\App\Customer\Customer -> tests/App/Customer/Customer.php
Order:ExampleVendor\App\Order\Order -> tests/App/Order/Order.php
Order:ExampleVendor\App\Order\OrderItem -> tests/App/Order/OrderItem.php
Product:ExampleVendor\App\Product\Product -> tests/App/Product/Product.php
All done.

See POPO Documentation for more options.

Extending generated classes with custom logic

Adding custom logic to generated POPO classes is easy with plugins. For example to add helloWorld method:

# config/packages/popo.yaml
popo:
  default:
      classPluginCollection:
      - \PopoBundle\Plugin\HelloWorldPopoPlugin

HelloWorld plugin:

class HelloWorldPopoPlugin implements ClassPluginInterface
{
    public function run(BuilderPluginInterface $builder): void
    {
        $builder->getClass()
            ->addMethod('helloWorld')
            ->setReturnType('string')
            ->setBody('return "Hello World";');
    }
}

Generated code:

public function helloWorld(): string
{
    return "Hello World";
}

See POPO Plugins Documentation for more info.

统计信息

  • 总下载量: 3
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-08-01

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固