Hi,

I am developing an application using cake bake commands, I need to
display various models data in the home page. So i created a
controller fro that purpose but unable to find how to get data of
various models from that controller.



where in home model i declared as follows

<?php
class Home extends AppModel {
        var $name = 'State';
        var $displayField = 'name';
        //The Associations below have been created with all possible keys,
those that are not needed can be removed
        var $hasMany = array(
            'State' => array(
                'className' => 'States',

            )
        );
}

?>


As i am new i dont know whether this type of coding is correct or not.
If not can any one suggest me correct way of doing it.

I tired to access data using following code

$this->set('state', $this->Home->State->read(null, 1));

I am able to get only one reccord actuall i need to fetch all the
records.  I tired few other methods of model like find but unable to
fulfil my requirement. How can i fetch all the records of another
model from a controller.

Regards,
Anjith

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to