I have the following table:
CREATE TABLE `attributes` (
`id` int(10) unsigned NOT NULL auto_increment,
`category` varchar(25) NOT NULL,
`name` varchar(25) NOT NULL,
`value` varchar(50) NOT NULL,
`created` datetime default NULL,
`modified` datetime default NULL,
PRIMARY KEY (`id`)
)
And it looks something like this:
INSERT INTO `attributes` VALUES (1, 'Personal', 'ActivityLevel',
'Never Active', '0000-00-00 00:00:00', '0000-00-00 00:00:00');
INSERT INTO `attributes` VALUES (2, 'Personal', 'ActivityLevel',
'Rarely Active', '0000-00-00 00:00:00', '0000-00-00 00:00:00');
INSERT INTO `attributes` VALUES (3, 'Personal', 'ActivityLevel',
'Selected Activities', '0000-00-00 00:00:00', '0000-00-00 00:00:00');
INSERT INTO `attributes` VALUES (6, 'Personal', 'Appearance', 'Slim',
'0000-00-00 00:00:00', '0000-00-00 00:00:00');
INSERT INTO `attributes` VALUES (7, 'Personal', 'Appearance',
'Athletic', '0000-00-00 00:00:00', '0000-00-00 00:00:00');
INSERT INTO `attributes` VALUES (8, 'Personal', 'Appearance',
'Average', '0000-00-00 00:00:00', '0000-00-00 00:00:00');
INSERT INTO `attributes` VALUES (12, 'Personal', 'AttractiveFeatures',
'Smile', '0000-00-00 00:00:00', '0000-00-00 00:00:00');
INSERT INTO `attributes` VALUES (13, 'Personal', 'AttractiveFeatures',
'Hair', '0000-00-00 00:00:00', '0000-00-00 00:00:00');
INSERT INTO `attributes` VALUES (14, 'Personal', 'AttractiveFeatures',
'Eyes', '0000-00-00 00:00:00', '0000-00-00 00:00:00');
INSERT INTO `attributes` VALUES (27, 'Personal', 'Career', 'Accounting/
Finance', '0000-00-00 00:00:00', '0000-00-00 00:00:00');
INSERT INTO `attributes` VALUES (28, 'Personal', 'Career', 'Actor',
'0000-00-00 00:00:00', '0000-00-00 00:00:00');
INSERT INTO `attributes` VALUES (29, 'Personal', 'Career',
'Advertising', '0000-00-00 00:00:00', '0000-00-00 00:00:00');
INSERT INTO `attributes` VALUES (30, 'Personal', 'Career', 'Airlines',
'0000-00-00 00:00:00', '0000-00-00 00:00:00');
INSERT INTO `attributes` VALUES (31, 'Personal', 'Career', 'Arts',
'0000-00-00 00:00:00', '0000-00-00 00:00:00');
INSERT INTO `attributes` VALUES (36, 'Personal', 'Career',
'Celebrity', '0000-00-00 00:00:00', '0000-00-00 00:00:00');
INSERT INTO `attributes` VALUES (41, 'Personal', 'Career', 'Computer
related (IS,MIS,', '0000-00-00 00:00:00', '0000-00-00 00:00:00');
INSERT INTO `attributes` VALUES (98, 'Personal', 'Children', 'I have
no kids', '0000-00-00 00:00:00', '0000-00-00 00:00:00');
INSERT INTO `attributes` VALUES (99, 'Personal', 'Children', 'They are
far away', '0000-00-00 00:00:00', '0000-00-00 00:00:00');
INSERT INTO `attributes` VALUES (100, 'Personal', 'Children',
'Sometimes', '0000-00-00 00:00:00', '0000-00-00 00:00:00');
INSERT INTO `attributes` VALUES (101, 'Personal', 'Children', 'Do not
live with me', '0000-00-00 00:00:00', '0000-00-00 00:00:00');
INSERT INTO `attributes` VALUES (105, 'Personal', 'Complexion', 'Very
Fair', '0000-00-00 00:00:00', '0000-00-00 00:00:00');
INSERT INTO `attributes` VALUES (106, 'Personal', 'Complexion',
'Fair', '0000-00-00 00:00:00', '0000-00-00 00:00:00');
INSERT INTO `attributes` VALUES (110, 'Personal', 'DegreeEarned',
'Associates Degree', '0000-00-00 00:00:00', '0000-00-00 00:00:00');
INSERT INTO `attributes` VALUES (111, 'Personal', 'DegreeEarned',
'Bachelors Degree', '0000-00-00 00:00:00', '0000-00-00 00:00:00');
INSERT INTO `attributes` VALUES (112, 'Personal', 'DegreeEarned',
'Masters Degree', '0000-00-00 00:00:00', '0000-00-00 00:00:00');
INSERT INTO `attributes` VALUES (113, 'Personal', 'DegreeEarned', 'PhD/
Doctoral Degree', '0000-00-00 00:00:00', '0000-00-00 00:00:00');
My profile table looks something like this:
CREATE TABLE `profiles` (
`id` int(10) unsigned NOT NULL auto_increment,
`member_id` int(10) unsigned NOT NULL,
`attribute_id_appearance` int(10) unsigned default NULL,
`attribute_id_attractivefeatures` int(10) unsigned default NULL,
`attribute_id_career` int(10) unsigned default NULL,
`attribute_id_children` int(10) unsigned default NULL,
`attribute_id_complexion` int(10) unsigned default NULL,
`attribute_id_degree` int(10) unsigned default NULL,
.....
When a member is editing his profile, i need to do a generatelist..
Something like this
$this->set(
'arr_relationship',
$this->Attribute->generateList(array('name' => 'Complexion'), 'id
ASC', 0, '{n}.Attribute.id', '{n}.Attribute.value')
);
MY QUESTION:::::
Should i call generateList as many times as i have an entry for in the
profile table or should i call findAll and attempt to build the array
structure myself or should i have multiple attribute tables for each
thing something like
CREATE TABLE `attributeappearances`
CREATE TABLE `attractivefeatures`
CREATE TABLE `career`
CREATE TABLE `children`
In terms of coding, its easier to break it out into multiple tables
but I don't know which is the better solution.
Thanks.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---