Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Recommended structure for related Data/Models
  • Hi,
    What is the best way to store data with different related data/models, in my case, categories?
    I have two different sets of categories for companies and jobs.
    I created the models (company, job) and now I need to created the related category for each.
    Do I:
    1. Name them companycategories and jobcategories so the related models, controllers and views would be named this way
    2. Or name them company_categories and job_categories so a subdirectory will be created in this way.
    3. Or simply create a single category model/table with an extra field to specify the related table (company, job)? Hope it's clear. thanks,
  • Option 3, in my opinion. If you're ever about to duplicate something, stop, it's always better to keep things simpler and just use two different fields.
  • Thank you. I guess I'll use this method with a bit field, like:
    0 => all
    1 => company only
    2 => job only
    .. and so on

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion