. . .

Specifying nested relations for eager loading

Published: April 12, 2011

Eager loading can be nested. For example, if for every comment, we also want to know its author, we could use the following ‘with’ find:

 

// find all posts together with their author and the author's profile

Post::model()->with('author','author.profile')->findAll();

 

Don't forget to share this post

    Let's Build Digital Excellence Together


    • Cost Efficient Solutions.
    • Minimal Timelines.
    • Effective Communication.
    • High Quality Standards.
    • Lifetime Support.
    • Transparent Execution.
    • 24/7 Availability.
    • Scalable Teams.

    Join Our 200+ Happy Clients Across Globe


    Free Consultation.

      Do you need help in strategy, innovation or growth of your startup/business? Experts from our team will get in touch with you.

      Please do not post jobs/internships inquiries here.