diff --git a/src/com/magento/idea/magento2plugin/actions/generation/generator/UiComponentFormGenerator.java b/src/com/magento/idea/magento2plugin/actions/generation/generator/UiComponentFormGenerator.java index 3918ba998..1e41dc0d2 100644 --- a/src/com/magento/idea/magento2plugin/actions/generation/generator/UiComponentFormGenerator.java +++ b/src/com/magento/idea/magento2plugin/actions/generation/generator/UiComponentFormGenerator.java @@ -149,6 +149,14 @@ protected PsiFile createForm( protected void fillAttributes(final @NotNull Properties attributes) { final PhpClassTypesBuilder phpClassTypesBuilder = new PhpClassTypesBuilder(); + if (data.getFields().isEmpty()) { + phpClassTypesBuilder + .appendProperty("PRIMARY_FIELD", ""); + } else { + phpClassTypesBuilder + .appendProperty("PRIMARY_FIELD", data.getFields().get(0).getName()); + } + phpClassTypesBuilder .appendProperty("NAME", data.getFormName()) .appendProperty("LABEL", data.getLabel()) @@ -165,7 +173,6 @@ protected void fillAttributes(final @NotNull Properties attributes) { data.getDataProviderPath() ).getClassFqn() ) - .appendProperty("PRIMARY_FIELD", data.getFields().get(0).getName()) .mergeProperties(attributes); }