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
read http://book.cakephp.org/view/449/find for more
On Oct 8, 10:45 pm, Bookrock <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I have two model User and City
>
> They have one to one relation by foreign key city_id.
>
> In User Model
>
> var $belongsTo = array(
> 'City' => array(
> 'className' => 'City',
> )
> );
>
> In City Model
>
> var $hasOne = array(
> 'User' => array(
> 'className' => 'User',
> )
> );
>
> I want to get only a list of all city name from City Model for 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
> between model
> 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 I get list 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
-~----------~----~----~----~------~----~------~--~---