@@ -66,6 +66,8 @@ public function __construct($dependentEntities = null)
6666 * @return array
6767 * @throws \Exception
6868 * @SuppressWarnings(PHPMD.CyclomaticComplexity)
69+ * @SuppressWarnings(PHPMD.NPathComplexity)
70+ * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
6971 */
7072 public function resolveOperationDataArray ($ entityObject , $ operationMetadata , $ operation , $ fromArray = false )
7173 {
@@ -134,6 +136,13 @@ public function resolveOperationDataArray($entityObject, $operationMetadata, $op
134136 ));
135137 }
136138 } else {
139+ $ operationElementProperty = null ;
140+ if (strpos ($ operationElementType , '. ' ) !== false ) {
141+ $ operationElementComponents = explode ('. ' , $ operationElementType );
142+ $ operationElementType = $ operationElementComponents [0 ];
143+ $ operationElementProperty = $ operationElementComponents [1 ];
144+ }
145+
137146 $ entityNamesOfType = $ entityObject ->getLinkedEntitiesOfType ($ operationElementType );
138147
139148 // 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
146155 ));
147156 }
148157 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+ }
155175
156176 if ($ operationElement ->getType () == OperationDefinitionObjectHandler::ENTITY_OPERATION_ARRAY ) {
157177 $ operationDataArray [$ operationElement ->getKey ()][] = $ operationDataSubArray ;
0 commit comments