in order to save 2 db access, I would like to populate related record for a BELONG_TO relation and so call addRelatedRecord() :

 	$model = new UserCategoryModel();

 	// of course the UserCategoryModel defines 2 BELONG_TO 

	//relations called 'user' and 'category'



… however, the warning in the doc kinds of freak me out !!

:( (ok, exclamation marks are not in the doc)

This method is public, so why this warning ?


in it says:

"Do not call this method. This method is used internally by CActiveFinder to populate related objects. This method adds a related object to this record."

Hi ragua,

yes I know, that was the purpose of my question actually : this method is public (and it seems that is could fit my needs), but then there is this warning…

Marking a public method as "internal" allows framework developers to change its signature (or even remove it completely) in future releases without breaking backward compatibility.

While the above is not considered a good practice, it’s sometimes unavoidable.

hi phtamas,

yes, what you point out is the only good reason why addRelatedRecord() should not be called. Too bad because setting manually related record for BELONG_TO relation could have saved me 2 db access.

Thanks for your reply.