Respect/Rest

when Routine

Closed this issue · 17 comments

hey guys!

I'm using the last TAG of REST (0.4.8) and having a trouble with "when" routine

my test is :

$router->get('/minha/route/*', function($id){
    return  'very good';
})->when(function($id){
    var_dump($id);
    return is_numeric($id) && $id > 0;
});

var_dump is showing up when you access something like /minha/route/123 ?

gives null value =/

Hmm. I have some clue on what's going on. Seems that the Respect\Rest\Routines\When isn't implementing the Respect\Rest\Routines\ParamSynced interface. I need to be at home to fix this, but you can try that yourself to see if works.

https://github.com/Respect/Rest/blob/develop/library/Respect/Rest/Routines/When.php

Change: implements ProxyableWhen to implements ProxyableWhen, ParamSynced. Let me know if that works! Otherwise I'll be testing this still today.

not yet =/

Didn't have time to check this, I will try tonight.

@alganet shout if you need a hand, I've had my hands full with 50 other things. But always keen =) just don't one to duplicate the effort if you are already working on it.

@lleitep3 anything else we can help with as well? Excuse the delay we will have you happy in no time =)

Seems that @augustohp is working on it!

I already have the test and some implementation, just need one or two more tests ;)
I will push it to its own branch (as I should have already done) later on tonight when I am home :)

Yeah! =)

Goooooo @augustohp !!!!

If you can't do it no one can!

I've commited some tests, the When routine seems correct. Hey @lleitep3, your tests are being run with another routes in the router? Maybe some other route is matching and hiding the error. Could you please try a router only with the route that has the When condition? I really want to know what's going on.

Cannot reproduce:

Without doing any updates I tested this on an existing application to see if I can reproduce the $id == null issue but it works for me.

Added the following to one of my routers:

<?php

$router->get('/minha/route/*', function($id){
    return  'very good';
})->when(function($id){
    var_dump($id);
    return is_numeric($id) && $id > 0;
});

Accessing the following url:

http://localhost/minha/route/3

Gets me the expected output from var_dump:

string(1) "3"

well, sorry for delay...

so men, i'm confused now, I will debug my implementations, and return here today!

@lleitep3 please give us the complete router code, what you enter in the browser and what you see displayed. The more information you provide the easier it is for us to give you information that might actual help. =)

The http headers from firebug as well!
On Aug 31, 2012 11:08 AM, "Nick Lombard" notifications@github.com wrote:

@lleitep3 https://github.com/lleitep3 please give us the complete
router code, what you enter in the browser and what you see displayed. The
more information you provide the easier it is for us to give you
information that might actual help. =)


Reply to this email directly or view it on GitHubhttps://github.com//issues/72#issuecomment-8193040.

Hi @lleitep3, don't be shy as well. You have me on gtalk/msn, ping me there if you need!

@alganet and @lleitep3 please don't forget to post the private conversations here on the board. I am sure I am not the only one eager to hear what is happening but it will also help others in the future.

That said! Are we there yet? =) Throw a dog a bone at least? What's happening? Are we there yet? =)

Closing issue no further discussion in 3 months. @lleitep3 feel free to reopen should you need further assistance. If you found resolve please allow the rest of us to learn from your experience by submitting the working solution.

Thank you for your comments.