I am new in CakePHP. I am facing problem to use parent_id of category
table.
Here is my code details:
categories Table:
`categoryId` int(10) NOT NULL auto_increment,
`categoryName` varchar(100) NOT NULL,
`parentId` int(10) NOT NULL default 0,
`isActive` enum('Y','N') NOT NULL default 'Y',
PRIMARY KEY (`categoryId`)
class category extends AppModel
{
var $name = 'Category';
var $primaryKey = 'categoryId';
var $validate = array(
'categoryName' => VALID_NOT_EMPTY,
);
}
I want to introduce the parentID in this Model, this parentId is
actually foreign key to locate the parent category of any sub-
category. The categoryID of any parent category will be insert as
parentId column of any subcategory and in case of parent category it
will be 0.
What change I have to do in the controller to make this relation. How
i have to use this model to display all the category name with its
parent category?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" 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
-~----------~----~----~----~------~----~------~--~---