ClassModelList::prepareQueryHeaders()This function can be used to simplify the SQL creation for SELECT statement. $headers is a mixed array containing the list columns properties. example : name
namespace
Some other headers params to know, but not used in prepareQueryHeaders() :
NamespacingThis following example shows how to namespace the vars through the headers.
About the standards...A convention is to use '_id' suffix for the foreign keys and primary keys. example :
But this convention cannot handle the case when a table owns 2 fk pointing to the same table. In this case, you will avoid this naming convention making an exception. For example, our namespacing would not work at all. Cook allows you renaming all fields as you want but not the primary key (always id, for the moment). So you cannot adopt this standard for the moment. Note of the conceptor : Personally, I do not like the '_id' suffixes. Maybe it can usefull in some case, but for me never because all FK fields are aliased, and it is only a matter of beiing knowing wich var represent what. Singular, pluralThe namespace parts are composed of the physical field names. Not the sigularizated table alias ! When a cross-reference (Xref) list is instancied in the object, it will use a plural property (highly recommended).
... simple and without conflicts. The N:M tutorial is correctly written in conventions.
Field alias conventions in cookIn order to avoid conflicts, cook has defined its own conventions for building SQL joins. example : country.continent.name Tables aliases are singularizated. It uses the fk field name.
Fields aliases :
In the given example, we have re-aliased '_country_continent_.name' to 'continent'. For loading cross-reference datas (N:M) or reversed foreign key (N:1), you can follow the tutorial. |
|
“
”
I still don't believe he can really be human to do all this ! From all of the forums that I've ever participated in this is certainly the one that most encapsulates the feeling of being truly open source where everyone's opinions and contributions can and will shape the development of the service! It's truly awesome! Hope you enjoy cooking and look forward to reading and contributing to any of the editorial work that you proposed too!! Thanks
