1 | <?php |
||
11 | trait Searchable |
||
12 | { |
||
13 | /** |
||
14 | * @see \yii\base\ArrayableTrait::toArray() |
||
15 | * |
||
16 | * @param array $fields |
||
17 | * @param array $expand |
||
18 | * @param bool $recursive |
||
19 | */ |
||
20 | abstract public function toArray(array $fields = [], array $expand = [], $recursive = true); |
||
21 | |||
22 | /** |
||
23 | * @see \yii\db\BaseActiveRecord::getPrimaryKey() |
||
24 | * |
||
25 | * @param bool $asArray |
||
26 | */ |
||
27 | abstract public function getPrimaryKey($asArray = false); |
||
28 | |||
29 | /** |
||
30 | * An array of indices that this model uses. If none specified |
||
31 | * The name of the model will be used as the index. |
||
32 | * |
||
33 | * @return array |
||
34 | */ |
||
35 | 3 | public function indices() |
|
39 | |||
40 | /** |
||
41 | * Returns an array of indices for this model. |
||
42 | * |
||
43 | * @return array |
||
44 | */ |
||
45 | 4 | public function getIndices() |
|
57 | |||
58 | /** |
||
59 | * Returns the model in algolia friendly array form. |
||
60 | * |
||
61 | * @return array |
||
62 | */ |
||
63 | 4 | public function getAlgoliaRecord() |
|
69 | |||
70 | /** |
||
71 | * Returns an unique identifier for the Model. |
||
72 | * |
||
73 | * @return int |
||
74 | */ |
||
75 | 1 | public function getObjectID() |
|
79 | |||
80 | /** |
||
81 | * Indexes the model to Algolia. |
||
82 | */ |
||
83 | 1 | public function index() |
|
89 | |||
90 | /** |
||
91 | * Removes the model from Algolia. |
||
92 | * |
||
93 | * @throws \Exception |
||
94 | */ |
||
95 | 1 | public function removeFromIndices() |
|
101 | |||
102 | /** |
||
103 | * Updates the model in Algolia. |
||
104 | */ |
||
105 | 1 | public function updateInIndices() |
|
111 | |||
112 | /** |
||
113 | * Re-indexes the indices safely for this ActiveRecord class. |
||
114 | */ |
||
115 | 1 | public static function reindex() |
|
121 | |||
122 | /** |
||
123 | * Clears the indices for this ActiveRecord class. |
||
124 | */ |
||
125 | 1 | public static function clearIndices() |
|
131 | |||
132 | /** |
||
133 | * Returns the AlgoliaManager Instance. |
||
134 | * |
||
135 | * @return AlgoliaManager |
||
136 | * @throws \yii\base\InvalidConfigException |
||
137 | */ |
||
138 | 5 | private static function getAlgoliaManager() |
|
142 | } |
||
143 |