rodchyn / amf-bundle
此包的最新版本(dev-master)没有提供许可证信息。
Rodchyn AMFBundle
dev-master
2012-07-16 20:03 UTC
Requires
- symfony/framework-bundle: 2.1.*
- zendframework/zend-amf: 2.0.*
This package is auto-updated.
Last update: 2024-08-29 03:20:53 UTC
README
======== 概述
此扩展包允许您在Symfony2框架中使用AMF。主要功能包括
- 处理传入的AMF请求并将其路由到已配置的服务。
- 使用JMSSerializerBundle序列化器将类转换为虚拟对象
安装
检出代码副本:
git submodule add https://github.com/tecbot/AMFBundle.git src/Tecbot/AMFBundle
然后注册扩展包到您的内核
// in AppKernel::registerBundles()
$bundles = array(
// ...
new JMS\AMFBundle\TecbotAMFBundle(),
// ...
);
请确保您还注册了命名空间到自动加载器
// app/autoload.php
$loader->registerNamespaces(array(
// ...
'Tecbot' => __DIR__.'/../vendor/bundles',
// ...
));
注意:序列化器需要JMSSerializerBundle。
配置
以下是默认配置,除非它不符合您的需求,否则您不需要更改它
tecbot_amf:
use_serialization: false
使用方法
- 所有映射的服务都必须添加到您包中的 "Amf" 文件夹(例如 Foo\BarBundle\Amf\FooService)。
- 您希望从Amf访问的所有公共方法都需要像控制器一样带有 "Action" 后缀。
配置服务和类映射
tecbot_amf:
services: # Services
FooService: FooBarBundle:Foo # Map FooService (Actionscript alias) to Foo\BarBundle\Amf\Foo class
mapping: # Class mapping. Map FooClassVO (Actionscript alias) to Foo\BarBundle\VO\FooClassVO
FooClassVO: Foo\BarBundle\VO\FooClassVO
将路由添加到网关控制器
# path is "/gateway"
_tecbot_amf:
resource: "@TecbotAMFBundle/Resources/config/routing.yml"
# or when you want a another path
amf:
pattern: /amf
defaults: { _controller: tecbot_amf.controller.gateway:gatewayAction }