@@ -197,15 +197,33 @@ private function resolveUrlReference($urlIn, $entityObjects)
197197 {
198198 $ urlOut = $ urlIn ;
199199 $ matchedParams = [];
200+ // Find all the params ({}) references
200201 preg_match_all ("/[{](.+?)[}]/ " , $ urlIn , $ matchedParams );
201202
202203 if (!empty ($ matchedParams )) {
203204 foreach ($ matchedParams [0 ] as $ paramKey => $ paramValue ) {
205+ $ paramEntityParent = "" ;
206+ $ matchedParent = [];
207+ $ dataItem = $ matchedParams [1 ][$ paramKey ];
208+ // Find all the parent property (Type.key) references, assuming there will be only one
209+ // parent property reference within one param
210+ preg_match_all ("/(.+?)\./ " , $ dataItem , $ matchedParent );
211+
212+ if (!empty ($ matchedParent ) && !empty ($ matchedParent [0 ])) {
213+ $ paramEntityParent = $ matchedParent [1 ][0 ];
214+ $ dataItem = preg_replace ('/^ ' .$ matchedParent [0 ][0 ].'/ ' , '' , $ dataItem );
215+ }
216+
204217 foreach ($ entityObjects as $ entityObject ) {
205- $ param = $ entityObject ->getDataByName (
206- $ matchedParams [1 ][$ paramKey ],
207- EntityDataObject::CEST_UNIQUE_VALUE
208- );
218+ $ param = null ;
219+
220+ if ($ paramEntityParent === "" || $ entityObject ->getType () == $ paramEntityParent ) {
221+ $ param = $ entityObject ->getDataByName (
222+ $ dataItem ,
223+ EntityDataObject::CEST_UNIQUE_VALUE
224+ );
225+ }
226+
209227 if (null !== $ param ) {
210228 $ urlOut = str_replace ($ paramValue , $ param , $ urlOut );
211229 continue ;
0 commit comments