| Conditions | 2 |
| Paths | 2 |
| Total Lines | 15 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 21 | public function for(Record $model, $collection) |
||
| 22 | { |
||
| 23 | if ($model->hasRelation('MediaProperties')) { |
||
| 24 | return $model->getRelation('MediaProperties')->getResults()->filter( |
||
|
|
|||
| 25 | function ($item) use ($collection) { |
||
| 26 | return $item->collection_name == $collection; |
||
| 27 | } |
||
| 28 | )->current(); |
||
| 29 | } |
||
| 30 | |||
| 31 | return $this->findOneByParams([ |
||
| 32 | 'where' => [ |
||
| 33 | ['model =?', $model->getManager()->getController()], |
||
| 34 | ['model_id =?', $model->getPrimaryKey()], |
||
| 35 | ['collection_name=?', $collection] |
||
| 36 | ] |
||
| 63 |