OOP PHP make separate classes or one
- by user2956219
I'm studying OOP PHP and working on a small personal project but I have hard time grasping some concepts. Let's say I have a list of items, each item belongs to subcategory, and each subcategory belongs to category.
So should I make separate classes for category (with methods to list all categories, add new category, delete category), class for subcategories and class for items? Or should I make creating, listing and deleting categories as methods for item class?
Both category and subcategory are very simple and basically consist of ID, Name and parentID (for subcategory).