Michal G wrote:
> On Nov 27, 6:00 am, Daum <[EMAIL PROTECTED]> wrote:
>> I don't know if getAttributeSafe would be any different from
>> getAttribute.
>>
>> The question with getAttributeSafe and parameterSafe is how do you set
>> default values?  For example you can do $request->getParameter
>> ('foobar','hello') it says if the parameter isn't set(is null) then
>> default to 'hello'.  With getAttributeSafe what would it return if the
>> attribute is not safe?  false?  What if your parameter was false?
>> Null? Same problem as above, if you set the paramter to null.  Do you
>> understand the problem here?
>>
>> I think the best solution for this is the hasAttribute followed by a
>> getAttribute if it is true and you are worried about null
>> properties.
>> Daum
>>
> 
> First off all - when i mean that parameter is not set i mean it's not
> set. I don't mean it's set to null.
> 
> Well, the main difference would be that i can't set default values,
> because
> when i use this function i *know* that parameter or attribute must be
> set. If not,
> it means that something wrong happened in my code. So it throws
> exception -
> it's not returning anything.

This is better solved with validation than with adding code to 
retrieving parameters.

A parameter holder shouldn't be burdened with figuring out if accessing 
a non-existent parameter is a fatal error, or a warning or silently 
letting it go. A parameter holder holds parameters. If you complicate it 
its simple job, it introduces bugs. The whole philosophy of OO / and 
even unix is small simple isolated jobs.

Validate the input before firing off the action testing the existance of 
the parameter.

-- 
Nathanael d. Noblet
Gnat Solutions, Inc
T: 403.875.4613

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/symfony-devs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to