blob: 51e81bb6bfad1cca5336c0a35024c5d899821cd9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
<?php
namespace ipl\Orm\Exception;
use Exception;
use ipl\Orm\Model;
class InvalidRelationException extends Exception
{
/** @var string The relation name */
protected $relation;
/** @var Model The target model */
protected $model;
/**
* Create a new InvalidRelationException
*
* @param string $relation The relation name
* @param Model $model The target model
*/
public function __construct($relation, Model $model = null)
{
$this->relation = (string) $relation;
$this->model = $model;
parent::__construct(sprintf(
'Cannot join relation "%s"%s. Relation not found.',
$relation,
$model ? ' in model ' . get_class($model) : ''
));
}
/**
* Get the relation name
*
* @return string
*/
public function getRelation()
{
return $this->relation;
}
/**
* Get the target model
*
* @return Model
*/
public function getModel()
{
return $this->model;
}
}
|