Skip to content

Commit 998f158

Browse files
committed
improved checks for configs
1 parent f061b0e commit 998f158

File tree

5 files changed

+6
-7
lines changed

5 files changed

+6
-7
lines changed

src/Database/Eloquent/Concerns/FMGuardsAttributes.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ protected function getColumns($forceRefresh = false): array
6060
$refreshCallback = function () {
6161
$layoutMetaData = $this->getConnection()->getLayoutMetadata($this->table);
6262

63-
return array_column($layoutMetaData['fieldMetaData'], 'name');
63+
return array_column($layoutMetaData['response']['fieldMetaData'], 'name');
6464
};
6565

6666
if ($forceRefresh) {

src/Database/Eloquent/FMEloquentBuilder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,8 +265,8 @@ public function paginate($perPage = null, $columns = ['*'], $pageName = 'page',
265265
/**
266266
* Compares a model's modified portal data and original portal data and returns portal data with only modified fields and recordIds
267267
*
268-
* @param $array1 array The modified portal data
269-
* @param $array2 array The model's original portal data
268+
* @param $array1 array The modified portal data
269+
* @param $array2 array The model's original portal data
270270
*/
271271
protected function getOnlyModifiedPortalFields($array1, $array2): array
272272
{

src/Database/Eloquent/FMModel.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,8 @@ public static function createFromRecord($record)
122122
}
123123

124124
// check our config to see if we should map empty strings to null - users may decide they don't want this
125-
if (config('eloquent-filemaker.empty_strings_to_null', true)) {
125+
$emptyStringToNull = $instance->getConnection()->getConfig()['empty_strings_to_null'] ?? true;
126+
if ($emptyStringToNull) {
126127
// map each value to null if it's an empty string
127128
$fieldData = collect($fieldData)->map(function ($value) {
128129
return $value === '' ? null : $value;

src/Middleware/EndSession.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function handle(Request $request, Closure $next): Response
2727
*/
2828
public function terminate(Request $request, Response $response): void
2929
{
30-
$shouldCacheSessionToken = FM::connection()->getConfig()['cache_session_token'];
30+
$shouldCacheSessionToken = FM::connection()->getConfig()['cache_session_token'] ?? false;
3131
if ($shouldCacheSessionToken) {
3232
return;
3333
}

src/Services/FileMakerConnection.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ class FileMakerConnection extends Connection
4040

4141
protected $emptyStringToNull = true;
4242

43-
public const CONFIG_KEY_CACHE_SESSION_TOKEN = 'eloquent-filemaker.cache_session_token';
44-
4543
public function __construct($pdo, $database = '', $tablePrefix = '', array $config = [])
4644
{
4745

0 commit comments

Comments
 (0)