Thanks stockit,
It working for me
On Oct 9, 5:43 am, Stockit-rehanw <[EMAIL PROTECTED]> wrote:
> I'm new to cake too but read this in a book and elsewhere...
>
> try $this->City->find('list') - its made to render for select lists
>
> outputs...
>
> 1 => London
> 2 => New York
>
> readhttp://book.cakephp.org/view/449/findfor more
>
> On Oct 8, 10:45 pm, Bookrock <[EMAIL PROTECTED]> wrote:
>
> > Hi,
>
> > I have twomodelUser and City
>
> > They have one to one relation by foreign key city_id.
>
> > In UserModel
>
> > var $belongsTo = array(
> > 'City' => array(
> > 'className' => 'City',
> > )
> > );
>
> > In CityModel
>
> > var $hasOne = array(
> > 'User' => array(
> > 'className' => 'User',
> > )
> > );
>
> > I want togetonly a list of all city name from CityModelfor showing
> > in select box.
>
> > I have some solution in mind but can not use
> > 1 var $uses = array('City'); because there is already a association
> > betweenmodel
> > 2 App::import("Model","otherModel") because I have already included
> > this using association
> > 3 When I used
> > $cities = $this->City->User->find('all', array('fields' =>
> > array( 'City.city_name' )));
> > It return all cities who users belongs..that's not my
> > result
>
> > Here I can not remove association between models because I am using it
> > may places so please tell me how can Igetlist of only all cities
> > name.
>
> > Thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" 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/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---