xref: /plugin/struct/meta/SearchConfig.php (revision 5511bd5b07a4ce4f72c790c57a0579633941affd)
1*5511bd5bSAndreas Gohr<?php
2*5511bd5bSAndreas Gohr
3*5511bd5bSAndreas Gohrnamespace plugin\struct\meta;
4*5511bd5bSAndreas Gohr
5*5511bd5bSAndreas Gohr/**
6*5511bd5bSAndreas Gohr * Class SearchConfig
7*5511bd5bSAndreas Gohr *
8*5511bd5bSAndreas Gohr * The same as @see Search but can be initialized by a configuration array
9*5511bd5bSAndreas Gohr *
10*5511bd5bSAndreas Gohr * @package plugin\struct\meta
11*5511bd5bSAndreas Gohr */
12*5511bd5bSAndreas Gohrclass SearchConfig extends Search {
13*5511bd5bSAndreas Gohr
14*5511bd5bSAndreas Gohr    /**
15*5511bd5bSAndreas Gohr     * SearchConfig constructor.
16*5511bd5bSAndreas Gohr     * @param $config
17*5511bd5bSAndreas Gohr     */
18*5511bd5bSAndreas Gohr    public function __construct($config) {
19*5511bd5bSAndreas Gohr        parent::__construct();
20*5511bd5bSAndreas Gohr
21*5511bd5bSAndreas Gohr        foreach($config['schemas'] as $schema) {
22*5511bd5bSAndreas Gohr            $this->addSchema($schema[0], $schema[1]);
23*5511bd5bSAndreas Gohr        }
24*5511bd5bSAndreas Gohr
25*5511bd5bSAndreas Gohr        foreach($config['cols'] as $col) {
26*5511bd5bSAndreas Gohr            $this->addColumn($col);
27*5511bd5bSAndreas Gohr        }
28*5511bd5bSAndreas Gohr
29*5511bd5bSAndreas Gohr        foreach($config['filter'] as $filter) {
30*5511bd5bSAndreas Gohr            $this->addFilter($filter[0], $filter[2], $filter[1], $filter[3]);
31*5511bd5bSAndreas Gohr        }
32*5511bd5bSAndreas Gohr
33*5511bd5bSAndreas Gohr        // FIXME add additional stuff
34*5511bd5bSAndreas Gohr
35*5511bd5bSAndreas Gohr    }
36*5511bd5bSAndreas Gohr
37*5511bd5bSAndreas Gohr}
38