I've been loath to do this, but I'm not sure there are any arguments against that are valid.

clients_connection_load() loads connection data from the DB, and returns an object, using db_detch_object(), which holds the data.

clients_get_connection() calls the above, then creates a new object of the proper class for the connection, and just transfers the properties.

The latter is messy.
The former I am not sure needs to even exist as it does. We need a function named FOO_load for the menu loaders, but why do we need a plain object and a proper classed object for the same thing? The only reason I can think of is that it's marginally quicker in hook_menu to not have to load the class. Given that hook_menu is only invoked when the cache needs to be rebuilt, that's not really a good reason to keep the DX WTF.

Comments

joachim’s picture

Status: Active » Fixed

Issue #1143410 by joachim: Changed clients_connection_load() to return a complete handler and clients_get_connection() to depend on it.

I'm keeping clients_get_connection() to avoid breaking modules that already use this as it was declared as the API...

Though once I add machine names, I'll add a function to more robustly get a connection by machine name rather than serial id.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.