Thank you for your quick reply. I am currently migrating a PMS (written in CI 2) to Yii2. To be honest i would have loved if Yii3 was ready since a more DDD approach on the subject would be better & as far as i can tell Yii3 is taking such an approach.
Another issue i am facing is for example AR models (Entities) that have related models such as Customer & CustomerPhone (or even worse a Reservation model that has several related models). If i wish for example to add more CustomerPhones to the Customer without persisting the model (e.g. testing purposes or some dynamic way of object creation) i would have to create a new property in the Customer object (e.g. PhonesArray = ) and add/remove the Phones from within that “collection” since i cannot access the relation property (e.g. @property Phone $phones).
And then i would need to access different methods for retrieving the data from the DB and different methods for retrieving the data from the object.
Is there a better way to approach this? Should i create similar POPO objects for Customer and keep the AR model of Customer only to be used by a Repository class which will retrieve the data from the DB, create POPO Customer object & return that instead? (On second thought by doing so i would lose any advantage of Yii regarding DataProviders, GridView etc.)
Any opinions regarding my thoughts are most welcome.