|
Classes summary
TActiveRecordBelongsTo |
Implements the foreign key relationship (TActiveRecord::BELONGS_TO) between the
source objects and the related foreign object. Consider the entity
relationship between a Team and a Player. <code> +------+ +--------+ |
Team | 1 <----- * | Player | +------+ +--------+ </code> Where one team
may have 0 or more players and each player belongs to only one team. We may
model Team-Player object relationship as active record as follows.
<code> class TeamRecord extends TActiveRecord { // see
TActiveRecordHasMany for detailed definition. } class PlayerRecord extends
TActiveRecord { const TABLE='player'; public $player_id; //primary key public
$team_name; //foreign key player.team_name <-> team.name public $age;
public $team; //foreign object TeamRecord |
TActiveRecordHasMany |
Implements TActiveRecord::HAS_MANY relationship between the source object having
zero or more foreign objects. Consider the entity relationship between a
Team and a Player. <code> +------+ +--------+ | Team | 1 <----- * |
Player | +------+ +--------+ </code> Where one team may have 0 or more
players and each player belongs to only one team. We may model Team-Player
object relationship as active record as follows. <code> class
TeamRecord extends TActiveRecord { const TABLE='team'; public $name; //primary
key public $location; |
TActiveRecordHasManyAssociation |
Implements the M-N (many to many) relationship via association table. Consider
the entity relationship between Articles and Categories via the
association table Article_Category. <code> +---------+
+------------------+ +----------+ | Article | * -----> * | Article_Category |
* <----- * | Category | +---------+ +------------------+ +----------+
</code> Where one article may have 0 or more categories and each category
may have 0 or more articles. We may model Article-Category object
relationship as active record as follows. <code> class ArticleRecord {
const TABLE='Article'; public $article_id; |
TActiveRecordHasOne |
TActiveRecordHasOne models the object relationship that a record (the source
object) property is an instance of foreign record object having a foreign key
related to the source object. The HAS_ONE relation is very similar to the
HAS_MANY relationship (in fact, it is equivalent in the entities relationship
point of view). |
TActiveRecordRelation |
Base class for active record relationships. |
TActiveRecordRelationContext |
TActiveRecordRelationContext holds information regarding record relationships
such as record relation property name, query criteria and foreign object record
class names. |
|