1. Basic CodeGen
* Relationships (Foreign Keys)
<< * Saving and Deleting   |   Back to Main   |   * Reverse Relationships (One-to-One and One-to-Many) >>

View Source
will open in a new window
Qcodo and Foreign Key Relationships
In addition to your basic CRUD functionality, Qcodo will also analyze the Foreign Key relationships in your database to generate relationships between your objects.

Whenever you table has a column which is a Foreign Key to another table, the dependent class (the table with the FK) will have an instance of the independent class (the table where the FK links to). So in our Examples Site Database, we have a manager_person_id column in our project table. This results in a ManagerPerson property (of type Person) in our Project class.

Note that the ManagerPerson property is a read/write property. It can be modified just like any other property, like Name and Description.

Load a Project Object and its ManagerPerson

Project ID: 3
Project Name: proyecto 1

Manager Person ID: 1
Manager's First Name: Pop
Manager's Last Name: Doe