-
Notifications
You must be signed in to change notification settings - Fork 6
/
Database.php
43 lines (37 loc) · 1.14 KB
/
Database.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
namespace xj\xunsearch;
use Yii;
use yii\base\Object;
/**
* Easp XS instance
*/
class Database extends Object {
/**
* XS Instance
* @var XS
*/
public $xs;
public function __call($name, $parameters) {
// check methods of xs
if ($this->xs !== null && method_exists($this->xs, $name)) {
return call_user_func_array(array($this->xs, $name), $parameters);
}
// check methods of index object
if ($this->xs !== null && method_exists(__NAMESPACE__ . '\\XSIndex', $name)) {
$ret = call_user_func_array(array($this->xs->index, $name), $parameters);
if ($ret === $this->xs->index) {
return $this;
}
return $ret;
}
// check methods of search object
if ($this->xs !== null && method_exists(__NAMESPACE__ . '\\XSSearch', $name)) {
$ret = call_user_func_array(array($this->xs->search, $name), $parameters);
if ($ret === $this->xs->search) {
return $this;
}
return $ret;
}
return parent::__call($name, $parameters);
}
}