Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Database/Query/FMBaseBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -832,8 +832,8 @@ public function insert(array $values)

$this->fieldData = $this->mapFieldNamesForArray($values);

//TODO handle inserting multiple records at once, maybe?
//TODO handle setting portal data
// TODO handle inserting multiple records at once, maybe?
// TODO handle setting portal data

// Finally, we will run this query against the database connection and return
// the results. We will need to also flatten these bindings before running
Expand Down
15 changes: 14 additions & 1 deletion src/Services/FileMakerConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -874,7 +874,20 @@ public function setTimeout($timeout)

protected function getDefaultQueryGrammar()
{
return new FMGrammar;
// check if this is laravel 11 or 12
// Laravel 11 constructs a grammar without any parameters
// Laravel 12 requires a connection as a constructor parameter
$version = app()->version();
// get the major version number
$majorVersion = (int) explode('.', $version)[0];
if ($majorVersion < 12) {
// Laravel 11 and earlier
return new FMGrammar;
}

// Laravel 12
return new FMGrammar($this);

}

// public function getLayoutMetadata($layout = null)
Expand Down
12 changes: 6 additions & 6 deletions tests/Unit/FileMakerConnectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ protected function tearDown(): void
Mockery::close();
}

public function testConnectionGetsTheDefaultDatabaseConfiguration()
public function test_connection_gets_the_default_database_configuration()
{
$connection = app(FileMakerConnection::class);

$this->assertEquals('filemaker', $connection->getConfig('name'));
$this->assertEquals('tester', $connection->getConfig('database'));
}

public function testSetConnectionChangesTheDatabaseConfiguration()
public function test_set_connection_changes_the_database_configuration()
{
$connection = app(FileMakerConnection::class);
$this->assertEquals('filemaker', $connection->getConfig('name'));
Expand All @@ -39,7 +39,7 @@ public function testSetConnectionChangesTheDatabaseConfiguration()
$this->assertEquals('tester2', $connection->getConfig('database'));
}

public function testSetLayoutChangesTheLayoutUsed()
public function test_set_layout_changes_the_layout_used()
{
$connection = app(FileMakerConnection::class);
$this->assertEquals('', $connection->getLayout());
Expand All @@ -49,7 +49,7 @@ public function testSetLayoutChangesTheLayoutUsed()
$this->assertEquals('dapi-pet', $connection->getLayout());
}

public function testDatabasePrefixIsAddedToLayoutNames()
public function test_database_prefix_is_added_to_layout_names()
{
$connection = app(FileMakerConnection::class)->setConnection('prefix');

Expand All @@ -62,7 +62,7 @@ public function testDatabasePrefixIsAddedToLayoutNames()
$this->assertEquals('dapi-car', $connection->getLayout());
}

public function testLoginToFileMaker()
public function test_login_to_file_maker()
{
$this->overrideDBHost();
Http::fake([
Expand All @@ -77,7 +77,7 @@ public function testLoginToFileMaker()
$this->assertEquals('new-token', $token);
}

public function testFailedLoginToFileMakerThrow()
public function test_failed_login_to_file_maker_throw()
{
$this->overrideDBHost();
Http::fake([
Expand Down