tbn/apigenerator-bundle

此包已被弃用且不再维护。未建议替代包。
关于此包的最新版本(dev-master)没有可用的许可证信息。

直接获取ajax crud api

dev-master 2021-01-26 14:51 UTC

This package is auto-updated.

Last update: 2024-02-26 21:22:08 UTC


README

此捆绑包不再维护,如果您正在寻找开箱即用的API,请检查https://github.com/api-platform/api-platform

安装

	composer require "tbn/apigenerator-bundle"

在开发环境中启用AppKernel中的捆绑包

	...
	new tbn\ApiGeneratorBundle\ApiGeneratorBundle();
   ...

添加路由

	tbn_api_generator:
	    resource: "@ApiGeneratorBundle/Resources/config/routing.yml"

为开发环境添加路由

	tbn_api_generator_dev:
	    resource: "@ApiGeneratorBundle/Resources/config/routing_dev.yml"

配置

	api_generator:
	    default: #The default behaviour for all entities
	        create: false #optionnal
	        update: false #optionnal
	        delete: false #optionnal
	        get_one: false      #optionnal #get one entity (only foreign keys are sent)
	        get_one_deep: false #optionnal #get one entity but the foreign entities are completed normalized too
	        get_all: false      #optionnal #get all entities
	        get_all_deep: false #optionnal #get all entities but the foreign entities are completed normalized too
	    entity:  #Specify the rights for specific entities
                    user: #the entity alias
                        class: "FrontBundle\\Entity\\SomeEntity" #mandatory
	            create: true  #optionnal
	            update: false #optionnal
	            delete: true  #optionnal
	            get_one: true #optionnal
	            get_one_deep: true #optionnal
	            get_all: true #optionnal
	            get_all_deep: true #optionnal

用法

访问URL

	htpp://your_app/_apigenerator-configuration

它显示与Api Generator关联的实体和权限

待办事项

持久化OneToMany集合

删除实体