protected function getEventAdapter(EventArgs $args)
    {
        $class = get_class($args);
        if (preg_match('@Doctrine\\\([^\\\]+)@', $class, $m) && in_array($m[1], ['ODM', 'ORM'])) {
            if (!isset($this->adapters[$m[1]])) {
                $adapterClass = 'Gedmo\\Mapping\\Event\\Adapter\\' . $m[1];
                $this->adapters[$m[1]] = new $adapterClass();
            }

            $this->adapters[$m[1]]->setEventArgs($args);
            return $this->adapters[$m[1]];
        }

        throw new \InvalidArgumentException('Session continaer does not support event arg class: ' . $class);
    }