Skip to content

Commit 9476305

Browse files
authored
Merge pull request #11 from tarfin-labs/doctrine-type-error-fix
Doctrine unknown type error fixed.
2 parents 1215c85 + 48eaf48 commit 9476305

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
All notable changes to `laravel-spatial` will be documented in this file
44

5+
## 1.4.1 - 2022-09-05
6+
- Doctrtine unknown type error fixed.
7+
58
## 1.4.0 - 2022-07-24
69
- Locations that have zero points are excluded while getting the distance to a given location in `withingDistanceTo` scope.
710

phpunit.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,11 @@
1010
<directory>tests</directory>
1111
</testsuite>
1212
</testsuites>
13+
<php>
14+
<env name="DB_DRIVER" value="mysql"/>
15+
<env name="DB_HOST" value="127.0.0.1"/>
16+
<env name="DB_PORT" value="3306"/>
17+
<env name="DB_USERNAME" value="root"/>
18+
<env name="DB_DATABASE" value="laravel_spatial_test"/>
19+
</php>
1320
</phpunit>

src/LaravelSpatialServiceProvider.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace TarfinLabs\LaravelSpatial;
44

55
use Doctrine\DBAL\Types\Type;
6+
use Illuminate\Support\Facades\DB;
67
use Illuminate\Support\ServiceProvider;
78
use TarfinLabs\LaravelSpatial\Doctrine\Point;
89

@@ -37,6 +38,7 @@ public function register()
3738
foreach ($geometries as $type => $class) {
3839
if (!in_array($type, $typeNames)) {
3940
Type::addType($type, $class);
41+
DB::connection()->registerDoctrineType($class, $type, $type);
4042
}
4143
}
4244
}

tests/TestCase.php

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,6 @@ protected function defineDatabaseMigrations(): void
1111
$this->loadMigrationsFrom(__DIR__ . '/database/migrations');
1212
}
1313

14-
protected function defineEnvironment($app): void
15-
{
16-
$app['config']->set('database.default', 'mysql');
17-
$app['config']->set('database.connections.mysql', [
18-
'driver' => 'mysql',
19-
'host' => '127.0.0.1',
20-
'port' => env('DB_PORT', 3306),
21-
'database' => 'laravel_spatial_test',
22-
'username' => 'root',
23-
]);
24-
}
25-
2614
protected function getPackageProviders($app): array
2715
{
2816
return [

0 commit comments

Comments
 (0)