private function createDataMapper($entityClass)
    {
        /** @var DataMapperInterface $dataMapper */
        $dataMapperClass = isset($this->config['dataMapper']) ? $this->config['dataMapper'] : DoctrineDataMapper::class;

        $meta = $this->builder->getMeta($entityClass);

        if ($meta->storage['type'] == 'api') {
            $dataMapperClass = $meta->storage['handler'];
        }

        switch ($dataMapperClass) {
            case CsvDataMapper::class:
                $connectionClass = CsvDataGateway::class;

                break;

            default:
                $connectionClass = Connection::class;

                break;
        }

        $dataMapper = new $dataMapperClass(
            $this->getConnection($connectionClass),
            $entityClass,
            $meta->storage['table'],
            $this->entityRegistry
        );

        if ($dataMapper instanceof DispatcherAwareInterface) {
            $dataMapper->setDispatcher($this->getDispatcher());
        }

        return $dataMapper;
    }
private function createDataMapper($entityClass)
    {
        /** @var DataMapperInterface $dataMapper */
        $dataMapperClass = isset($this->config['dataMapper']) ? $this->config['dataMapper'] : DoctrineDataMapper::class;

        $meta = $this->builder->getMeta($entityClass);

        if ($meta->storage['type'] == 'api') {
            $dataMapperClass = $meta->storage['handler'];
        }

        switch ($dataMapperClass) {
            case CsvDataMapper::class:
                $connectionClass = CsvDataGateway::class;

                break;

            default:
                $connectionClass = Connection::class;

                break;
        }

        $dataMapper = new $dataMapperClass(
            $this->getConnection($connectionClass),
            $entityClass,
            $meta->storage['table'],
            $this->entityRegistry
        );

        if ($dataMapper instanceof DispatcherAwareInterface) {
            $dataMapper->setDispatcher($this->getDispatcher());
        }

        return $dataMapper;
    }
private function createDataMapper ( $ entityClass ) { /** @var DataMapperInterface $dataMapper */ $ dataMapperClass = isset ( $ this -> config [ 'dataMapper' ] ) ? $ this -> config [ 'dataMapper' ] : DoctrineDataMapper :: class ; $ meta = $ this -> builder -> getMeta ( $ entityClass ) ; if ( $ meta -> storage [ 'type' ] == 'api' ) { $ dataMapperClass = $ meta -> storage [ 'handler' ] ; } switch ( $ dataMapperClass ) { case CsvDataMapper :: class : $ connectionClass = CsvDataGateway :: class ; break ; default : $ connectionClass = Connection :: class ; break ; } $ dataMapper = new $ dataMapperClass ( $ this -> getConnection ( $ connectionClass ) , $ entityClass , $ meta -> storage [ 'table' ] , $ this -> entityRegistry ) ; if ( $ dataMapper instanceof DispatcherAwareInterface ) { $ dataMapper -> setDispatcher ( $ this -> getDispatcher ( ) ) ; } return $ dataMapper ; }
Creates a DataMapper

@param   string $entityClass The Entity's class

@return  DataMapperInterface
Creates a DataMapper