QCubed Query Nodes

Node objects represent entities that can be used to select or filter rows in SQL queries. Nodes can represent tables, columns, computed values, and custom SQL. Node classes for your data model are generated for you during the code generation process.

Nodes are linked together, representing the relationships between tables, columns, and foreign keys that you have defined in your database.

To get at a specific Node, you create a chain of nodes that start with QQN::ClassName(), where "ClassName" is the name of the class for the type of object your want as the result of your query (e.g. "Person"). From there, you can use property getters to get at a 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 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 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.