Those errors occured because I commented out the hasone so that I could
still access all of the records in the users table (which it wouldn't
show any when it is working). I uncommented it, so it shows the
appropriate errors. Again the problem is when I have the hasOne
association it allows me to access all the usertypes no problem but
when I use $this->set('users', $this->User->findAll()); in the users
controller to get all the users records to display them, it returns
nothing.
Here is my users model
class User extends AppModel {
var $name = 'User';
var $validate = array('fname' => VALID_NOT_EMPTY,'lname' =>
VALID_NOT_EMPTY, 'email' => VALID_NOT_EMPTY, 'password' =>
VALID_NOT_EMPTY/*, 'usertype_id' => VALID_NOT_EMPTY*/);
var $hasOne = array('Usertype' =>
array('className' => 'Usertype',
'conditions' => '',
'order' => '',
'dependent' => true,
'foreignKey' => 'usertype_id'
)
);
}
Here is the users table
CREATE TABLE `users` (
`id` tinyint(4) NOT NULL auto_increment,
`fname` varchar(255) NOT NULL default '',
`lname` varchar(255) NOT NULL default '',
`email` varchar(255) NOT NULL default '',
`password` varchar(255) NOT NULL default '',
`usertype_id` tinyint(1) NOT NULL default '0',
`created` timestamp NOT NULL default CURRENT_TIMESTAMP on update
CURRENT_TIMESTAMP,
`lastin` timestamp NOT NULL default '0000-00-00 00:00:00',
PRIMARY KEY (`id`),
UNIQUE KEY `email` (`email`)
)
here is my usertypes model
class Usertype extends AppModel {
var $name = 'Usertype';
}
CREATE TABLE `usertypes` (
`id` tinyint(1) NOT NULL auto_increment,
`title` varchar(255) NOT NULL default '',
PRIMARY KEY (`id`)
)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" 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
-~----------~----~----~----~------~----~------~--~---