From ad710efbc3a1becf1433fcc042d606789c401d38 Mon Sep 17 00:00:00 2001 From: Zach Garwood Date: Mon, 18 Nov 2024 15:23:36 -0600 Subject: [PATCH] Create Twill v3 version of api model patch [WEB-2956] --- composer.lock | 2 +- .../WEB-2301---get-repository-of-API-models.diff | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/composer.lock b/composer.lock index b4276b0504..757280440f 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "69dd7545eae675260459358169e381ed", + "content-hash": "afb7a824c1ec47b590a8761a7dc6a596", "packages": [ { "name": "aic/data-hub-foundation", diff --git a/patches/WEB-2301---get-repository-of-API-models.diff b/patches/WEB-2301---get-repository-of-API-models.diff index 31c2ee34ff..a47a443278 100644 --- a/patches/WEB-2301---get-repository-of-API-models.diff +++ b/patches/WEB-2301---get-repository-of-API-models.diff @@ -1,13 +1,13 @@ diff --git a/src/Repositories/ModuleRepository.php b/src/Repositories/ModuleRepository.php -index cb6986e0..bf268cc9 100644 +index 47e56466..5172e25d 100644 --- a/src/Repositories/ModuleRepository.php +++ b/src/Repositories/ModuleRepository.php -@@ -867,6 +867,8 @@ abstract class ModuleRepository - if (!$modelOrRepository) { - if (class_exists($relation) && (new $relation) instanceof Model) { - $modelOrRepository = str_after_last($relation, '\\'); -+ } elseif (class_exists($relation) && (new $relation) instanceof \App\Libraries\Api\Models\BaseApiModel) { -+ $modelOrRepository = 'Api\\' .str_after_last($relation, '\\'); +@@ -696,6 +696,8 @@ abstract class ModuleRepository + if (! $modelOrRepository) { + if (class_exists($relation) && (new $relation()) instanceof Model) { + $modelOrRepository = Str::afterLast($relation, '\\'); ++ } elseif (class_exists($relation) && (new $relation()) instanceof \App\Libraries\Api\Models\BaseApiModel) { ++ $modelOrRepository = 'Api\\' . Str::afterLast($relation, '\\'); } else { $morphedModel = Relation::getMorphedModel($relation); - if (class_exists($morphedModel) && (new $morphedModel) instanceof Model) { + if (class_exists($morphedModel) && (new $morphedModel()) instanceof Model) {