Manual setup of relationships

Asked by Marcus Baker on 2009-04-17

I need a clear path in regard to manually setting up one-to-one and one-to-many relationships, or at least an example of a class that's been generated with one-to-one and one-to-many relationships setup, as they aren't being generated from my database.

Question information

English Edit question
CoughPHP Edit question
No assignee Edit question
Solved by:
Anthony Bush
Last query:
Last reply:
Marcus Baker (marcus-baker) said : #1

I should note that I'm trying to create objects based on an existing schema I've inherited that has some primary keys defined as keyid without underscores, and that the tables I've inherited are MyISAM as opposed to InnoDB tables, so schemas don't have foreign key information attached, which is why I'm trying to define things manually.

Best Anthony Bush (awbush) said : #2


Excellent question. Try using a couple generation scripts (one for collection/one-to-many methods and one for object/one-to-one methods):

Run them without any args to see help info. Copy/paste the code it outputs into your concrete models. We'll probably add these or something like them to the scripts folder going forward so if you think of any improvements let us know.

Marcus Baker (marcus-baker) said : #3

Thanks! - I'll check it out but it looks like has expired, is there another place to access this?

Marcus Baker (marcus-baker) said : #4

nevermind, i'm in - thanks much!