Fixing join generation in PHQL