protected function build(IMetaModelDataDefinition $container)
    {
        $inputScreen = $this->viewCombination->getScreen($container->getName());
        if (!$inputScreen) {
            return;
        }
        $meta = $inputScreen['meta'];

        $config = $this->getDataProviderDefinition($container);

        // Check config if it already exists, if not, add it.
        if (!$config->hasInformation($container->getName())) {
            $providerInformation = new ContaoDataProviderInformation();
            $providerInformation->setName($container->getName());
            $config->addInformation($providerInformation);
        } else {
            $providerInformation = $config->getInformation($container->getName());
        }
        $basicDefinition = $container->getBasicDefinition();
        if ($providerInformation instanceof ContaoDataProviderInformation) {
            $providerInformation
                ->setTableName($container->getName())
                ->setClassName(Driver::class)
                ->setInitializationData(['source' => $container->getName()])
                ->setVersioningEnabled(false);
            $basicDefinition->setDataProvider($container->getName());
        }

        // If in hierarchical mode, set the root provider.
        if ($basicDefinition->getMode() == BasicDefinitionInterface::MODE_HIERARCHICAL) {
            $basicDefinition->setRootDataProvider($container->getName());
        }

        // If not standalone, set the correct parent provider.
        if ('ctable' === $meta['rendertype']) {
            $parentTable = $meta['ptable'];
            // Check config if it already exists, if not, add it.
            if (!$config->hasInformation($parentTable)) {
                $providerInformation = new ContaoDataProviderInformation();
                $providerInformation->setName($parentTable);
                $config->addInformation($providerInformation);
            } else {
                $providerInformation = $config->getInformation($parentTable);
            }

            if ($providerInformation instanceof ContaoDataProviderInformation) {
                $providerInformation
                    ->setTableName($parentTable)
                    ->setInitializationData(['source' => $parentTable]);
                // How can we honor other drivers? We do only check for MetaModels and legacy SQL here.
                if (in_array($parentTable, $this->factory->collectNames())) {
                    $providerInformation->setClassName(Driver::class);
                }

                $basicDefinition->setParentDataProvider($parentTable);
            }
        }
    }
protected function build(IMetaModelDataDefinition $container)
    {
        $inputScreen = $this->viewCombination->getScreen($container->getName());
        if (!$inputScreen) {
            return;
        }
        $meta = $inputScreen['meta'];

        $config = $this->getDataProviderDefinition($container);

        // Check config if it already exists, if not, add it.
        if (!$config->hasInformation($container->getName())) {
            $providerInformation = new ContaoDataProviderInformation();
            $providerInformation->setName($container->getName());
            $config->addInformation($providerInformation);
        } else {
            $providerInformation = $config->getInformation($container->getName());
        }
        $basicDefinition = $container->getBasicDefinition();
        if ($providerInformation instanceof ContaoDataProviderInformation) {
            $providerInformation
                ->setTableName($container->getName())
                ->setClassName(Driver::class)
                ->setInitializationData(['source' => $container->getName()])
                ->setVersioningEnabled(false);
            $basicDefinition->setDataProvider($container->getName());
        }

        // If in hierarchical mode, set the root provider.
        if ($basicDefinition->getMode() == BasicDefinitionInterface::MODE_HIERARCHICAL) {
            $basicDefinition->setRootDataProvider($container->getName());
        }

        // If not standalone, set the correct parent provider.
        if ('ctable' === $meta['rendertype']) {
            $parentTable = $meta['ptable'];
            // Check config if it already exists, if not, add it.
            if (!$config->hasInformation($parentTable)) {
                $providerInformation = new ContaoDataProviderInformation();
                $providerInformation->setName($parentTable);
                $config->addInformation($providerInformation);
            } else {
                $providerInformation = $config->getInformation($parentTable);
            }

            if ($providerInformation instanceof ContaoDataProviderInformation) {
                $providerInformation
                    ->setTableName($parentTable)
                    ->setInitializationData(['source' => $parentTable]);
                // How can we honor other drivers? We do only check for MetaModels and legacy SQL here.
                if (in_array($parentTable, $this->factory->collectNames())) {
                    $providerInformation->setClassName(Driver::class);
                }

                $basicDefinition->setParentDataProvider($parentTable);
            }
        }
    }
protected function build ( IMetaModelDataDefinition $ container ) { $ inputScreen = $ this -> viewCombination -> getScreen ( $ container -> getName ( ) ) ; if ( ! $ inputScreen ) { return ; } $ meta = $ inputScreen [ 'meta' ] ; $ config = $ this -> getDataProviderDefinition ( $ container ) ; // Check config if it already exists, if not, add it. if ( ! $ config -> hasInformation ( $ container -> getName ( ) ) ) { $ providerInformation = new ContaoDataProviderInformation ( ) ; $ providerInformation -> setName ( $ container -> getName ( ) ) ; $ config -> addInformation ( $ providerInformation ) ; } else { $ providerInformation = $ config -> getInformation ( $ container -> getName ( ) ) ; } $ basicDefinition = $ container -> getBasicDefinition ( ) ; if ( $ providerInformation instanceof ContaoDataProviderInformation ) { $ providerInformation -> setTableName ( $ container -> getName ( ) ) -> setClassName ( Driver :: class ) -> setInitializationData ( [ 'source' => $ container -> getName ( ) ] ) -> setVersioningEnabled ( false ) ; $ basicDefinition -> setDataProvider ( $ container -> getName ( ) ) ; } // If in hierarchical mode, set the root provider. if ( $ basicDefinition -> getMode ( ) == BasicDefinitionInterface :: MODE_HIERARCHICAL ) { $ basicDefinition -> setRootDataProvider ( $ container -> getName ( ) ) ; } // If not standalone, set the correct parent provider. if ( 'ctable' === $ meta [ 'rendertype' ] ) { $ parentTable = $ meta [ 'ptable' ] ; // Check config if it already exists, if not, add it. if ( ! $ config -> hasInformation ( $ parentTable ) ) { $ providerInformation = new ContaoDataProviderInformation ( ) ; $ providerInformation -> setName ( $ parentTable ) ; $ config -> addInformation ( $ providerInformation ) ; } else { $ providerInformation = $ config -> getInformation ( $ parentTable ) ; } if ( $ providerInformation instanceof ContaoDataProviderInformation ) { $ providerInformation -> setTableName ( $ parentTable ) -> setInitializationData ( [ 'source' => $ parentTable ] ) ; // How can we honor other drivers? We do only check for MetaModels and legacy SQL here. if ( in_array ( $ parentTable , $ this -> factory -> collectNames ( ) ) ) { $ providerInformation -> setClassName ( Driver :: class ) ; } $ basicDefinition -> setParentDataProvider ( $ parentTable ) ; } } }
Create the data provider definition in the container if not already set.

@param IMetaModelDataDefinition $container The data container.

@return void
Create the data provider definition in the container if not already set .