|
2 | 2 |
|
3 | 3 | namespace Grimzy\LaravelMysqlSpatial;
|
4 | 4 |
|
| 5 | +use Doctrine\DBAL\Types\Type as DoctrineType; |
5 | 6 | use Grimzy\LaravelMysqlSpatial\Connectors\ConnectionFactory;
|
| 7 | +use Grimzy\LaravelMysqlSpatial\Doctrine\Geometry; |
| 8 | +use Grimzy\LaravelMysqlSpatial\Doctrine\GeometryCollection; |
| 9 | +use Grimzy\LaravelMysqlSpatial\Doctrine\LineString; |
| 10 | +use Grimzy\LaravelMysqlSpatial\Doctrine\MultiLineString; |
| 11 | +use Grimzy\LaravelMysqlSpatial\Doctrine\MultiPoint; |
| 12 | +use Grimzy\LaravelMysqlSpatial\Doctrine\MultiPolygon; |
| 13 | +use Grimzy\LaravelMysqlSpatial\Doctrine\Point; |
| 14 | +use Grimzy\LaravelMysqlSpatial\Doctrine\Polygon; |
6 | 15 | use Illuminate\Database\DatabaseManager;
|
7 | 16 | use Illuminate\Database\DatabaseServiceProvider;
|
8 | 17 |
|
@@ -32,22 +41,22 @@ public function register()
|
32 | 41 | return new DatabaseManager($app, $app['db.factory']);
|
33 | 42 | });
|
34 | 43 |
|
35 |
| - if (class_exists('Doctrine\DBAL\Types\Type')) { |
| 44 | + if (class_exists(DoctrineType::class)) { |
36 | 45 | // Prevent geometry type fields from throwing a 'type not found' error when changing them
|
37 | 46 | $geometries = [
|
38 |
| - 'geometry' => \Grimzy\LaravelMysqlSpatial\Doctrine\Geometry::class, |
39 |
| - 'point' => \Grimzy\LaravelMysqlSpatial\Doctrine\Point::class, |
40 |
| - 'linestring' => \Grimzy\LaravelMysqlSpatial\Doctrine\LineString::class, |
41 |
| - 'polygon' => \Grimzy\LaravelMysqlSpatial\Doctrine\Polygon::class, |
42 |
| - 'multipoint' => \Grimzy\LaravelMysqlSpatial\Doctrine\MultiPoint::class, |
43 |
| - 'multilinestring' => \Grimzy\LaravelMysqlSpatial\Doctrine\MultiLineString::class, |
44 |
| - 'multipolygon' => \Grimzy\LaravelMysqlSpatial\Doctrine\MultiPolygon::class, |
45 |
| - 'geometrycollection' => \Grimzy\LaravelMysqlSpatial\Doctrine\GeometryCollection::class, |
| 47 | + 'geometry' => Geometry::class, |
| 48 | + 'point' => Point::class, |
| 49 | + 'linestring' => LineString::class, |
| 50 | + 'polygon' => Polygon::class, |
| 51 | + 'multipoint' => MultiPoint::class, |
| 52 | + 'multilinestring' => MultiLineString::class, |
| 53 | + 'multipolygon' => MultiPolygon::class, |
| 54 | + 'geometrycollection' => GeometryCollection::class, |
46 | 55 | ];
|
47 |
| - $typeNames = array_keys(\Doctrine\DBAL\Types\Type::getTypesMap()); |
| 56 | + $typeNames = array_keys(DoctrineType::getTypesMap()); |
48 | 57 | foreach ($geometries as $type => $class) {
|
49 | 58 | if (!in_array($type, $typeNames)) {
|
50 |
| - \Doctrine\DBAL\Types\Type::addType($type, $class); |
| 59 | + DoctrineType::addType($type, $class); |
51 | 60 | }
|
52 | 61 | }
|
53 | 62 | }
|
|
0 commit comments