當前位置: 首頁>>代碼示例>>PHP>>正文


PHP TypeLoader::setMapping方法代碼示例

本文整理匯總了PHP中Zend\Amf\Parser\TypeLoader::setMapping方法的典型用法代碼示例。如果您正苦於以下問題:PHP TypeLoader::setMapping方法的具體用法?PHP TypeLoader::setMapping怎麽用?PHP TypeLoader::setMapping使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Zend\Amf\Parser\TypeLoader的用法示例。


在下文中一共展示了TypeLoader::setMapping方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: __construct

 /**
  * Constructor
  *
  * @param EventDispatcherInterface    $dispatcher An EventDispatcherInterface instance
  * @param ContainerInterface          $container  A ContainerInterface instance
  * @param ControllerResolverInterface $resolver   A ControllerResolverInterface instance
  * @param Boolean                     $debug      Debug mode
  * @param array                       $mappings   An array of mapped classes
  */
 public function __construct(EventDispatcherInterface $dispatcher, ContainerInterface $container, ServiceResolverInterface $resolver, $debug = false, array $mappings = array())
 {
     $this->dispatcher = $dispatcher;
     $this->container = $container;
     $this->resolver = $resolver;
     $this->debug = $debug;
     foreach ($mappings as $alias => $mapping) {
         TypeLoader::setMapping($alias, $mapping['class']);
     }
 }
開發者ID:rodchyn,項目名稱:AMFBundle,代碼行數:19,代碼來源:Server.php

示例2: testPhpObjectSerializedToAmf0TypedObjectClassMap

 public function testPhpObjectSerializedToAmf0TypedObjectClassMap()
 {
     Parser\TypeLoader::setMapping("ContactVO", "Contact");
     $data = array();
     $contact = new TestAsset\Contact();
     $contact->id = '15';
     $contact->firstname = 'Joe';
     $contact->lastname = 'Smith';
     $contact->email = 'jsmith@adobe.com';
     $contact->mobile = '123-456-7890';
     unset($contact->_explicitType);
     array_push($data, $contact);
     $contact = new TestAsset\Contact();
     $contact->id = '23';
     $contact->firstname = 'Adobe';
     $contact->lastname = 'Flex';
     $contact->email = 'was@here.com';
     $contact->mobile = '123-456-7890';
     unset($contact->_explicitType);
     array_push($data, $contact);
     $newBody = new Value\MessageBody('/1/onResult', null, $data);
     $this->_response->setObjectEncoding(0x0);
     $this->_response->addAmfBody($newBody);
     $this->_response->finalize();
     $testResponse = $this->_response->getResponse();
     // Load the expected response.
     $mockResponse = file_get_contents(__DIR__ . '/TestAsset/Response/typedObjectAmf0Response.bin');
     // Check that the response matches the expected serialized value
     $this->assertEquals($mockResponse, $testResponse);
 }
開發者ID:stunti,項目名稱:zf2,代碼行數:30,代碼來源:ResponseTest.php

示例3: testAmf0TypedObjecDeserializedToNativePHPObject

 public function testAmf0TypedObjecDeserializedToNativePHPObject()
 {
     Parser\TypeLoader::setMapping("ContactVO", "ZendTest\\AMF\\TestAsset\\Contact");
     $myRequest = file_get_contents(__DIR__ . '/TestAsset/Request/mock/typedObjectAmf0Request.bin');
     // send the mock object request to be deserialized
     $this->_request->initialize($myRequest);
     // Make sure that no headers where recieved
     $this->assertEquals(0, sizeof($this->_request->getAmfHeaders()));
     // Make sure that the message body was set after deserialization
     $this->assertEquals(1, sizeof($this->_request->getAmfBodies()));
     $bodies = $this->_request->getAmfBodies();
     $this->assertTrue($bodies[0] instanceof Value\MessageBody);
     $data = $bodies[0]->getData();
     // Make sure that we are dealing with a PHP simpleXml element
     $this->assertTrue($data[0] instanceof TestAsset\Contact);
     // Make sure that the xml was deserialized properly and check its value
     $this->assertEquals('arnold', (string) $data[0]->lastname);
 }
開發者ID:stunti,項目名稱:zf2,代碼行數:18,代碼來源:RequestTest.php

示例4: setClassMap

 /**
  * Map ActionScript classes to PHP classes
  *
  * @param  string $asClass
  * @param  string $phpClass
  * @return Server
  */
 public function setClassMap($asClass, $phpClass)
 {
     Parser\TypeLoader::setMapping($asClass, $phpClass);
     return $this;
 }
開發者ID:necrogami,項目名稱:zf2,代碼行數:12,代碼來源:Server.php

示例5: testSetMappingClass

 /**
  * Test that adding our own mappping will result in it being added to the classMap
  *
  */
 public function testSetMappingClass()
 {
     Parser\TypeLoader::setMapping('com.example.vo.Contact', 'ZendTest\\Amf\\TestAsset\\Contact');
     $class = Parser\TypeLoader::getMappedClassName('com.example.vo.Contact');
     $this->assertEquals('ZendTest\\Amf\\TestAsset\\Contact', $class);
 }
開發者ID:alab1001101,項目名稱:zf2,代碼行數:10,代碼來源:TypeLoaderTest.php


注:本文中的Zend\Amf\Parser\TypeLoader::setMapping方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。