| @@ 36-51 (lines=16) @@ | ||
| 33 | * |
|
| 34 | * @return Schema |
|
| 35 | */ |
|
| 36 | public function getSchema($schema) |
|
| 37 | { |
|
| 38 | if (! $this->container->has($schema)) { |
|
| 39 | $this->container->register($schema); // auto-wiring (for Schema with no special constructor dependencies) |
|
| 40 | } |
|
| 41 | ||
| 42 | $schema = $this->container->get($schema); |
|
| 43 | ||
| 44 | if (! $schema instanceof Schema) { |
|
| 45 | $class_name = get_class($schema); |
|
| 46 | ||
| 47 | throw new UnexpectedValueException("{$class_name} does not extend the Schema class"); |
|
| 48 | } |
|
| 49 | ||
| 50 | return $schema; |
|
| 51 | } |
|
| 52 | ||
| 53 | /** |
|
| 54 | * @param string $sql |
|
| @@ 27-42 (lines=16) @@ | ||
| 24 | /** |
|
| 25 | * @inheritdoc |
|
| 26 | */ |
|
| 27 | public function getType($type) |
|
| 28 | { |
|
| 29 | if (! $this->has($type)) { |
|
| 30 | $this->register($type); // auto-wiring (for Types with no special constructor dependencies) |
|
| 31 | } |
|
| 32 | ||
| 33 | $type = $this->get($type); |
|
| 34 | ||
| 35 | if (! $type instanceof Type) { |
|
| 36 | $class_name = get_class($type); |
|
| 37 | ||
| 38 | throw new UnexpectedValueException("{$class_name} does not implement the Type interface"); |
|
| 39 | } |
|
| 40 | ||
| 41 | return $type; |
|
| 42 | } |
|
| 43 | ||
| 44 | /** |
|
| 45 | * @inheritdoc |
|