@@ 78-85 (lines=8) @@ | ||
75 | * @return null|RecordInterface Entity instance |
|
76 | * @throws EntityNotFound |
|
77 | */ |
|
78 | public function entity($entity) |
|
79 | { |
|
80 | if (class_exists($entity)) { |
|
81 | return new $entity($this); |
|
82 | } else { |
|
83 | throw new EntityNotFound('['.$entity.'] not found'); |
|
84 | } |
|
85 | } |
|
86 | ||
87 | /** |
|
88 | * Get entity query manager |
@@ 148-158 (lines=11) @@ | ||
145 | * @return Query Chaining |
|
146 | * @throws EntityNotFound |
|
147 | */ |
|
148 | public function entity($entity) |
|
149 | { |
|
150 | if (class_exists($entity)) { |
|
151 | $this->flush(); |
|
152 | $this->class_name = $entity; |
|
153 | } else { |
|
154 | throw new EntityNotFound('['.$entity.'] not found'); |
|
155 | } |
|
156 | ||
157 | return $this; |
|
158 | } |
|
159 | ||
160 | /** |
|
161 | * Get correct query condition depending on entity field name. |