Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Many to Many on same table?
  • Hi all ;

    I have two users models with the same table (users, but with diferent Group user).

    I have Model_User, and Model_Companies. I separate it in 2 diferent models because it have diferent relations (Model_Companies can have many images for example), but they share some other logic (login logic, and others).

    But now i want to have a Many to Many relation between them, can i have any problem if I declare a direct "many_many" relation?


  • I can't think of one.
  • Thanks Harro for your response. 

     My question is because the users table is the same, and I don't know if ORM works fine with that. (Self Joins).

  • HarroHarro
    Accepted Answer
    ORM doesn't really care what the underlying tables are. And it generates queries with aliases, so I don't think having a table multiple times in a query is a problem.

    But you'll know when you try it, setting up the relation only takes 5 minutes...
  • Thanks Harro.

Howdy, Stranger!

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

In this Discussion