blob: 303a1440d7ff0998eabe5493adc409434c7169c6 [file] [log] [blame]
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +02001<?php
2
3namespace LdapRecord\Models\Relations;
4
5use LdapRecord\Query\Collection;
6
7class HasManyIn extends OneToMany
8{
9 /**
10 * Get the relationships results.
11 *
12 * @return Collection
13 */
14 public function getRelationResults()
15 {
16 $results = $this->parent->newCollection();
17
18 foreach ((array) $this->parent->getAttribute($this->relationKey) as $value) {
19 if ($foreign = $this->getForeignModelByValue($value)) {
20 $results->push($foreign);
21 }
22 }
23
24 return $this->transformResults($results);
25 }
26}