mirror of
https://github.com/humhub/humhub.git
synced 2025-01-17 22:28:51 +01:00
Simple clean
This commit is contained in:
parent
52f2218e7a
commit
bbbe387f8c
@ -12,6 +12,7 @@ use Yii;
|
|||||||
use yii\db\ActiveRecord;
|
use yii\db\ActiveRecord;
|
||||||
use yii\base\Behavior;
|
use yii\base\Behavior;
|
||||||
use yii\console\Exception;
|
use yii\console\Exception;
|
||||||
|
use humhub\modules\search\interfaces\Searchable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Searchable Behavior
|
* Searchable Behavior
|
||||||
@ -35,19 +36,19 @@ class Searchable extends Behavior
|
|||||||
public function afterSave($event)
|
public function afterSave($event)
|
||||||
{
|
{
|
||||||
|
|
||||||
if ($this->owner instanceof \humhub\modules\search\interfaces\Searchable) {
|
if ($this->owner instanceof Searchable) {
|
||||||
Yii::$app->search->update($this->owner);
|
Yii::$app->search->update($this->owner);
|
||||||
} else {
|
} else {
|
||||||
throw new Exception("Owner of HSearchableBehavior must be implement interface ISearchable");
|
throw new Exception('Owner of HSearchableBehavior must be implement interface ISearchable');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function afterDelete($event)
|
public function afterDelete($event)
|
||||||
{
|
{
|
||||||
if ($this->owner instanceof \humhub\modules\search\interfaces\Searchable) {
|
if ($this->owner instanceof Searchable) {
|
||||||
Yii::$app->search->delete($this->owner);
|
Yii::$app->search->delete($this->owner);
|
||||||
} else {
|
} else {
|
||||||
throw new Exception("Owner of HSearchableBehavior must be implement interface ISearchable");
|
throw new Exception('Owner of HSearchableBehavior must be implement interface ISearchable');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user