| Total Complexity | 6 |
| Total Lines | 38 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 14 | class ActiveRecord extends BaseActiveRecord |
||
| 15 | { |
||
| 16 | use ConsoleAwareTrait; |
||
| 17 | |||
| 18 | /** @var bool */ |
||
| 19 | public $isSearchModel = false; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * Get the primary key column as string if the one-column PK |
||
| 23 | * NB! Always use single column Primary-keys! |
||
| 24 | * NB! this assumes that primary key always has the table_name_id format |
||
| 25 | * @return string |
||
| 26 | * @throws NotSupportedException if multi-column PrimaryKey is used |
||
| 27 | */ |
||
| 28 | public function primaryKeySingle() |
||
| 34 | } |
||
| 35 | |||
| 36 | /** {@inheritdoc} */ |
||
| 37 | public function hasMany($class, $link = null) |
||
| 38 | { |
||
| 39 | if (empty($link)) { |
||
| 40 | $link = [$this->primaryKeySingle() => $this->primaryKeySingle()]; |
||
| 41 | } |
||
| 42 | return parent::hasMany($class, $link); |
||
| 43 | } |
||
| 44 | |||
| 45 | /** {@inheritdoc} */ |
||
| 46 | public function hasOne($class, $link = null) |
||
| 52 | } |
||
| 53 | |||
| 54 | } |