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');
}