| Conditions | 4 |
| Paths | 4 |
| Total Lines | 17 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 12 |
| CRAP Score | 4 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 15 | 40 | public function addEagerConstraints(array $models) |
|
| 16 | { |
||
| 17 | 40 | if ($this->customEagerConstraintsCallback) { |
|
| 18 | 12 | ($this->customEagerConstraintsCallback)($this->query, $models); |
|
| 19 | 12 | return; |
|
| 20 | } |
||
| 21 | |||
| 22 | 28 | if ($this->hasLeadingCompositeKey()) { |
|
|
|
|||
| 23 | 4 | $this->addEagerConstraintsWithCompositeKey($models); |
|
| 24 | } else { |
||
| 25 | 24 | parent::addEagerConstraints($models); |
|
| 26 | |||
| 27 | 24 | if (is_array($this->foreignKeys[0])) { |
|
| 28 | 2 | $this->query->where( |
|
| 29 | 2 | $this->throughParent->qualifyColumn($this->foreignKeys[0][0]), |
|
| 30 | 2 | '=', |
|
| 31 | 2 | $this->farParent->getMorphClass() |
|
| 32 | 2 | ); |
|
| 62 |