App with one installation an multiple clients

We’re developing an app that is planned to be used by various clients (and each clien will have their own clients), but it will only have one installation. My question is, does anybody know a clean/yii way, to implement this without touching all the active records to insert a custom id query in each call?

Default scope handles this exact issue gracefully.

A few things, though.

In the current implementation it only works for find() methods - not update, delete, insert, etc.

Thanks dniznick for suggestion. We already now about the existence of default scope, but we now the same feature for save(), so it seems we’ve to modify the ActiveRecord according our needs.

I’m going to reply myself… at the end it seems that the correct definition for our problem is ‘multi-tenancy’ and it’s covered broadly on the web. Indeed it’s replied in some threads in the yii forum (like this).

We’re going to take the approximation mentioned in other threads about overwriting beforeSave and defaultScope. Thanks for your time.