Development

Changeset 11157

You must first sign up to be able to contribute.

Changeset 11157

Show
Ignore:
Timestamp:
08/26/08 11:48:15 (5 years ago)
Author:
thaberkern
Message:

Adding the AmfReturnType? annotation

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plugins/sfAmfPlugin/README

    r11154 r11157  
    105105------- 
    106106 * Annotations for authorization 
     107 * Support for ArrayCollections 
     108 * Support for ByteArrays (i.e. for images) 
     109 * Added Configuration-File support for the service folder 
    107110  
    108111I like to hear from you! Maybe you have an idea how to enhance the plugin. Just send me an email!  
     
    110113Changelog 
    111114-------- 
    112  * 1.0.0 (08-??-2008) 
     115 * 1.1.0 (08-??-2008) 
     116  * Added support for ArrayCollections 
     117  * Added support for ByteArrays 
     118    
     119 * 1.0.0 (08-26-2008) 
    113120  * Added support for the annotations @AmfIgnore and @AmfClassMapping 
    114   * Added Configuration-File support for the service folder 
    115121  * Updated Documentation 
    116122 * 0.9.4 (08-25-2008) 
  • plugins/sfAmfPlugin/lib/sfAmfService.php

    r11152 r11157  
    2020        // getting the annotation information for this method 
    2121        $method_reflector = new ReflectionAnnotatedMethod($class_name, $method->name); 
     22         
    2223        if ($method_reflector->hasAnnotation('AmfClassMapping')) { 
    2324          $as_class_name = $method_reflector->getAnnotation('AmfClassMapping')->name;          
     
    2728        if ($method_reflector->hasAnnotation('AmfIgnore')) { 
    2829          $this->method_info[$method->name]['ignore'] = 1; 
     30        } 
     31         
     32        if ($method_reflector->hasAnnotation('AmfReturnType')) { 
     33          $type = $method_reflector->getAnnotation('AmfReturnType')->value; 
     34           
     35          // At the moment we can use ByteArray and ArrayCollection as  
     36          // types 
     37          if ($type == 'ArrayCollection' || $type == 'ByteArray') { 
     38            $this->method_info[$method->name]['return_type'] = $type; 
     39          } 
     40          else { 
     41            throw new Exception('AmfReturnType can only be one of the following values: '. 
     42                      'ByteArray, ArrayCollection'); 
     43          } 
    2944        } 
    3045      } 
     
    6378        } 
    6479      } 
     80      else if (array_key_exists('return_type', $this->method_info[$method_name])) { 
     81        switch ($this->method_info[$method_name]['return_type']) { 
     82          case 'ArrayCollection': 
     83              return new SabreAMF_ArrayCollection($data); 
     84              break; 
     85          case 'ByteArray': 
     86              return new SabreAMF_ByteArray($data); 
     87              break; 
     88        } 
     89      } 
    6590    } 
    6691     
  • plugins/sfAmfPlugin/package.xml

    r11146 r11157  
    1111  <active>yes</active> 
    1212 </lead> 
    13  <date>2008-08-25</date> 
     13 <date>2008-08-26</date> 
    1414 <time>15:22:10</time> 
    1515  <version> 
    16     <release>0.9.4</release> 
     16    <release>1.0.0</release> 
    1717    <api>1.1.0</api> 
    1818  </version> 
    1919  <stability> 
    20     <release>beta</release> 
     20    <release>stable</release> 
    2121    <api>stable</api> 
    2222 </stability> 
     
    3333     <file role="data"  name="sfAdapterBase.php"/> 
    3434    </dir> <!-- /lib/adapter --> 
     35  <dir name="addendum"> 
     36     <dir name="annotations"> 
     37      <dir name="tests"> 
     38       <file role="data" name="acceptance_test.php"/> 
     39       <file role="data" name="all_tests.php"/> 
     40       <file role="data" name="annotation_parser_test.php"/> 
     41       <file role="data" name="annotation_test.php"/> 
     42       <file role="data" name="constrained_annotation_test.php"/> 
     43       <file role="data" name="doc_comment_test.php"/> 
     44      </dir> <!-- /ib/addendum/annotations/tests --> 
     45      <file role="data" name="annotation_parser.php"/> 
     46      <file role="data" name="doc_comment.php"/> 
     47     </dir> <!-- /ib/addendum/annotations --> 
     48     <file role="data" name="annotations.php"/> 
     49     <file role="data" name="LICENSE"/> 
     50    </dir> <!-- /ib/addendum --> 
     51    <dir name="annotations"> 
     52     <file role="data" name="AmfClassMapping.php"/> 
     53     <file role="data" name="AmfIgnore.php"/> 
     54    </dir> <!-- /ib/annotations --> 
    3555    <dir name="SabreAMF"> 
    3656     <dir name="AMF0"> 
     
    5878     <file role="data"  name="Const.php"/> 
    5979     <file role="data"  name="Deserializer.php"/> 
    60      <file role="data"  name="DetailException.php"/> 
     80     <file role="data"  name="DetailException.php"/>  
    6181     <file role="data"  name="Externalized.php"/> 
    6282     <file role="data"  name="InputStream.php"/> 
     
    104124  <release> 
    105125    <version> 
     126      <release>1.0.0</release> 
     127      <api>1.1</api> 
     128    </version> 
     129    <stability> 
     130     <release>stable</release> 
     131     <api>stable</api> 
     132    </stability> 
     133    <date>2008-08-26</date> 
     134    <license>MIT License</license> 
     135    <notes> 
     136    * Added support for the annotations @AmfIgnore and @AmfClassMapping 
     137      * Updated Documentation 
     138    </notes> 
     139   </release> 
     140  <release> 
     141    <version> 
    106142      <release>0.9.4</release> 
    107143      <api>1.1</api>