I am new to Yii2, but I am fascinated by the power of this framework. I am trying to develop an application and I have a small query. It shouldn’t be too complicated, but since I am new, I am completely lost!
Our business is into leasing apartment building from landlords and releasing each of those apartment units to customers. I have the following tables:
[b]Master Property: (The Apartment Building)
ID | Name | Location | Rent | <more fields>[/b]
[b]Property: (Individual Apartments in the Master Property)
ID | Name | Master_Property_ID | <more fields>[/b]
ID | Name | Email | Phone | <more fields>[/b]
ID | Customer_ID | Property_ID | Rent | <more fields>[/b]
I want a query to get all the Apartments (Property) which are part of a Building (Master Property). Then I want to use that result to run another query on the Tenancy table to get information like rents and customer. What I am looking to establish is when I go to Master Property > View action, I want the Master Property Information on the top and at the bottom, I want to list out all the Apartments on that Building with the current tenant and the rent.
I hope I made sense. Please ask me for any clarification. Thanks for your time. Any help much appreciated.