Search\Model\Filter\Base::__construct PHP Method

__construct() public method

By default the name of the HTTP GET query argument will be assumed the field name in the database as well.
public __construct ( string $name, Manager $manager, array $config = [] )
$name string Name.
$manager Search\Manager Manager.
$config array Config.
    public function __construct($name, Manager $manager, array $config = [])
    {
        $this->_manager = $manager;
        $defaults = ['field' => $name, 'aliasField' => true, 'name' => $name, 'validate' => [], 'alwaysRun' => false, 'filterEmpty' => false, 'defaultValue' => null, 'multiValue' => false];
        $this->config($config + $defaults);
    }

Usage Example

Example #1
0
 /**
  * {@inheritDoc}
  *
  * @param string $name Name.
  * @param \Search\Manager $manager Manager.
  * @param array $config Config.
  */
 public function __construct($name, Manager $manager, array $config = [])
 {
     parent::__construct($name, $manager, $config);
     $mode = $this->config('mode');
     if ($mode !== null) {
         $this->config('fieldMode', $mode);
     }
 }