Page 2 of 4 FirstFirst 1234 LastLast
Results 11 to 20 of 38

Thread: Alternative Ext Direct PHP Implementation

  1. #11
    Ext JS Premium Member
    Join Date
    Mar 2007
    Location
    Germany
    Posts
    754

    Default

    is there a reason for following code?

    ExtDirect/API.php Line 95

    Code:
    $cSettings['fullPath'] = $this->getClassPath($name, $Settings);
    when i change this line to

    Code:
    $cSettings['fullPath'] = $this->getClassPath($name, $cSettings);
    i was able to set individiual paths for each Class via basePath...


    Bye, Dumbledore

  2. #12
    Sencha User thesilentman's Avatar
    Join Date
    Apr 2007
    Location
    Athens, Greece
    Posts
    232

    Default getNumberOfParameters() instead of getNumberOfRequiredParameters()?

    Tommy,
    did you have something special in mind in using

    getNumberOfRequiredParameters()

    instead of

    getNumberOfParameters()

    to get the functions parameters in order to construct the length?

    I stumbled upon this on a function where I was initializing some parameters in the function declaration, and they were not counting in the parameter len config for the remote procedure.

    Greets,
    Frank

  3. #13
    Sencha User thesilentman's Avatar
    Join Date
    Apr 2007
    Location
    Athens, Greece
    Posts
    232

    Default [Solved] Strange Behaviour with getDocComment

    Hello community,
    just wanted to share this experience I had, in case somebody else stumbles upon this behavior. Hopefully it will save you some time

    I don't know how many of you have tested this solution with the reflection capabilities of php, but I found something strange happening.

    I was playing around with the example classes, and changed the file class a bit.
    After that when I called the api.php, I was only getting back the actions of the file class and not any of the other files.

    I debugged the php side and found out that once a class has been analyzed with the reflection tools, the next time it get's analyzed, the
    PHP Code:
                        if(    $rMethod->isPublic() &&
                            
    strlen($rMethod->getDocComment()) > 0
                        

    code fails. This meant that for some reason the 'getDocComment()' command returned real data only the first time it parses a class method.

    Since I am new to reflections and just starting to experiment I was not sure if this is a bug in PHP or some config issue with Tommy's implementation.

    I did some goggleing and found this bug which kind of reminded me of this behaviour:
    http://eaccelerator.net/ticket/229

    and indeed it was an eaccelerator (that I am using) bug which was fixed and the solution is also explained in the link I provided. You should also install the latest version of course....

    Greets,
    Frank

  4. #14
    Sencha User
    Join Date
    Mar 2007
    Location
    Haarlem, Netherlands
    Posts
    1,243

    Default

    You can find an updated version in the original post.

  5. #15
    Ext User
    Join Date
    Aug 2009
    Posts
    1

    Default The server response

    Hi Could anyone explain how to catch up the exception result formed in Router.php:
    PHP Code:
              
                catch(
    Exception $e)
                { 
                    
    $response = array(
                        
    'type' => 'exception',                    
                        
    'tid' => $cdata->tid,
                        
    'message' => $e->getMessage(),
                        
    'where' => $e->getTraceAsString()
                    );
                } 
    In Ext script I'm on success and failure events and just can't catch this response
    Code:
                FormPanel constructor
                ...
                buttons:[{
                    text: 'Enter',
                    id: 'submit',
                    handler: doSubmit
                }],
                // configs for BasicForm
                api: {
                    // The server-side must mark the submit handler as a 'formHandler'
                    submit: Ext.ss.Auth_Demo.login
                },
                // specify the order for the passed params    
                paramsAsHash: true
            });
    
            function doSubmit()
            {        
                basicInfo.getForm().submit(
                { 
                    waitMsg: '????????',
                    waitTitle: '???? ????????..',
                    params: 
                    {
                        username : 'username',
                        password : 'password'
                    },
                    success: function(form, action)
                    {
                        Ext.Msg.alert(':)');
    
                        basicInfo.ownerCt.close();
                    },
                    failure:function(form, action)
                    { 
                        if(action.failureType == 'server')
                        { 
                            Ext.Msg.alert(':(');
                        } 
                    }
                }); 
            }
    Thanx

  6. #16
    Sencha Premium User mrsunshine's Avatar
    Join Date
    Sep 2008
    Location
    Germany - Darmstadt
    Posts
    693

    Default

    Quote Originally Posted by thesilentman View Post
    I did some goggleing and found this bug which kind of reminded me of this behaviour:
    http://eaccelerator.net/ticket/229

    and indeed it was an eaccelerator (that I am using) bug which was fixed and the solution is also explained in the link I provided. You should also install the latest version of course....

    Greets,
    Frank

    thx for the hint, had the same problem!

  7. #17
    Sencha User thesilentman's Avatar
    Join Date
    Apr 2007
    Location
    Athens, Greece
    Posts
    232

    Default

    Quote Originally Posted by mrsunshine View Post
    thx for the hint, had the same problem!
    glad it helped someone

    Greets,
    Frank

  8. #18
    Sencha User willf1976's Avatar
    Join Date
    May 2009
    Location
    carpinteria, ca
    Posts
    84

    Default

    Hi

    Thanks for posting this updated version.

    I found a bug in API.php --

    Line 54 reads:

    HTML Code:
     if(isset($state['nameAttribute'])) {
                $this->setFormAttribute($state['nameAttribute']);
            }
    It should read:


    HTML Code:
      if(isset($state['nameAttribute'])) {
                $this->setNameAttribute($state['nameAttribute']);
            }
    This was causing errors when working with forms and direct.

    Best Regards

    Will Ferrer

  9. #19
    Ext User Freman's Avatar
    Join Date
    Jul 2007
    Location
    Queensland, Australia
    Posts
    8

    Default

    Quote Originally Posted by mor View Post
    Hi Could anyone explain how to catch up the exception result formed in Router.php:
    I too would like to know how to catch an exception from this, firebug says "result is undefined" when the result is

    Code:
    {"type":"exception","tid":"2","message":"New and repeat passwords do not match","where":"#0 [internal function]: ExtLib_Password->passwd(Array, Array)\n#1 \/var\/www\/localhost\/htdocs\/lib\/ExtDirect\/Router.php(176): call_user_func_array(Array, Array)\n#2 \/var\/www\/localhost\/htdocs\/lib\/ExtDirect\/Router.php(62): ExtDirect_Router->rpc(Object(BogusAction))\n#3 \/var\/www\/localhost\/htdocs\/lib\/router.php(17): ExtDirect_Router->dispatch()\n#4 {main}"}
    Fremnet.net - My tools, tinkerings and code

  10. #20
    Sencha Premium User mrsunshine's Avatar
    Join Date
    Sep 2008
    Location
    Germany - Darmstadt
    Posts
    693

    Default

    you can for example catch the ext direct exception event
    PHP Code:
    Ext.Direct.on(
      
    'exception'
      
    function(e){
        
    // do something with the exception information
        
    console.log(e);
      }
    ); 

Page 2 of 4 FirstFirst 1234 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •