src/Contao/View/Contao2BackendView/ActionHandler/CopyHandler.php
protected function guardIsCreatable(EnvironmentInterface $environment, ModelIdInterface $modelId, $redirect = false)
    {
        $dataDefinition = $environment->getDataDefinition();
        if ($dataDefinition->getBasicDefinition()->isCreatable()) {
            return;
        }

        if ($redirect) {
            $eventDispatcher = $environment->getEventDispatcher();

            $eventDispatcher->dispatch(
                ContaoEvents::SYSTEM_LOG,
                new LogEvent(
                    \sprintf(
                        'Table "%s" is not creatable, DC_General - DefaultController - copy()',
                        $dataDefinition->getName()
                    ),
                    __CLASS__ . '::delete()',
                    TL_ERROR
                )
            );

            $eventDispatcher->dispatch(
                ContaoEvents::CONTROLLER_REDIRECT,
                new RedirectEvent('contao?act=error')
            );
        }

        throw new NotCreatableException($modelId->getDataProviderName());
    }
protected function guardIsCreatable(EnvironmentInterface $environment, ModelIdInterface $modelId, $redirect = false)
    {
        $dataDefinition = $environment->getDataDefinition();
        if ($dataDefinition->getBasicDefinition()->isCreatable()) {
            return;
        }

        if ($redirect) {
            $eventDispatcher = $environment->getEventDispatcher();

            $eventDispatcher->dispatch(
                ContaoEvents::SYSTEM_LOG,
                new LogEvent(
                    \sprintf(
                        'Table "%s" is not creatable, DC_General - DefaultController - copy()',
                        $dataDefinition->getName()
                    ),
                    __CLASS__ . '::delete()',
                    TL_ERROR
                )
            );

            $eventDispatcher->dispatch(
                ContaoEvents::CONTROLLER_REDIRECT,
                new RedirectEvent('contao?act=error')
            );
        }

        throw new NotCreatableException($modelId->getDataProviderName());
    }
protected function guardIsCreatable ( EnvironmentInterface $ environment , ModelIdInterface $ modelId , $ redirect = false ) { $ dataDefinition = $ environment -> getDataDefinition ( ) ; if ( $ dataDefinition -> getBasicDefinition ( ) -> isCreatable ( ) ) { return ; } if ( $ redirect ) { $ eventDispatcher = $ environment -> getEventDispatcher ( ) ; $ eventDispatcher -> dispatch ( ContaoEvents :: SYSTEM_LOG , new LogEvent ( \ sprintf ( 'Table "%s" is not creatable, DC_General - DefaultController - copy()' , $ dataDefinition -> getName ( ) ) , __CLASS__ . '::delete()' , TL_ERROR ) ) ; $ eventDispatcher -> dispatch ( ContaoEvents :: CONTROLLER_REDIRECT , new RedirectEvent ( 'contao?act=error' ) ) ; } throw new NotCreatableException ( $ modelId -> getDataProviderName ( ) ) ; }
Check if is it allowed to create a new record. This is necessary to create the copy.

@param EnvironmentInterface $environment The environment.
@param ModelIdInterface     $modelId     The model id.
@param bool                 $redirect    If true it redirects to error page instead of throwing an exception.

@return void

@throws NotCreatableException If deletion is disabled.
Check if is it allowed to create a new record . This is necessary to create the copy .