3. Querying in Qcodo
* Qcodo Query: The QQ Node Classes
<< * Qcodo Query: Object Oriented Database Querying   |   Back to Main   |   * Qcodo Query: The QQ Condition Classes >>

View Source
will open in a new window
Qcodo Query Nodes
QQ Nodes are any object table or association table (type tables are excluded), as well as any column within those tables. QQ Node classes for your entire data model is generated for you during the code generation process.

But in addition to this, QQ Nodes are completely interlinked together, matching the relationships that you have defined as foreign keys (or virtual foreign keys using a relationships script) in your database.

To get at a specific QQ Node, you will need to call QQN::ClassName(), where "ClassName" is the name of the class for your table (e.g. "Person"). From there, you can use property getters to get at any column or relationship.

Naming standards for the columns are the same as the naming standards for the public getter/setter properties on the object, itself. So just as $objPerson->FirstName will get you the "First Name" property of a Person object, QQN::Person()->FirstName will refer to the "person.first_name" column in the database.

Naming standards for relationships are the same way. The tokenization of the relationship reflected in a class's property and method names will also be reflected in the QQ Nodes. So just as $objProject->ManagerPerson will get you a Person object which is the manager of a given project, QQN::Project()->ManagerPerson refers to the person table's row where person.id = project.manager_person_id.

And of course, because everything that is linked together in the database is also linked together in your QQ Nodes, QQN::Project()->ManagerPerson->FirstName would of course refer to the person.first_name of the person who is the project manager of that particular row in the project table.