belongs to is used when the model belongs to another 1, its a reversed 1:1 or 1:N, in other words, you use this when you are working on the "slave" model, and use hasOne or hasMany when you are working with the "master" model.
Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Sorry, But I dont understand what u mean by Master or slave model. could u be pls more specific?
thx
Parent & Child, in a User > Profile relationship, the User would be the master and the Profile a slave, or User > Comment, but in some situations, you may want to start the relation with "Profile" instead of User, and in this case you need to use "belongsTo", because you are doing it in a reversed direction!
Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
I understand u now, but can I use BelongsTo if I have in slave table 4 records per 1 record in master?
for example, user (master) can have unlimited count of comments (slave).
Yes, but in this case you will get 4 records loaded, 1 for each comment, with the same user record!
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.