protected function getEntityMetadata($entity, $path = null)
    {
        $factory = new DisconnectedMetadataFactory($this->getContainer()->get('doctrine'));

        return $factory->getClassMetadata($entity, $path)->getMetadata();
    }