Extending yii-user module (or any module)

What I’m wanting to do is extend the yii-user module to include the ability for LDAP authentication using the adLDAP library. I have already created this functionality with PHP’s built-in LDAP functions simply by directly editing the yii-user module, but I think this is really poor practice.

I’m wondering, is the best way to somehow extend the entire yii-user module and just override the applicable controllers, or can I gracefully extend the specific controllers within the module somehow? Or should I be creating a module with the yii-user module as a sub-module?

I searched around and found similar threads with no responses. I suspect there are more people wanting to know about extending modules out there.

Past threads on this topic:

http://www.yiiframework.com/forum/index.php?/topic/19770-best-practice-for-extending-a-modules-functionality/page__p__96838__hl__extend+module#entry96838

http://www.yiiframework.com/forum/index.php?/topic/20687-extending-an-extension/page__p__101289__hl__extend+module#entry101289

http://www.yiiframework.com/forum/index.php?/topic/8125-extending-modules/page__p__40906__hl__extend+module#entry40906

Any thoughts on this? Has anyone ever extended a module?

I’ve wondered about the same thing. Not enough to actually do anything about it though. :) If a module is written so that classes for particular functionality are configurable (e.g. ‘payprovider’=>array (class=>‘application.components.MyCustom’) ), then it’s pretty easy. A module design would have a core set of functionality and then everything else provided as a configuration array to make it easy to extend. What constitutes “core” would still be a judgement call. Anyway, that’s the dream world.

A couple of wild thoughts:

  1. If it is possible to route calls intended for the original controllers to your extended controllers (possible through custom urlmanager?), you could leave the original module code untouched. I have no clue if this is even possible or wise.

  2. There is a getParentModule() call which suggests that a submodule can reference its parent code. I don’t know if that is enough to do what you need or again if it is even wise or worth the effort.

Good luck.