|
5 | 5 | import com.jetbrains.php.lang.psi.elements.Field;
|
6 | 6 | import com.jetbrains.php.lang.psi.elements.PhpAttribute;
|
7 | 7 | import com.jetbrains.php.lang.psi.elements.PhpClass;
|
8 |
| -import com.jetbrains.php.lang.psi.stubs.indexes.expectedArguments.PhpExpectedFunctionArgument; |
9 |
| -import com.jetbrains.php.lang.psi.stubs.indexes.expectedArguments.PhpExpectedFunctionClassConstantArgument; |
10 | 8 | import fr.adrienbrault.idea.symfony2plugin.doctrine.dict.DoctrineModelField;
|
11 | 9 | import fr.adrienbrault.idea.symfony2plugin.doctrine.metadata.dict.DoctrineMetadataModel;
|
12 | 10 | import fr.adrienbrault.idea.symfony2plugin.util.PhpElementsUtil;
|
@@ -90,12 +88,11 @@ public DoctrineMetadataModel getMetadata(@NotNull DoctrineMappingDriverArguments
|
90 | 88 | String substring = fqn.substring(fqn.lastIndexOf("\\") + 1);
|
91 | 89 | doctrineModelField.setRelationType(substring);
|
92 | 90 |
|
93 |
| - PhpExpectedFunctionArgument argument = PhpElementsUtil.findAttributeArgumentByName("targetEntity", attribute); |
94 |
| - if (argument instanceof PhpExpectedFunctionClassConstantArgument) { |
95 |
| - String repositoryClassRaw = ((PhpExpectedFunctionClassConstantArgument) argument).getClassFqn(); |
96 |
| - if (StringUtils.isNotBlank(repositoryClassRaw)) { |
97 |
| - doctrineModelField.setRelation(repositoryClassRaw); |
98 |
| - } |
| 91 | + // not resolving same entity namespace prefix: EntityHelper.resolveDoctrineLikePropertyClass |
| 92 | + // possible not a wide range usages for attributes |
| 93 | + String targetEntity = PhpElementsUtil.getAttributeArgumentStringByName(attribute, "targetEntity"); |
| 94 | + if (StringUtils.isNotBlank(targetEntity)) { |
| 95 | + doctrineModelField.setRelation("\\" + StringUtils.stripStart(targetEntity, "\\")); |
99 | 96 | }
|
100 | 97 | }
|
101 | 98 | }
|
|
0 commit comments