Skip to content

Instantly share code, notes, and snippets.

@boo1ean
Created July 10, 2013 19:33
Show Gist options
  • Save boo1ean/5969451 to your computer and use it in GitHub Desktop.
Save boo1ean/5969451 to your computer and use it in GitHub Desktop.
<?
class Customer extends \yii\db\ActiveRecord
{
public function getOrders()
{
return $this->hasMany('Order', array('customer_id' => 'id'));
}
}
class Order extends \yii\db\ActiveRecord
{
public function getCustomer()
{
return $this->hasOne('Customer', array('id' => 'customer_id'));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment