flexix/prototype-controller-bundle

Symfony Flexix 组件包

安装: 71

依赖者: 0

建议者: 0

安全: 0

星标: 0

关注者: 3

分支: 1

开放问题: 0

类型:symfony-bundle

v1.4 2018-07-12 09:50 UTC

This package is not auto-updated.

Last update: 2024-09-27 12:01:42 UTC


README

我们仍在努力工作! (太难了 :))

Flexix\PrototypeControllerBundle

由 Mariusz Piela mariusz.piela@tmsolution.pl

安装

要安装组件包,请在您的项目 composer.json 文件中添加

//composer require

"flexix/prototype-controller-bundle": "dev-master"

之后,在应用的内核中启用您的组件包

<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new FOS\RestBundle\FOSRestBundle(),
        new JMS\SerializerBundle\JMSSerializerBundle(),
        new Flexix\MapperBundle\FlexixMapperBundle(),
        new Flexix\PrototypeControllerBundle\FlexixPrototypeControllerBundle()
    );
}

创建 Controller 的配置

  1. 创建配置
 parameters:    
    some_controller.config: 
        #for all actions
        base:
            allowed: true # you can put array with values xhttp or subrequest
            models:
                 get:
                        name: 'some.service.name'
                        method: someMethod
   
        actions: 
        #for 'new' action
            new:
               templates:
                    widget: 'some_template.html.twig'
               models:
                    create:
                        name: 'some.service.name'
                        method: someMethod
               form: 
                   action: new 
                   form_type: 'Some\FormTypeClass'
               redirection: 
                    route_name: filter #route name
        #for 'list' action            
            list:
                allowed: #only xhttp and subrequest possible
                        - xhttp
                        - subrequest
                templates:
                    widget: 'some_template.html.twig' 
                models:
                    list:
                        name: 'some.service.name'
                        method: someMethod
                form: 
                   form_type: 'Some\FormTypeClass'
                   action: list
                   method: GET
                adapter: 'some.adapter.service'
        #and so on ....          
  1. 创建服务
services:
        some_service_name:
            class: Flexix\ConfigurationBundle\Util\Configuration
            arguments: [%some_controller.config%]
            tags:
                - { name: flexix_prototype_controller.controller_configuration, applicationPath: 'some/path', entity_alias: 'entity-alias' }       

更多信息请参阅:如何开始