uxf/form 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

uxf/form

最新稳定版本:3.79.0

Composer 安装命令:

composer require uxf/form

包简介

README 文档

README

Symfony Form bundle

Install

$ composer require uxf/form

Config

// config/routes/uxf.php
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;

return static function (RoutingConfigurator $routingConfigurator): void {
    $routingConfigurator->import('@UXFFormBundle/config/routes.php');
};

Service

// config/packages/uxf.php
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;

return static function (ContainerConfigurator $config): void {
    $config->extension('uxf_form', [
        'gen' => [
            'schema_with_hidden_fields' => true, // default false
            'areas' => [
                'admin' => [
                    'allowed' => '/^(admin|test)/', // optional
                    'disabled' => '/^(private|hello)/', // optional
                    'destination' => __DIR__ . '/../../../backoffice/src/generated/form-schema',
                ],
            ],
        ],
    ]);
};

Usage

OneToMany must have indexBy="id" and child entity must have property named $parent in constructor.

Events

FormEntityEditedEvent

use Symfony\Component\EventDispatcher\Attribute\AsEventListener;
use UXF\Core\Exception\BasicException;
use UXF\Form\Event\FormEntityEditedEvent;

#[AsEventListener]
final readonly class FormEntityEditedEventListener
{
    public function __invoke(FormEntityEditedEvent $event): void
    {
        // do something with $event->entity and $event->new
    }
}

FormEntityErrorEvent

use Symfony\Component\EventDispatcher\Attribute\AsEventListener;
use UXF\Core\Exception\BasicException;
use UXF\Form\Event\FormEntityErrorEvent;

#[AsEventListener]
final readonly class FormEntityErrorEventListener
{
    public function __invoke(FormEntityErrorEvent $event): void
    {
        // custom exception
        if ($event->entity instanceof Small && $event->error instanceof ORMException) {
            $event->error = BasicException::badRequest('awesome');
        }
    }
}

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-01-12

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固