Thiago Belem
Thiago Belem

Reputation: 7832

Methods of a "belongs to" and "has many" relationships

Let's say that I have two tables in my database:

users
countries

I have two defined relationships on each user belongsTo a country and each country hasMany users.. (CakePHP model relationships)

And I want to create the model findUsersFromCountry($countryID) in which class/model this method will be? It must be inside the User model or the Country model?

Upvotes: 0

Views: 174

Answers (1)

Pascal MARTIN
Pascal MARTIN

Reputation: 401182

What will your method return ? Or what kind of data will your method manipulate ?

If your method works on Users (it does), I would have it in the User class.

Upvotes: 1

Related Questions