The pattern we have in the new object-based connection system is this:
- ask for a thing -- in this case, a connection
- load some settings for that thing
- create an object whose class depends on those settings and give it some properties too.
This is exactly the same pattern as flag module.
We should compare our code with that and crib if that has nicer ways of doing it :)
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | 1042278.clients.rename-connection-create.patch | 1.03 KB | joachim |
Comments
Comment #1
joachim commentedhttp://drupal.org/node/305086
Flag has this form:
This is in line with views_get_view().
While we're still in alpha and the only modules (I assume!) that depend on this are mine, I'm going to standardize and so change:
function clients_connection_create($cid) {
to
function clients_get_connection($cid) {
We can later on look at a cleaner pattern for the actual returning of the object -- flag module is all smart and proper and has a static method in the base class factory_by_row(). Though actually, that finds out which class to use in a regular function just like we do, so it's swings and roundabouts really. At any rate, that's internal to the module so can be done for later clean-up if at all.
Comment #2
joachim commented#1042278 by joachim: Renamed clients_connection_create() to be in line with other OO-based contrib modules.