Skip to content

Commit

Permalink
Merge pull request #11 from tarfin-labs/doctrine-type-error-fix
Browse files Browse the repository at this point in the history
Doctrine unknown type error fixed.
  • Loading branch information
tkaratug committed Sep 5, 2022
2 parents 1215c85 + 48eaf48 commit 9476305
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

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

## 1.4.1 - 2022-09-05
- Doctrtine unknown type error fixed.

## 1.4.0 - 2022-07-24
- Locations that have zero points are excluded while getting the distance to a given location in `withingDistanceTo` scope.

Expand Down
7 changes: 7 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,11 @@
<directory>tests</directory>
</testsuite>
</testsuites>
<php>
<env name="DB_DRIVER" value="mysql"/>
<env name="DB_HOST" value="127.0.0.1"/>
<env name="DB_PORT" value="3306"/>
<env name="DB_USERNAME" value="root"/>
<env name="DB_DATABASE" value="laravel_spatial_test"/>
</php>
</phpunit>
2 changes: 2 additions & 0 deletions src/LaravelSpatialServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace TarfinLabs\LaravelSpatial;

use Doctrine\DBAL\Types\Type;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\ServiceProvider;
use TarfinLabs\LaravelSpatial\Doctrine\Point;

Expand Down Expand Up @@ -37,6 +38,7 @@ public function register()
foreach ($geometries as $type => $class) {
if (!in_array($type, $typeNames)) {
Type::addType($type, $class);
DB::connection()->registerDoctrineType($class, $type, $type);
}
}
}
Expand Down
12 changes: 0 additions & 12 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,6 @@ protected function defineDatabaseMigrations(): void
$this->loadMigrationsFrom(__DIR__ . '/database/migrations');
}

protected function defineEnvironment($app): void
{
$app['config']->set('database.default', 'mysql');
$app['config']->set('database.connections.mysql', [
'driver' => 'mysql',
'host' => '127.0.0.1',
'port' => env('DB_PORT', 3306),
'database' => 'laravel_spatial_test',
'username' => 'root',
]);
}

protected function getPackageProviders($app): array
{
return [
Expand Down

0 comments on commit 9476305

Please sign in to comment.