@@ 30-43 (lines=14) @@ | ||
27 | } |
|
28 | } |
|
29 | ||
30 | public function mapEntity($space, $class) |
|
31 | { |
|
32 | $this->validateSpace($space); |
|
33 | ||
34 | if(!class_exists($class)) { |
|
35 | throw new Exception("No class $class"); |
|
36 | } |
|
37 | ||
38 | if(!is_subclass_of($class, Entity::class)) { |
|
39 | throw new Exception("Entity should extend " . Entity::class . " class"); |
|
40 | } |
|
41 | ||
42 | $this->entities[$space] = $class; |
|
43 | } |
|
44 | ||
45 | public function mapRepository($space, $class) |
|
46 | { |
|
@@ 45-58 (lines=14) @@ | ||
42 | $this->entities[$space] = $class; |
|
43 | } |
|
44 | ||
45 | public function mapRepository($space, $class) |
|
46 | { |
|
47 | $this->validateSpace($space); |
|
48 | ||
49 | if(!class_exists($class)) { |
|
50 | throw new Exception("No class $class"); |
|
51 | } |
|
52 | ||
53 | if(!is_subclass_of($class, Repository::class)) { |
|
54 | throw new Exception("Repository should extend " . Repository::class . " class"); |
|
55 | } |
|
56 | ||
57 | $this->repositories[$space] = $class; |
|
58 | } |
|
59 | ||
60 | public function validateSpace($space) |
|
61 | { |