Jonathon Posted November 5, 2012 Share Posted November 5, 2012 Morning Larry et al, Regarding Foreign Key constraints in the command CONSTRAINT fk_page_user FOREIGN KEY (user_id) REFERENCES yii_cms.user (id) ON DELETE SET NULL ON UPDATE NO ACTION) ON DELETE - does that mean you're deleting the `user_id` of the page table (the table in which the sql command was written) or the `id` of the user table it references, or something else? Thank you Jonathon Link to comment Share on other sites More sharing options...
Larry Posted November 5, 2012 Share Posted November 5, 2012 Good question. If you have a page record whose user_id value is 45, and the user record whose id value is 45 is deleted, the constraint dictates what is done with the page record. SET NULL would mean set that page record's user_id value to NULL. 2 Link to comment Share on other sites More sharing options...
Jonathon Posted November 5, 2012 Author Share Posted November 5, 2012 Thanks Larry I just wanted to check which way round it was. I've never used FK constraints so this was good to know. 1 Link to comment Share on other sites More sharing options...
Edward Posted November 16, 2012 Share Posted November 16, 2012 Starting to learn today how important relationships are in setting up Yii models. I will have to mess around with the above also. Come on Larry we are out of Yii food, and we have empty stomachs . Link to comment Share on other sites More sharing options...
Larry Posted November 16, 2012 Share Posted November 16, 2012 I know, I know! I am so behind... Pressure is mounting... 2 Link to comment Share on other sites More sharing options...
Antonio Conte Posted November 16, 2012 Share Posted November 16, 2012 Good things come to those who wait. Relax, everyone. Quality will be affected if he rushes this book out. I'm sure everyone will gain on him not rushing this. 1 Link to comment Share on other sites More sharing options...
Larry Posted November 16, 2012 Share Posted November 16, 2012 Thanks, Thomas, but the pressure is mostly internal. I think everyone is being more than patient! Link to comment Share on other sites More sharing options...
Edward Posted November 17, 2012 Share Posted November 17, 2012 Good things come to those who wait. Relax, everyone. Quality will be affected if he rushes this book out. I'm sure everyone will gain on him not rushing this. I was just winding him up, Ive been starting to mess around with Yii a little bit. And also reading the Alexander Makarov cookbook which is available. By the way Antonio there is three ways you can build queries in Yii, you can use Active Record which is the slowest, you can also use Query Builder or if you want the fatest you can use the Standard SQL(DAO) method. So with queries and Yii there is nothing to worry about, i remember you wrote about how inefficient code ignitor quiries were. Link to comment Share on other sites More sharing options...
Recommended Posts