I'm toying with Zend Framework and trying to use the "QuickStart" guide against a website I'm making just to see how the process would work. Forgive me if this answer is obvious, hopefully someone experienced can shed some light on this.
I have three database tables:
CREATE TABLE `users` (
`id` int(11) NOT NULL auto_increment,
`email` varchar(255) NOT NULL,
`username` varchar(255) NOT NULL default '',
`first` varchar(128) NOT NULL default '',
`last` varchar(128) NOT NULL default '',
`gender` enum('M','F') default NULL,
`birthyear` year(4) default NULL,
`postal` varchar(16) default NULL,
`auth_method` enum('Default','OpenID','Facebook','Disabled') NOT NULL default 'Default',
PRIMARY KEY (`id`),
UNIQUE KEY `email` (`email`),
UNIQUE KEY `username` (`username`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE `user_password` (
`user_id` int(11) NOT NULL,
`password` varchar(16) NOT NULL default '',
PRIMARY KEY (`user_id`),
UNIQUE KEY `user_id` (`user_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
CREATE TABLE `user_metadata` (
`user_id` int(11) NOT NULL default '0',
`signup_date` datetime default NULL,
`signup_ip` varchar(15) default NULL,
`last_login_date` datetime default NULL,
`last_login_ip` varchar(15) default NULL,
PRIMARY KEY (`user_id`),
UNIQUE KEY `user_id` (`user_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
I want to create a User model that uses all three tables in certain situations. E.g., the metadata table is accessed if/when the meta data is needed. The user_password table is accessed only if the 'Default' auth_method is set. I'll likely be adding a profile table later on that I would like to be able to access from the user model.
What is the best way to do this with ZF and why?