Created
July 10, 2013 19:33
-
-
Save boo1ean/5969451 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
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