4 Replies Latest reply on Oct 17, 2009 4:52 AM by petousas

    PHP Data Services

    Ted Moens Level 1

      Greetings:

       

      The examples of importing a php data service are quite clear. However:

       

      Case 1 on the PHP server side, the data classes can be developed in a framework (like the ZendFramework) where in the table class with all the right methods may be in a file called, for example, ...application/modules/Guestbook/Guestbook.php but the class itsell is called Default_Model_Guestbook which is loaded through the Framework.

       

      In this case, the introspection process understandably fails as the name of the class does not match the file name.  Am I missing something obvious here?

       

      Case 2 : when using an ORM like Doctrine, the data class will typically extend a generated base class which in turn extends a Doctrine table class which has the nice functions like fetchAll() and find().  Again the introspection fails with a message to the effect that the class being extended was not in the source file of the new class.  Again, am I missing something obvious?

       

      Ted

        • 1. Re: PHP Data Services
          Mayank (Adobe) Adobe Employee

          Case1: Class names with '_' characters are not supported since they Zend

          Framework uses the '_' to split the name and identify the package name of

          the class.

           

          Case2: Extending classes should work fine, you'll have to ensure that they

          are in the include_path of the Zend_AMF_Server. This can be done by updating

          the amf_config.ini file and adding the directory which should be used as the

          base directory to resolve include paths. This is simply done by adding a new

          entry in the section of the file. Example given below:

           

          amf.production = false

          amf.directories[]=TestServices

          amf.directories[]=TestSitesPhp-debug/services

           

          -mayank

          1 person found this helpful
          • 2. Re: PHP Data Services
            Ted Moens Level 1

            Thanks very much for your first response.  I think I may be getting to the root of the problem, but this are is new to me, so please bear with me...

             

            As I am seeing it now, when I have a library of classes that were built in a Framework or ORM, they all set up an application context including extablishing an __autoloader() function in their bootstrapping area.  As a consequence the class definitions do not have any "include()" statements for the classes they extend.

             

            So, when we go to import a php service in Flash Builder based on a class definition, the introspection agent does not have the application's environment, and hence does not have the __autoloader function and hence it cant find any classes that are extended.

             

            Does this make sense?  If so, what do I do?  Can I somehow configure AMF to know about the autoloader?

             

            Note, If I add "include" statements in the class definitions, the introspection agent does it's job, but of course this really is not an option when there are dozens of generated classes that I would need to modify.

             

            Am I at least on the right track?

            • 3. Re: PHP Data Services
              Mayank (Adobe) Adobe Employee

              To get the AMF server to use the autoloader function in a bootstrap php

              file, you would have to include the autoloader PHP file in the gateway.php

              which is generated by Flash Builder and placed in the the project output

              folder.

               

              This way, the autoloader would make suitable modifications to the include

              path following which the ZendAMF server include path modifications would be

              added to the include path.

               

              Does that help?

              1 person found this helpful
              • 4. Re: PHP Data Services
                petousas

                oh my god, this is the post i was searching for days now.

                 

                I have the same problem when i tryed to introspec the "rooms_controller.php" file from a cake php project.


                Message was: "Files with "_" in its name are not supported. Please rename the file and try again. "

                 

                I hope you can give some directions in order to find a solution to this.

                May i use zend framework instead of cakephp?

                 

                1000 thanks!!!!