AbstractRelationship | --HasMany
Child classes:
- HasOne
- One-to-one relationship.
Class Details
One-to-many relationship.
# Table: people # Primary key: id # Foreign key: school_id class Person extends ActiveRecord\Model {} # Table: schools # Primary key: id class School extends ActiveRecord\Model { static $has_many = array( array('people') ); });
Example using options:
class Payment extends ActiveRecord\Model { static $belongs_to = array( array('person'), array('order') ); } class Order extends ActiveRecord\Model { static $has_many = array( array('people', 'through' => 'payments', 'select' => 'people.*, payments.amount', 'conditions' => 'payments.amount < 200') ); }