@@ -66,6 +66,8 @@ public function __construct($dependentEntities = null)
66
66
* @return array
67
67
* @throws \Exception
68
68
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
69
+ * @SuppressWarnings(PHPMD.NPathComplexity)
70
+ * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
69
71
*/
70
72
public function resolveOperationDataArray ($ entityObject , $ operationMetadata , $ operation , $ fromArray = false )
71
73
{
@@ -134,6 +136,13 @@ public function resolveOperationDataArray($entityObject, $operationMetadata, $op
134
136
));
135
137
}
136
138
} else {
139
+ $ operationElementProperty = null ;
140
+ if (strpos ($ operationElementType , '. ' ) !== false ) {
141
+ $ operationElementComponents = explode ('. ' , $ operationElementType );
142
+ $ operationElementType = $ operationElementComponents [0 ];
143
+ $ operationElementProperty = $ operationElementComponents [1 ];
144
+ }
145
+
137
146
$ entityNamesOfType = $ entityObject ->getLinkedEntitiesOfType ($ operationElementType );
138
147
139
148
// If an element is required by metadata, but was not provided in the entity, throw an exception
@@ -146,12 +155,23 @@ public function resolveOperationDataArray($entityObject, $operationMetadata, $op
146
155
));
147
156
}
148
157
foreach ($ entityNamesOfType as $ entityName ) {
149
- $ operationDataSubArray = $ this ->resolveNonPrimitiveElement (
150
- $ entityName ,
151
- $ operationElement ,
152
- $ operation ,
153
- $ fromArray
154
- );
158
+ if ($ operationElementProperty === null ) {
159
+ $ operationDataSubArray = $ this ->resolveNonPrimitiveElement (
160
+ $ entityName ,
161
+ $ operationElement ,
162
+ $ operation ,
163
+ $ fromArray
164
+ );
165
+ } else {
166
+ $ linkedEntityObj = $ this ->resolveLinkedEntityObject ($ entityName );
167
+ $ operationDataSubArray = $ linkedEntityObj ->getDataByName ($ operationElementProperty , 0 );
168
+
169
+ if ($ operationDataSubArray === null ) {
170
+ throw new \Exception (
171
+ sprintf ('Property %s not found in entity %s \n ' , $ operationElementProperty , $ entityName )
172
+ );
173
+ }
174
+ }
155
175
156
176
if ($ operationElement ->getType () == OperationDefinitionObjectHandler::ENTITY_OPERATION_ARRAY ) {
157
177
$ operationDataArray [$ operationElement ->getKey ()][] = $ operationDataSubArray ;
0 commit comments