When we call EntityToQuery and pass it either an entity object or array of entities it fails with the following error:
Element at position  does not exist in list
No matter what entity we pass into this function the error is always exactly the same.
OS: Linux (ortussolutions/commandbox:lucee5-alpine docker image)
DB: MSSQL 2016
You should post your ORM entities, and the full stacktrace please
, Did you saw above comment? If Yes, Please share a stacktrace here. It'll more helpful to improve the status of the ticket.
, Did you face this issue now also? If not means, shall I close this ticket?
Still unresolved. I’ll post entity and stacktrace shortly
I think we’ve uncovered the issue. Our entity extends ColdBox’s ActiveEntity.cfc (old version, like CB v3.5’sh), which extends VirtualEntityService.cfc which extends BaseORMService.cfc. In the. latter two files, there are non-orm properties that do not specifically set persistent="false". This looks to be changed in later versions of ColdBox (probably to work around this issue?), but we’re stuck on this old version of CB for now. We’re updating our CB to apply this workaround, but is something that should either be documented or fixed.
At the core of the EntityToQuery is which grabs the properties from of the entity object and iterates over to create the query object. The underlying method to grab the properties checks theProperty.isPeristent() (which is misspelled in the code, btw ) ;, which if the “persistent” attribute is missing will default to true. This may be nothing, but perhaps this causes to return null indices in the array, causing to fail with the Element at position  does not exist in listerror?