1 | <?php |
||
19 | class SearchableBehavior extends Behavior |
||
20 | { |
||
21 | |||
22 | /** |
||
23 | * @var \yii\db\ActiveRecord |
||
24 | * @inheritDoc |
||
25 | */ |
||
26 | public $owner; |
||
27 | |||
28 | /** |
||
29 | * The class names that syncing is disabled for. |
||
30 | * |
||
31 | * @var string[] |
||
32 | */ |
||
33 | protected static $syncingDisabledFor = []; |
||
34 | |||
35 | /** |
||
36 | * @inheritDoc |
||
37 | */ |
||
38 | 12 | public function events() |
|
46 | |||
47 | /** |
||
48 | * Handle the saved event for the model. |
||
49 | */ |
||
50 | 6 | public function afterSave() |
|
66 | |||
67 | /** |
||
68 | * Handle the deleted event for the model. |
||
69 | */ |
||
70 | 3 | public function afterDelete(): void |
|
80 | |||
81 | /** |
||
82 | * Enable syncing for the given class. |
||
83 | * |
||
84 | * @param string $class of records need to enable syncing. |
||
85 | */ |
||
86 | 2 | public static function enableSyncingFor($class): void |
|
90 | |||
91 | /** |
||
92 | * Disable syncing for the given class. |
||
93 | * |
||
94 | * @param string $class of records need to disable syncing. |
||
95 | */ |
||
96 | 2 | public static function disableSyncingFor($class): void |
|
100 | |||
101 | /** |
||
102 | * Determine if syncing is disabled for the given class or model. |
||
103 | * |
||
104 | * @param object|string $class of records need to disable syncing. |
||
105 | * @return bool weather syncing disabled. |
||
106 | */ |
||
107 | 6 | public static function syncingDisabledFor($class): bool |
|
113 | |||
114 | } |
||
115 |