I agree that at some point you may need the has* method but in the case
from the first email I think much more appropriate is a usage like:
Category: <?=$content->getCategoryName('N/A')?>
right :-)
I would give you a little different example. On my site users can enter
their age and also can specify if it can be displayed or not. Also I
keep all profile information in "class Profile". So following your
thinking I should do:
if ($member->hasProfile())
{
if ($member->getProfile()->hasAge() &&
$member->getProfile()->canShowAge()) {
echo $member->getProfile()->getAge();
}
}
I need to do all that just to print their age? Things will get even
worse if I decide to keep the user preferences in another table like it
is the right way to do.
Something to think about...
Kupo
Nicolas Perriault wrote:
> Kiril Angov wrote:
>
>
>> As I suggested, why just not create a methot $content->getCategoryName()
>> and put all the logic there? I guess a matter of preference but
>> following this approach, you will be free from problems as the original
>> and you will not need a get* and has* method for each function you want
>> to have.
>>
>
> You're perfectly right :)
>
> But I guess putting all the logic in the getters should be as painful as
> handling has* methods... matter of preference ;)
>
> I can add that a Propel behavior could handle automatically has*
> methods, this could be a part of a cool plugin.
>
> Anyway I personnaly do prefer handling my template logic my templates
> (no troll here, here a category is a data, or the display of a data:
> matter of preference one more time.)
>
> ++
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"symfony users" 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-users?hl=en
-~----------~----~----~----~------~----~------~--~---