| @@ 8-24 (lines=17) @@ | ||
| 5 | use hiqdev\php\billing\Customer as Entity; |
|
| 6 | use yii\db\ActiveRecord; |
|
| 7 | ||
| 8 | class Customer extends ActiveRecord |
|
| 9 | { |
|
| 10 | public static function tableName() |
|
| 11 | { |
|
| 12 | return 'zclient'; |
|
| 13 | } |
|
| 14 | ||
| 15 | public function getSeller() |
|
| 16 | { |
|
| 17 | return $this->hasOne(Customer::class, ['obj_id' => 'seller_id']); |
|
| 18 | } |
|
| 19 | ||
| 20 | public function getEntity() |
|
| 21 | { |
|
| 22 | return new Entity($this->obj_id, $this->login); |
|
| 23 | } |
|
| 24 | } |
|
| 25 | ||
| @@ 8-24 (lines=17) @@ | ||
| 5 | use hiqdev\php\billing\Target as Entity; |
|
| 6 | use yii\db\ActiveRecord; |
|
| 7 | ||
| 8 | class Target extends ActiveRecord |
|
| 9 | { |
|
| 10 | public static function tableName() |
|
| 11 | { |
|
| 12 | return 'obj'; |
|
| 13 | } |
|
| 14 | ||
| 15 | public function getSeller() |
|
| 16 | { |
|
| 17 | return $this->hasOne(Customer::class, ['obj_id' => 'seller_id']); |
|
| 18 | } |
|
| 19 | ||
| 20 | public function getEntity() |
|
| 21 | { |
|
| 22 | return new Entity($this->obj_id, $this->login); |
|
| 23 | } |
|
| 24 | } |
|
| 25 | ||