Hi mirfan,

Welcome to symfony!

I'm not sure if you're using Propel or Doctrine, but I think the 
following will work in both (depending on your schema.yml):

<?php foreach ($cities as $city): ?>
   <p><?php echo $city->getCityName() ?></p>
   <p><?php echo $city->getCountry()->getCountryName() ?></p>
<?php endforeach; ?>

**You should really read some of the documentation though, there's some 
great stuff and some easy to follow examples.**

Hope that helps,

Tom

mirfan wrote:
> Hi everyone,
> I am new one to symfony and need your help my problem is:
> i have two tables countries and cities when i add a city i am
> selecting a country for it cities structure is
> 
> id    city_name  country_id
> 
> now when i am diplaying the cities i add the criteria but how i will
> display the country
> 
> country table structure is
> 
> id country_code  country_name
> 
> foreach($cities as $city){
>       $city->getCityName()."--->";
>       $city->getCountryName();
> }
> 
> is that legal? if yes then why it is not displaying countries, and if
> no then how i will manage please help me getCountryName() function is
> defined but for countries module now how i will access it from cities
> module.
> 
> Regards,
> > 

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

Reply via email to