| Total Complexity | 3 |
| Total Lines | 13 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 10 | class ManyToOne extends Relation |
||
| 11 | { |
||
| 12 | protected $type = RelationConfig::TYPE_MANY_TO_ONE; |
||
| 13 | |||
| 14 | protected $foreignKey = 'id'; |
||
| 15 | |||
| 16 | public function setForeignMapper($foreignMapper): Relation |
||
| 17 | { |
||
| 18 | if ($foreignMapper && ! $this->nativeKey) { |
||
| 19 | $this->nativeKey = Inflector::singularize($foreignMapper) . '_id'; |
||
| 20 | } |
||
| 21 | |||
| 22 | return parent::setForeignMapper($foreignMapper); |
||
| 23 | } |
||
| 25 |