@param Driver $driver
@param string $modelClass

@return \Doctrine\ORM\Mapping\ClassMetadata
485724
public function getClassMetadata(Driver $driver, $modelClass)
    {
        $manager = $this->managerFactory->getManager($driver);
        $manager->setModelClass($modelClass);

        return $manager->getClassMetadata();
    }
963806
public function transformToDriver($driver, Closure $callback = null, $class = null)
    {
        if ($callback) {
            $result = call_user_func($callback, $this->get($driver));

            if ($result instanceof Configuration) {
                return new CustomMetaData($result, $driver);
            }
        }

        if (class_exists($class)) {
            $result = new $class;

            if ($result instanceof MetaData) {
                $result = $result->configure();
                $result->setName($driver);

                return $result;
            }
        }

        throw new CouldNotExtend('Expected an instance of MetaData or Doctrine\ORM\Configuration');
    }
822936
private function createBuilderFromConnection(Connection $connection, string $modelClass): ModelQueryBuilder
    {
        return $this->getFactory()->createModelQueryBuilder($connection, $modelClass, $this->getModelSchemas());
    }
1253965
protected function getMetadata($class)
    {
        if (array_key_exists($class, $this->cache)) {
            return $this->cache[$class];
        }

        $this->cache[$class] = null;

        foreach ($this->registry->getManagers() as $name => $em) {
            try {
                return $this->cache[$class] = [$em->getClassMetadata($class), $name];
            } catch (MappingException $e) {
                // not an entity or mapped super class
            } catch (LegacyMappingException $e) {
                // not an entity or mapped super class, using Doctrine ORM 2.2
            }
        }

        return $this->cache[$class];
    }
707943
public function getSchemaByType($modelClass)
    {
        if (array_key_exists($modelClass, $this->schemaInstances) === true) {
            return $this->schemaInstances[$modelClass];
        }

        if ($this->hasSchemaForModelClass($modelClass) === false) {
            throw new InvalidArgumentException("Schema was not registered for model '$modelClass'.");
        }

        $schemaClass = $this->model2schemaMap[$modelClass];
        $schema      = new $schemaClass($this->factory, $this);

        $this->schemaInstances[$modelClass] = $schema;

        return $schema;
    }
497103
private function getModel($class)
    {
        $reflectionClass = new \ReflectionClass($class);
        $instance = $reflectionClass->newInstance();
        if (!($instance instanceof ModelInterface)) {
            throw new \Exception('This class is not supported');
        }

        return $instance;
    }
1356529
public function transformToDriver($driver, Closure $callback = null, $class = null)
    {
        if ($callback) {
            $result = call_user_func($callback, $this->get($driver));

            return new CustomConnection($result, $driver);
        }

        if (class_exists($class)) {
            $result = new $class;

            if ($result instanceof Connection) {
                $result = $result->configure();
                $result->setName($driver);

                return $result;
            }
        }

        throw new CouldNotExtend('Expected an instance of Connection or Doctrine\ORM\Configuration');
    }
1042485
public function getByModelClass($class)
    {
        $this->checkInitialization();

        if ( ! array_key_exists($class, $this->modelClassIndex)) {
            return false;
        }

        return $this->getByKey($this->modelClassIndex[$class]);
    }
1118781
public function getQueryAdapter($driver) {
		if (!isset($this->queryAdapters[$driver])) {
			$this->queryAdapters[$driver] = $this->createQueryAdapter($driver);
		}
		return $this->queryAdapters[$driver];
	}
413211
public function driver(?string $driver = null): self
    {
        $driver = $driver ? $driver : $this->app->make('config')->get('microservice-client.client');

        $connections = array_keys($this->app->make('config')->get('microservice-client.clients'));
        if (! in_array($driver, $connections, true)) {
            throw new DomainException("The Driver[{$driver}] not exists");
        }

        $this->driver = $driver;

        return $this;
    }
186222
public function findOneBy(string $modelClass, array $criteria, array $orderBy = null)
    {
        return $this->getRepositoryByClass($modelClass)->findOneBy($criteria, $orderBy);
    }
1311802
public function setModel($modelClass) {
		$reflection = new ReflectionClass($modelClass);
		
		if (! $reflection->implementsInterface('ZExt\Model\ModelInterface')) {
			throw new Exception('Class of a model must implements "ModelInterface"');
		}
		
		$this->_modelClass = $modelClass;
		
		return $this;
	}
