| Total Complexity | 6 |
| Total Lines | 33 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 13 | class ActiveRecord extends BaseActiveRecord |
||
| 14 | { |
||
| 15 | /** |
||
| 16 | * Get the primary key column as string if the one-column PK |
||
| 17 | * NB! Always use single column Primary-keys! |
||
| 18 | * NB! this assumes that primary key always has the table_name_id format |
||
| 19 | * @return string |
||
| 20 | * @throws NotSupportedException if multi-column PrimaryKey is used |
||
| 21 | */ |
||
| 22 | public function primaryKeySingle() |
||
| 28 | } |
||
| 29 | |||
| 30 | /** {@inheritdoc} */ |
||
| 31 | public function hasMany($class, $link = null) |
||
| 32 | { |
||
| 33 | if (empty($link)) { |
||
| 34 | $link = [$this->primaryKeySingle() => $this->primaryKeySingle()]; |
||
| 35 | } |
||
| 36 | return parent::hasMany($class, $link); |
||
| 37 | } |
||
| 38 | |||
| 39 | /** {@inheritdoc} */ |
||
| 40 | public function hasOne($class, $link = null) |
||
| 46 | } |
||
| 47 | |||
| 48 | } |