I have a login system with Zend\Authentication, working fine. I got user identity saved in the storage, so I also know the logged in user's id.
Using TableGateway to access database tables.
I am trying to find out the proper way to let users to access only their records (for example, only their customer records marked with that user_id in the customers table) and of course allow them editing only their own records.
Yes, I can read identity in Table class and filter records by user_id, or even better call the data retrieval function by user_id from the Controller instead getting Table class involved with the user identity.
What I am interested is "What is the proper way to create a module that will return only assigned data for logged in user?". I am new to ZF2 and I don't want to learn the wrong way but the already existing and proven one if any.
Thank you for reading.