
When I try to store a record in a table with multiple indexes using active record it does not return a valid ID. I have a table called "Events"
CREATE TABLE IF NOT EXISTS events
( id
int(11) NOT NULL AUTO_INCREMENT, startdate
datetime NOT NULL, enddate
datetime NOT NULL, text
varchar(250) NOT NULL, link
varchar(250) DEFAULT NULL, notify
int(1) DEFAULT NULL, type
varchar(100) DEFAULT NULL, companyid
int(11) NOT NULL, propertyid
int(11) NOT NULL, PRIMARY KEY (id
,companyid
) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=47 ;
Example Code:
$event = new event(); $event->setStartdate($startdate); $event->setEnddate($enddate); $event->setLink(fRequest::get("file")); $event->setNotify(fRequest::get("notify")); $event->setCompanyid($_loggedinUser->company->getId()); $event->setPropertyid($curProperty); $event->store();
After running this if I try and do $event->getId(); it returns null or blank.
This same process works if I remove the "companyid" from the primary key