Answer the question
In order to leave comments, you need to log in
How to get the number of rows in a bunch of Yii2 tables?
I'm working on a project using the Yii2 framework.
Essence:
There are three tables in a DB. In ActiveRecord, they are linked sequentially: the Section table is linked to Topic (hasMany), the Topic table is linked to Message (also hasMany).
I need to get a list of all Sections, each of which will contain a list of Topics belonging to Sections + immediately the number of all Messages for each Topic.
It would seem that the task is not difficult, but for some reason I have been staring at the documentation for the second day and I can’t figure out how to implement this using Yii2 ActiveRecord.
I would be grateful if someone will respond and tell me what's what.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question