Skip to main content

Posts

Showing posts from September, 2014

YII relation ships join queries

Relational Active Record Declaring Relationship Performing Relational Query Performing Relational query without getting related models Relational Query Options Disambiguating Column Names Dynamic Relational Query Options Relational Query Performance Statistical Query Relational Query with Named Scopes Relational Query with through We have already seen how to use Active Record (AR) to select data from a single database table. In this section, we describe how to use AR to join several related database tables and bring back the joint data set. In order to use relational AR, it is recommended that primary-foreign key constraints are declared for tables that need to be joined. The constraints will help to keep the consistency and integrity of the relational data. For simplicity, we will use the database schema shown in the following entity-relationship (ER) diagram to illustrate examples in this section. ER Diagram Info:  Support for foreign key constraints varie