I have two classes
class Product extends DataMapper {
var $has_one = array('category');
}
class Category extends DataMapper {
var $has_many = array('product');
}
I need to get the all the products for the category and its sub-categories. Any suggestions.
Category table looks like this:
id - int(11), parent - int(11), name - varchar(100), slug - varchar(100)
I found a solution here. Basically this is a one-to-many relation and can be achieved by implementing self-relationship.
Thanks anyways..!!