Sorry, i was editing on another server, and couldn’t see the changes.
If anyone should ever get by this post, here is the final code I’ve made up:
<?php
class SiteBehavior extends CActiveRecordBehavior {
public function beforeFind() {
if ($this->getEnabled()) {
$this->Owner
->getDbCriteria()
->addCondition('`t`.`siteId` IN(0,' . Yii::app()->params->siteId . ')');
}
}
public function beforeSave() {
if (isset($this->Owner->siteId) && is_numeric($this->Owner->siteId)) return;
$this->Owner->siteId = Yii::app()->params->siteId;
}
}
?>
Set params -> siteId to something, add the column ‘siteId’ to the tables you want, and enable this behavior to the corresponding models. Then you’ll quickly be able to run a multi site system.