I could only found the HAS_ONE and HAS_MANY relationships, but I wasn’t able to find the BELONGS_TO relationship. What happened?
I could only found the HAS_ONE and HAS_MANY relationships, but I wasn’t able to find the BELONGS_TO relationship. What happened?
It’s not needed because it’s has_one essentially.
Hi,
It is replaced by a simple "has one" relation.
And it makes sense when you think about it.
"Belongs to" was just another "definition" for the same thing a "has one" relation does.
Author "HAS MANY" posts.
Post "HAS ONE" author.
See "Declaring Relations":
http://www.yiiframework.com/doc-2.0/guide-db-active-record.html#relational-data
Regards