Just implement the __toString() method in your mood model class and "return 
$this->_get('mood_image');" in it.

Then you can just "echo $mood" in the template and it will output that path.

Cheers, Daniel

On Jan 5, 2010, at 12:42 PM, pete wrote:

> I have a MySQL table that stores a 'mood id' (eg. 6) and a picture
> associated with that mood (eg. /images/mood_happy.png'). mood_id is
> referenced on other tables like 'customer_contact' but I never want to
> see the mood_id - everytime mood is referenced in other tables eg.
> customer_contact, I just want the graphic to display.
> 
> So far, I'm displaying the mood picture by adding a new property in
> actions.class.php controller ie.,
>  $this->mood = Doctrine::getTable('mood')->find(array($this->contact-
>> getMoodId()));
> 
> Then, to display the image in showSuccess.php I call $mood->getImage
> ().
> 
> Is this the right way or a reasonable way to handle a 'mapped-to'
> column in a table OR am I not using symfony correctly/to its best
> capacity?
> 
> What I'm asking is if there's a more 'symfonic' way to handle this
> situation whereby EVERY time I access a mood table via the key
> (mood_id), I actually receive the image name (mood_image)?
> 
> Tks guys!
> 
> ps. I'm using doctrine.
> pps. I love symfony!
> 
> --
> 
> 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.
> 
> 

-- 
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.


Reply via email to