0 Replies Latest reply on Oct 19, 2010 5:51 AM by RobX82

    PHP Server Side Typing, Arrays, and User Defined Types

    RobX82 Level 1

      Both these pages, Page 1 and Page 2, from Adobe show that you can use server side type hinting with PHP and Flex. 

       

      The issue I am having is that when returning an array of a user defined type, I must also have a function that returns just the user defined type itself in order for flex to recognize the array.  In the example below if I delete the getEmployeesByID function and its docblock, Flex will show the getAllEmployees function returning as an Object[] instead of Employee[].  However if I leave the second function in the php then Flex will correctly show the getAllEmployees as returning Employee[].  This is a issue because not every class is going to return both a single instance of a user defined type when I might only want to return an array of my UDT.  Does anyone know how to get around this limitation?

       

      <?php 
      
      class Employee { 
        /** 
         * @var int 
         */ 
        var $emp_id; 
      
        /** 
         * @var string 
         */ 
        var $bdate; 
      
      } 
      
      class EmployeeService { 
      
          /** 
           * Returns all the rows from the table. 
           * 
           * Add authorization or any logical checks 
           * for secure access to your data 
           * 
           * @return Employee[] 
           */ 
          public function getAllEmployees() { 
      
              return $rows; 
          } 
      
          /** 
           * @param int $itemID 
           * @return Employee 
           */ 
          public function getEmployeesByID($itemID) { 
      
              return $item;
          } 
      
      }
      
      ?>