This class seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate
the same code in three or more different places, we strongly encourage you to
look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.
Loading history...
8
{
9
/**
10
* Get the results of the relationship.
11
*
12
* @param $relation
13
* @return mixed
14
*/
15
public function getResults($relation)
16
{
17
$result = $this->query->first();
18
19
$this->cacheRelation($result, $relation);
20
21
return $result;
22
}
23
24
/**
25
* Get the results of the relationship.
26
*
27
* @return mixed
28
*/
29
public function fetch()
30
{
31
return $this->query->first();
32
}
33
34
35
/**
36
* Initialize the relation on a set of entities.
37
*
38
* @param \Analogue\ORM\Entity[] $entities
39
* @param string $relation
40
* @return array
41
*/
42
public function initRelation(array $entities, $relation)
43
{
44
foreach ($entities as $entity) {
45
$entity->setEntityAttribute($relation, null);
46
}
47
48
return $entities;
49
}
50
51
/**
52
* Match the eagerly loaded results to their parents.
53
*
54
* @param \Analogue\ORM\Entity[] $entities
55
* @param EntityCollection $results
56
* @param string $relation
57
* @return array
58
*/
59
public function match(array $entities, EntityCollection $results, $relation)
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.