Skip to content

Commit 97b4cbd

Browse files
committed
Fixed php file retrieving on Windows
1 parent c13a59d commit 97b4cbd

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/main/kotlin/com/magento/idea/magento2plugin/mcp/MagentoEntityCrudCommands.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ import com.magento.idea.magento2plugin.magento.packages.PropertiesTypes
3737
import com.magento.idea.magento2plugin.magento.packages.uicomponent.FormElementType
3838
import com.magento.idea.magento2plugin.util.CamelCaseToSnakeCase
3939
import com.magento.idea.magento2plugin.util.GetFirstClassOfFile
40-
import com.magento.idea.magento2plugin.util.GetPhpClassByFQN
4140
import com.magento.idea.magento2plugin.util.RegExUtil
4241
import com.magento.idea.magento2plugin.util.php.PhpTypeMetadataParserUtil
4342
import java.util.Locale
@@ -263,7 +262,8 @@ internal object MagentoEntityCrudCommands {
263262
createWebApi = createWebApi
264263
)
265264
val duplicatePhpFile = expectedPhpFiles.firstOrNull { file ->
266-
GetPhpClassByFQN.getInstance(project).execute(file.classFqn) != null
265+
val relativePath = MagentoMcpCreateSupport.phpFileRelativePath(file)
266+
moduleContext.moduleDirectory.virtualFile.findFileByRelativePath(relativePath) != null
267267
}
268268
if (duplicatePhpFile != null) {
269269
throw EntityCrudValidationException("PHP class \"${duplicatePhpFile.classFqn}\" already exists.")

src/main/kotlin/com/magento/idea/magento2plugin/mcp/MagentoModuleCommands.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,8 +268,11 @@ internal object MagentoModuleCommands {
268268
}
269269

270270
private fun refreshCreatedModuleTree(vararg directories: PsiDirectory) {
271-
val virtualFiles = directories.map { it.virtualFile }.toTypedArray()
271+
val virtualFiles = directories.map { it.virtualFile }
272+
.filter { it.isValid }
273+
.toTypedArray()
272274
VfsUtil.markDirtyAndRefresh(false, true, true, *virtualFiles)
275+
virtualFiles.forEach { it.refresh(false, true) }
273276
}
274277

275278
private fun resolveMagentoRootDirectory(project: Project, configuredRoot: String): PsiDirectory? {

0 commit comments

Comments
 (0)