Quote from: markh at Jan 21, 2013, 10:50 PMI'm not exactly sure what you mean - what exactly is unclear, the way the keys or relations work? Can you maybe provide some snippets of the text/examples of how you would make it clearer?
For me and I have since noticed others on this forum making the same comment it is the naming of the fields in the examples for instance
MySQL Table Definitions
CREATE TABLE `blogposts` (
`blogpost_id` int(11) NOT NULL AUTO_INCREMENT,
`content` text,
PRIMARY KEY (`blogpost_id`)
) ENGINE=MyISAM;
CREATE TABLE `comments` (
`comment_id` int(11) NOT NULL AUTO_INCREMENT,
`blogpost_id` int(11) DEFAULT NULL,
`comment` text,
PRIMARY KEY (`comment_id`)
) ENGINE=MyISAM;
Here the field `blogpost_id` appears in both the primary and secondary tables. For the newbie such as myself trying to make the leap into PDO it becomes confusing later on
<composite alias="Comments" class="Comments" local="blogpost_id" foreign="blogpost_id" cardinality="many" owner="local" />
to follow which `blogpost_id` goes where.
A simple addition in the secondary table like this
CREATE TABLE `comments` (
`comment_id` int(11) NOT NULL AUTO_INCREMENT,
`fk_blogpost_id` int(11) DEFAULT NULL,
`comment` text,
PRIMARY KEY (`comment_id`)
) ENGINE=MyISAM;
and (if I have it right)
<composite alias="Comments" class="Comments" local="fk_blogpost_id" foreign="blogpost_id" cardinality="many" owner="local" />
might make one's head spin a bit less slowly (:>)!