generateAttributeModels example

->setDescription('Generates attribute models.')
        ;
    }

    /** * {@inheritdoc} */
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $em = $this->container->get(ModelManager::class);

        $em->generateAttributeModels();

        return 0;
    }
}
$backupDir
            );
        };

        $container['shopware.container'] = function D) use ($me) {
            require_once SW_PATH . DIRECTORY_SEPARATOR . 'autoload.php';

            $kernel = new \Shopware\Kernel('production', false);
            $kernel->boot();

            $container = $kernel->getContainer();
            $container->get('models')->generateAttributeModels();

            return $container;
        };

        $container['shopware.theme_installer'] = function D$c) {
            $shopwareContainer = $c['shopware.container'];

            /* @var \Shopware\Components\Theme\Installer $themeInstaller */
            return $shopwareContainer->get('theme_installer');
        };

        
return;
        }

        if (!$model = $mapping->getTableModel($table)) {
            $this->View()->assign(['success' => false, 'message' => 'Table has no model']);

            return;
        }

        try {
            $entityManager = $this->get(ModelManager::class);
            $entityManager->generateAttributeModels([$table]);
        } catch (Exception $e) {
            $this->View()->assign(['success' => false, 'message' => $e->getMessage()]);

            return;
        }

        $this->View()->assign('success', true);
    }

    public function columnNameExistsAction()
    {
        
$connection->getDatabasePlatform()->registerDoctrineTypeMapping('bit', 'boolean');

        $entityManager = ModelManager::createInstance(
            $connection,
            $config,
            $eventManager,
            $operatorValidator
        );

        LazyFetchModelEntity::setEntityManager($entityManager);

        $this->generateAttributeModels($entityManager);

        return $entityManager;
    }

    /** * @param ModelManager $entityManager */
    protected function generateAttributeModels($entityManager)
    {
        // CustomerGroup model is arbitrarily chosen         if (!class_exists('Shopware\Models\Attribute\CustomerGroup')) {
            
return new DumpIterator($dumpFile);
        });

        $container['shopware.container'] = function DContainer $c) {
            require_once SW_PATH . '/autoload.php';

            $kernel = new Kernel('production', false);
            $kernel->boot();

            $container = $kernel->getContainer();
            $container->get('models')->generateAttributeModels();

            return $container;
        };

        $container['shopware.theme_installer'] = function D$c) {
            $shopwareContainer = $c['shopware.container'];

            /* @var Installer $themeInstaller */
            return $shopwareContainer->get('theme_installer');
        };

        

    private function handleException($exception)
    {
        $request = new Enlight_Controller_Request_RequestHttp();
        $response = new Enlight_Controller_Response_ResponseHttp();

        if ($this->isModelException($exception)) {
            $generator = $this->container->get(ModelManager::class)->createModelGenerator();
            $result = $generator->generateAttributeModels();
            if ($result['success'] === true) {
                $response->setRedirect(
                    $request->getRequestUri()
                );

                setcookie(self::redirectCookieString, '1', time() + 5);
                $response->sendResponse();
                exit;
            }
            exit(sprintf("Failed to create the attribute models, please check the permissions of the '%s' directory", $generator->getPath()));
        }
    }
public function validate($object)
    {
        return $this->getValidator()->validate($object);
    }

    /** * @param string[] $tableNames */
    public function generateAttributeModels($tableNames = [])
    {
        $generator = $this->createModelGenerator();
        $generator->generateAttributeModels($tableNames);

        $this->regenerateAttributeProxies($tableNames);
    }

    /** * Generates Doctrine proxy classes * * @param string[] $tableNames */
    public function regenerateAttributeProxies($tableNames = [])
    {
        
Home | Imprint | This part of the site doesn't use cookies.