Avoid usage of TableMappingInterface::getAllFieldTableNames() as that is 9.1+ only.
Also moves $columnName out of the loop as it was there unnecessarily
Closes #3228979