我有以下表,處理reserverations:有沒有辦法強制Zend_Session_SaveHandler_DbTable寫入數據庫?
CREATE TABLE `Plots` (
`Plot_ID` int(11) NOT NULL AUTO_INCREMENT,
`Grid_ID` int(11) NOT NULL DEFAULT 0,
`Instance_ID` int(11) NOT NULL DEFAULT 0,
`Session_ID` char(32) DEFAULT NULL,
`User_ID` int(11) DEFAULT NULL,
`Transaction_ID` int(11) DEFAULT NULL,
`CreateDate` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`UpdateDate` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`Plot` varchar(10) NOT NULL DEFAULT 0,
`ReserveDate` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`ReservationTimeoutDate` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`PurchaseDate` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`Plot_ID`),
CONSTRAINT `Plots_ibfk_1` FOREIGN KEY (`Grid_ID`) REFERENCES `Grids` (`Grid_ID`) ON DELETE NO ACTION ON UPDATE CASCADE,
CONSTRAINT `Plots_ibfk_2` FOREIGN KEY (`Instance_ID`) REFERENCES `Instances` (`Instance_ID`) ON DELETE NO ACTION ON UPDATE CASCADE,
CONSTRAINT `Plots_ibfk_3` FOREIGN KEY (`Session_ID`) REFERENCES `Sessions` (`Session_ID`) ON DELETE SET NULL ON UPDATE CASCADE,
CONSTRAINT `Plots_ibfk_4` FOREIGN KEY (`User_ID`) REFERENCES `Users` (`User_ID`) ON DELETE NO ACTION ON UPDATE CASCADE,
CONSTRAINT `Plots_ibfk_5` FOREIGN KEY (`Transaction_ID`) REFERENCES `Transactions` (`Transaction_ID`) ON DELETE NO ACTION ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=latin1;
正如你可以看到,「的Session_ID」是一個外鍵,我的會話表,正在由Zend_Seesion和Zend_Session_SaveHandler_DbTable管理。
我在創建會話時出現問題,並且在同一個腳本中嘗試使用它的Session_ID將記錄插入到「Plots」(如上所示)中,因爲該記錄不存在於Sessions表中。
我可以強制Zend_Session_SaveHandler_DbTable將其數據保存到數據庫中嗎?如果是這樣,怎麼樣?
您可以複製/粘貼您的application.ini或bootstrap(初始化會話的位置)。 – Liyali 2012-03-30 17:08:59