1100923
public function validatorClass($resource, $modelClass=null)
    {
        if ($modelClass) {
            return $this->findClass($modelClass.'Validator');
        }

        return $this->findClass($this->className($resource).'Validator');
    }
664169
public static function make(array $options = [], $driver = null)
    {
        $class = null;

        if (!$driver && isset($options['driver'])) {
            $driver = $options['driver'];
            unset($options['driver']);
        }

        /** @var LockInterface $class */
        if (isset(self::$driverMap[$driver])) {
            $class = self::$driverMap[$driver];

        } else {
            foreach ([self::DRIVER_SEM, self::DRIVER_FILE] as $name) {
                $class = self::$driverMap[$name];

                if ($class::isSupported()){
                    break;
                }
            }
        }

        if (!$class) {
            throw new \RuntimeException('No available driver! MAP: ' . implode(',', self::$driverMap));
        }

        return new $class($options);
    }
250826
protected function getEntity($entityClass = UploadableEntity::class, $driver = 'orm')
    {
        $id = $this->getId();

        $entity = $this->em->find($entityClass, $id);

        if (null === $entity) {
            throw new ObjectNotFoundException($id, $driver);
        }

        return $entity;
    }
15403
public function getView(Driver $driver)
    {
        $this->dataExporter->setModelClass($this->modelClass);
        $this->view->setParam('menu', $this->container->getParameter('symfonyid.admin.menu.menu_name'));
        $this->view->setParam('action_method', $this->translator->trans('page.list', array(), $this->container->getParameter('symfonyid.admin.translation_domain')));
        $this->view->setParam('allow_create', $this->allowCreate);
        $this->view->setParam('allow_delete', $this->allowBulkDelete);
        $this->view->setParam('allow_download', $this->dataExporter->isAllowExport($driver, $this->container->getParameter('symfonyid.admin.max_records')));
        $this->view->setParam('number', $this->container->getParameter('symfonyid.admin.number'));
        $this->view->setParam('formating_number', $this->formatNumber);

        $this->setHeader();
        $this->setRecords($driver);

        return $this->view;
    }
782386
public function createDriver($driver, array $config = [])
    {
        $driver = strtolower($driver);

        $queueConfig = new Structure($config);

        if (!$queueConfig->toArray()) {
            throw new \LogicException('No queue config for ' . $driver);
        }

        // TODO: All driver should have DI pattern.
        switch ($driver) {
            case 'sqs':
                return new SqsQueueDriver(
                    $queueConfig->get('key'),
                    $queueConfig->get('secret'),
                    $queueConfig->get('queue', 'default'),
                    [
                        'region' => $queueConfig->get('region', 'us-west-2'),
                        'version' => $queueConfig->get('version', 'latest'),
                    ]
                );

            case 'sync':
                return new SyncQueueDriver();

            case 'database':
                return new DatabaseQueueDriver(
                    $this->container->get('db'),
                    $queueConfig->get('queue', 'default'),
                    $queueConfig->get('table', 'queue_jobs')
                );

            case 'pdo':
                return new PdoQueueDriver(
                    $this->container->get('db')->getConnection(),
                    $queueConfig->get('queue', 'default'),
                    $queueConfig->get('table', 'queue_jobs')
                );

            case 'ironmq':
                return new IronmqQueueDriver(
                    $queueConfig->get('project_id'),
                    $queueConfig->get('token'),
                    $queueConfig->get('queue', 'default'),
                    [
                        'host' => $queueConfig->get('region', 'mq-aws-us-east-1-1') . '.iron.io',
                    ]
                );

            case 'rabbitmq':
                return new RabbitmqQueueDriver(
                    $queueConfig->get('queue', 'default'),
                    (array) $queueConfig->toArray()
                );

            case 'resque':
                return new ResqueQueueDriver(
                    $queueConfig->get('host', 'localhost'),
                    $queueConfig->get('port', '6379'),
                    $queueConfig->get('queue', 'default')
                );

            case 'beanstalkd':
                return new BeanstalkdQueueDriver(
                    $queueConfig->get('host', '127.0.0.1'),
                    $queueConfig->get('queue', 'default'),
                    $queueConfig->get('timeout', 60)
                );

            default:
                return new NullQueueDriver();
        }
    }