7 Replies Latest reply on Aug 7, 2012 12:10 AM by Mogge 3000

    Data/Services nested VO error

    Mogge 3000

      Hi,

       

      I'm using Doctrine with Zend Amf and Flash Builder for PHP. It's working just great!

       

      Today I ran into an issue I don't understand. I'm nesting a VO within another VO. A Kvitto is within a Booking. This usually works as expected. I've done this in other parts of the app I'm building but now I'm getting this.

       

      Main Thread (Suspended: ReferenceError: Error #1065: Variable Kvitto is not defined.)
      global/flash.utils::getDefinitionByName [no source]
      com.adobe.serializers.utility::TypeUtility$/getArrayType
      com.adobe.serializers.utility::TypeUtility$/assignProperty
      com.adobe.serializers.utility::TypeUtility$/convertToStrongType
      com.adobe.serializers.utility::TypeUtility$/convertListToStrongType
      com.adobe.serializers.utility::TypeUtility$/convertResultHandler
      mx.rpc.remoting::Operation/http://www.adobe.com/2006/flex/mx/internal::processResult
      mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::resultHandler
      mx.rpc::Responder/result
      mx.rpc::AsyncRequest/acknowledge
      NetConnectionMessageResponder/resultHandler
      mx.messaging::MessageResponder/result

       

      When I compare the results sent back from PHP with Charles it all looks ok. My VO's nested the way they should. But somehow the serializing doesn't work out...

       

      Kvitto is the name of my Actionscript VO so I know that it is the VO thats not defined. The Kvitto VO is generated automatically using the Data/Services tab in Flash Builder. To be able to map the Booking with a nested Kvitto I've first created a service call for just a Kvitto that I used to create the VO. Then I did the same for Booking and setting Kvitto as the type for the nested VO.

       

      I've also made sure to create a instance of the VO so that the class should be included.

       

      Please, please help me with this. Any clues would be much appreciated.

       

      //Morgan

        • 1. Re: Data/Services nested VO error
          Mogge 3000 Level 1

          Just wanted to say taht I've tested getting the nested VO as a single VO, i.e. not nested and it works so the VO itself should be ok.

           

          All of this is handled by the Data/Services functionality of Flash Builder so it's hard for me to debug whats going wrong. All i have is that the Kvitto Variable is undefined...

          • 2. Re: Data/Services nested VO error
            Mogge 3000 Level 1

            Still no solution :-)

             

            I'm using Doctrine and have my VO's setup as entitys on the PHP side. Do I need to use any sort of classmapping for this to work? I'm just using the Data/Services features of FLEX to get simple VO's over to FLEX correctly typed. As soon as I try to nest a VO within another I get this error...

             

            When I use the Data/Services to configure the return type for the VO with the nested VO it doesn automatically recognize the VO as i does for simple VO's without any nested VO. If I skip to mapp the nested VO and leave them as objects it's ok, I get the data but then the nestd VO's are not typed.

             

            Are there any differences in how Flash Builder generates the VO's with 4.5 compared to 4?

            • 3. Re: Data/Services nested VO error
              Mogge 3000 Level 1

              Another input.

               

              I'm using Modules, in fact a dynamically loaded module displayed in a TitleWindow. The service call is made from within the module and the VO only exist in the actual module, not the main app. Could it be that this is the reason why the VO is not defined. Taht somehow the serializer is working only against the main app?

               

              In the main App I have successfully made service calls for nested VO's. So I now it can be done...

               

              Really need some help with this, it's driving me nuts

              • 4. Re: Data/Services nested VO error
                Mogge 3000 Level 1

                I did it! And I must say all by myself!

                 

                Ok. For anyone having the same issue I'll try explain my setup, why it didn't work and how I found a workaround.

                 

                My app consists of a main application and a number of modules. All core functionality is kept in the main app such as login and navigation. Each module then does it's own thing, sharing the basic functions from the core with the other modules. Calling for a nested VO from the server works great when within the core, using the core functionality but as soon as any of the modules makes a call like this it fails. Even though I used the Data/Services tab from within the module the Flex serializers look at the valubojects found in the core when trying to type the nested VO's and sice there are no module specific VO's in the core it fails. The simple solution is to copy all the VO's ther super and entity classes over to the core...

                 

                I'm not sure but this seems like a bug to me. It's worth mentioning that the package structure for the valueObjects are the same within the core and the modules. Changing the this in the modules might solve this issue but I havent tested it yet.

                 

                So, what do you think, is this a bug?

                • 5. Re: Data/Services nested VO error
                  Mogge 3000 Level 1

                  Ok, now I've tested a bit more.

                   

                  Changing package name for valueobjects in the modules doesn't resolve this issue. Neither does removing optimize module for application, still the same issue. I have to copy all VO's over to the main app and make sure to instantiate them there for this to work. I can live with it but it's a pain, especially since there will be hundreds of VO's and I have to copy them whever I make a change in a VO...

                   

                  Could there be a issue in how I'm linking the main app and the modules? Now I'm doing the modules as seperate projects instead of within the main app.... In each module I'm referencing the main app in order to use the shared functionality.

                  • 6. Re: Data/Services nested VO error
                    kubabelica

                    Hi Mogge and all others having the same issue,

                     

                    I was almost going to restructure my app after I successfully tested your solution. However I did try some few steps around yet, and found, that if you declare the VO classes in you main app, the service calls will work in modules as they should. It is not enough to import them, but rather create a dummy variable of each VO class you want to use in modules (no need to instantiate with 'new'). It saved me a lot of a time now although I've killed one night trying to figure it out.

                    • 7. Re: Data/Services nested VO error
                      Mogge 3000 Level 1

                      Great that someone could benefit from what I came up with! And thanks for your addition, that will help alot!