| @@ 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 |
|
| @@ 131-141 (lines=11) @@ | ||
| 128 | * @return Query Chaining |
|
| 129 | * @throws EntityNotFound |
|
| 130 | */ |
|
| 131 | public function entity($entity) |
|
| 132 | { |
|
| 133 | if (class_exists($entity)) { |
|
| 134 | $this->flush(); |
|
| 135 | $this->class_name = $entity; |
|
| 136 | } else { |
|
| 137 | throw new EntityNotFound('['.$entity.'] not found'); |
|
| 138 | } |
|
| 139 | ||
| 140 | return $this; |
|
| 141 | } |
|
| 142 | ||
| 143 | /** |
|
| 144 | * Get correct query condition depending on entity field name. |
|