Yii2: Populating model field with value from many-to-many relation
问题 We are trying to set-up our REST API in a way that a user can only retrieve data related to his account. Uptill now, We've only had a public API and it all worked like a charm. The public API will still get used, so we started from scratch. We have a User model, extending ActiveRecord and implementing IdentityInterface . A User will have a relation to a Customer model (Many:Many, but at least one). A User will have only one MASTER Customer. The above is saved in the database using 3 tables