Simple clean

This commit is contained in:
Carlos Ferreira 2018-07-25 22:38:38 +02:00 committed by GitHub
parent 52f2218e7a
commit bbbe387f8c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -12,6 +12,7 @@ use Yii;
use yii\db\ActiveRecord;
use yii\base\Behavior;
use yii\console\Exception;
use humhub\modules\search\interfaces\Searchable;
/**
* Searchable Behavior
@ -35,19 +36,19 @@ class Searchable extends Behavior
public function afterSave($event)
{
if ($this->owner instanceof \humhub\modules\search\interfaces\Searchable) {
if ($this->owner instanceof Searchable) {
Yii::$app->search->update($this->owner);
} 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)
{
if ($this->owner instanceof \humhub\modules\search\interfaces\Searchable) {
if ($this->owner instanceof Searchable) {
Yii::$app->search->delete($this->owner);
} else {
throw new Exception("Owner of HSearchableBehavior must be implement interface ISearchable");
throw new Exception('Owner of HSearchableBehavior must be implement interface ISearchable');
}
}