From f2e0b62dca172bc12faffbe8e0aee3006c943cb6 Mon Sep 17 00:00:00 2001 From: Jan Skrasek Date: Wed, 5 May 2021 22:26:03 +0200 Subject: [PATCH] entity finder: skip invalid repository types (e.g. IRepository interface) [closes #18] --- changelog.md | 3 +++ src/main/kotlin/org/nextras/orm/intellij/utils/OrmUtils.kt | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/changelog.md b/changelog.md index 23b4416..6774ee5 100644 --- a/changelog.md +++ b/changelog.md @@ -5,5 +5,8 @@ ### Added - Added auto-completion & reference to entity properties in hasValue() method. +### Fixed +- Fixed entity type resolution for variables typed with "resolution-invalid" types (e.g. `IRepository` interface); closes #18 + ### Changed - The plugin internal continuous delivery system & checks reworked. diff --git a/src/main/kotlin/org/nextras/orm/intellij/utils/OrmUtils.kt b/src/main/kotlin/org/nextras/orm/intellij/utils/OrmUtils.kt index 68e8864..008e8cc 100644 --- a/src/main/kotlin/org/nextras/orm/intellij/utils/OrmUtils.kt +++ b/src/main/kotlin/org/nextras/orm/intellij/utils/OrmUtils.kt @@ -44,13 +44,13 @@ object OrmUtils { for (repositoryClass in repositories) { val entityNamesMethod = repositoryClass.findMethodByName("getEntityClassNames") ?: return emptyList() if (entityNamesMethod.lastChild !is GroupStatement) { - return emptyList() + continue } if ((entityNamesMethod.lastChild as GroupStatement).firstPsiChild !is PhpReturn) { - return emptyList() + continue } if ((entityNamesMethod.lastChild as GroupStatement).firstPsiChild!!.firstPsiChild !is ArrayCreationExpression) { - return emptyList() + continue } val arr = (entityNamesMethod.lastChild as GroupStatement).firstPsiChild!!.firstPsiChild as ArrayCreationExpression?