It seems that „where“ function is going directly to shopwares users table, not to s_plugin_user_preferred_markets_mapping.
Exactly. You can join the users directly without going over your mapping table. Therefor your $mapping attribute should be renamed to $users. More info: Association Mapping - Doctrine Object Relational Mapper (ORM)
Kind regards
https://www.digitvision.de