My simple guess is that module/action/id tells symfony that id is a parameter with its own value defaulted to false (kinda just to show it exists) whereas module/action/id/ tell symfony that id is a parameter and there is a value of "" for it (because nothing follows the trailing slash.
In short, module/action/id means id exists (therefore === true) and module/action/id/ means id has a value of "". Makes sense to me to be honest. The better check to do might be to see if id has a value before adding it to the URL as a GET parameter. As for checking if id === true, I normally do a check for parameter existing anyways in my actions before I attempt to use it, so you can do this: if ($request->hasParameter('id') && $request->getParameter('id') !== true) { } Hope that helps On Fri, Apr 23, 2010 at 12:58 PM, Tofuwarrior <p...@clearintent.co.uk> wrote: > Hi gareth, > > Thanks for replying (again!) > > I understand about the difference between == and === and that that > must be what is causing retrieveByPK to return this but what I don't > get is why id is being set to true when there is no value being passed > in the url so I guess my question is about routing AND/OR > why retrieveByPK is not doing === when to me true and 1 are clearly > not the same PK. > I would like to understand why retrieveByPK takes this approach. I am > guessing that mysql does the == bit but why not filter this kind of > thing out if propel knows that the column is an int which it does. > > I guess, I am also wondering if I can do about this other than doing > my own test for id===true prior to calling the retrievByPK which seems > a bit messy. > > Cheers, > > Paul > > > > Sure, I understand that but > > On Apr 23, 10:31 am, Gareth McCumskey <gmccums...@gmail.com> wrote: >> Look at this piece of code: >> >> $a = 1; >> $b = 0; >> >> if ($a == true) echo "I am true" >> if ($b == false) echo "I am false" >> >> results in "I am true" and "I am false" both being echoed. >> >> However: >> if ($a === true) echo "I am true" >> if ($b === false) echo "I am false" >> >> does not >> >> >> >> On Fri, Apr 23, 2010 at 11:15 AM, Tofuwarrior <p...@clearintent.co.uk> wrote: >> > Hi all, >> >> > I guess this is simple lack of understanding but it is a bit peculiar. >> > Any insights, answers pointers to further readng gratefully received. >> >> > I haven't found any answers in the docs anywhere. >> >> > In my app, >> >> > this >> > .com/folder/tree/id creates request variable id=boolean(true) >> > whereas this >> > .com/folder/tree/id/ creates request variable id=empty string >> >> > I am doing retrievebyPK($request->getParameter('id')) and the version >> > that returns true means that this retrieves the record with PK ==1 >> > which i absolutely don't want. >> >> > Any idea what i am doing wrong? I figure it must be to do with routing >> > or is there an error with retrieveByPK - should it know the diff >> > between true and 1, I guess it evaluates to the same but should it >> > really work like that? >> >> > My routing is the default stuff as follows, I have other rules but >> > nothing relevant to folder >> > default_index: >> > url: /:module >> > param: { action: index } >> >> > default: >> > url: /:module/:action/* >> >> > Thanks, >> >> > TW >> >> > -- >> > If you want to report a vulnerability issue on symfony, please send it to >> > security at symfony-project.com >> >> > You received this message because you are subscribed to the Google >> > Groups "symfony users" group. >> > To post to this group, send email to symfony-users@googlegroups.com >> > To unsubscribe from this group, send email to >> > symfony-users+unsubscr...@googlegroups.com >> > For more options, visit this group at >> >http://groups.google.com/group/symfony-users?hl=en >> >> -- >> Gareth McCumskeyhttp://garethmccumskey.blogspot.com >> twitter: @garethmcc >> >> -- >> If you want to report a vulnerability issue on symfony, please send it to >> security at symfony-project.com >> >> You received this message because you are subscribed to the Google >> Groups "symfony users" group. >> To post to this group, send email to symfony-users@googlegroups.com >> To unsubscribe from this group, send email to >> symfony-users+unsubscr...@googlegroups.com >> For more options, visit this group >> athttp://groups.google.com/group/symfony-users?hl=en > > -- > If you want to report a vulnerability issue on symfony, please send it to > security at symfony-project.com > > You received this message because you are subscribed to the Google > Groups "symfony users" group. > To post to this group, send email to symfony-users@googlegroups.com > To unsubscribe from this group, send email to > symfony-users+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/symfony-users?hl=en > -- Gareth McCumskey http://garethmccumskey.blogspot.com twitter: @garethmcc -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en