Saturday, July 3, 2010

hasOne don't show all data

TABLES:

User:
id, username, password

Customer:
id, user_id, name, type, city


MODELS:

class Custumer extends AppModel {
var $name = 'Custumer';

var $hasOne = array(
'User' => array(
'className' => 'User',
'foreignKey' => 'id',
)
);
}


class User extends AppModel {
var $name = 'User';

var $belongsTo = array(
'Customer' => array(
'className' => 'Customer',
'foreignKey' => 'id'
)
);
}


Customer Controller:


class CustomersController extends AppController {

var $name = 'Customers';

function index() {
$this->Customer->recursive = 0;
$this->set('Customers', $this->paginate());
}
}

THE PROBLEM:
The view just show fields ID and TYPE... but not city, name, etc.

What can be happening?

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate