Cake\ElasticSearch\Type::__construct PHP Method

__construct() public method

### Options - connection The Elastica instance. - name The name of the type. If this isn't set the name will be inferred from the class name. - eventManager Used to inject a specific eventmanager. At the end of the constructor the Model.initialize event will be triggered.
public __construct ( array $config = [] )
$config array The configuration options, see above.
    public function __construct(array $config = [])
    {
        if (!empty($config['connection'])) {
            $this->connection($config['connection']);
        }
        if (!empty($config['name'])) {
            $this->name($config['name']);
        }
        $eventManager = null;
        if (isset($config['eventManager'])) {
            $eventManager = $config['eventManager'];
        }
        $this->_eventManager = $eventManager ?: new EventManager();
        $this->initialize($config);
        $this->dispatchEvent('Model.initialize');
    }