(#46124) Restrict getEntity to connected entity only

Change-Id: Ie916bad460f0f42ac220c6e74edfe9105b9b4e8e
Merge "(#46124) Restrict getEntity to connected entity only"