findBy example


        }

        $output->writeln('<info>Default Plugin snippets processed correctly</info>');
    }

    protected function exportPlugins(InputInterface $input, OutputInterface $output, QueryHandler $queryLoader)
    {
        $pluginRepository = $this->container->get('shopware.model_manager')->getRepository(Plugin::class);

        /** @var Plugin[] $plugins */
        $plugins = $pluginRepository->findBy(['active' => true]);

        $pluginDirectories = $this->container->getParameter('shopware.plugin_directories');

        if (!\is_array($pluginDirectories)) {
            throw new RuntimeException('Parameter shopware.plugin_directories has to be an array');
        }

        foreach ($plugins as $plugin) {
            if ($plugin->getSource()) {
                $directory = $pluginDirectories[$plugin->getSource()] . $plugin->getNamespace();
            } else {
                


    public function getFieldsAction()
    {
        $id = (int) $this->Request()->getParam('formId');
        if ($id === 0) {
            $this->View()->assign(['success' => false, 'message' => 'No valid form Id']);

            return;
        }

        $result = $this->getManager()->getRepository(Field::class)->findBy(
            ['formId' => $id],
            ['position' => 'ASC']
        );

        $resultArray = $this->getManager()->toArray($result);

        $this->View()->assign(['success' => true, 'data' => $resultArray, 'total' => \count($resultArray)]);
    }

    public function updateFieldAction()
    {
        
$slugifiedNames[] = $this->slugService->slugify($presetName);
        }

        // Make default presets deletable when plugin is removed         $modelManager->getConnection()->createQueryBuilder()
            ->update('s_emotion_presets', 'preset')
            ->set('preset.custom', '1')
            ->where('preset.name IN (:names) AND preset.custom = 0')
            ->setParameter('names', $slugifiedNames, Connection::PARAM_STR_ARRAY)
            ->execute();

        $presets = $modelManager->getRepository(Preset::class)->findBy(['name' => $slugifiedNames]);

        foreach ($presets as $preset) {
            $this->presetResource->delete($preset->getId());
        }
    }
}
/** * Get namespace action */
    public function getNamespacesAction()
    {
        $node = $this->Request()->getParam('node');

        if ($node !== 'root') {
            $snippets = $this->get('models')
                                  ->getRepository('Shopware\Models\Snippet\Snippet')
                                  ->findBy(['namespace' => $node]);

            $snippets = $this->get('models')->toArray($snippets);

            $result = [];
            foreach ($snippets as $snippet) {
                $result[] = [
                    'id' => $snippet['id'],
                    'namespace' => $snippet['name'],
                    'fullNamespace' => $snippet['namespace'],
                    'leaf' => true,
                ];
            }
// Default theme directories         return array_merge($configDir$this->getPluginDirs()$this->getThemeDirs($themeDir));
    }

    /** * @return array<string> */
    private function getPluginDirs(): array
    {
        $configDir = [];

        $plugins = $this->modelManager->getRepository(Plugin::class)->findBy(['active' => true]);
        foreach ($plugins as $plugin) {
            if ($plugin->isLegacyPlugin()) {
                $pluginPath = rtrim($this->pluginDirectories[$plugin->getSource()], DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $plugin->getNamespace() . DIRECTORY_SEPARATOR . $plugin->getName();

                $pluginSnippetPath = $pluginPath . DIRECTORY_SEPARATOR . 'Snippets' . DIRECTORY_SEPARATOR;
            } else {
                $pluginPath = rtrim($this->pluginDirectories[$plugin->getNamespace()], DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $plugin->getName();

                $pluginSnippetPath = $pluginPath . DIRECTORY_SEPARATOR . 'Resources' . DIRECTORY_SEPARATOR . 'snippets' . DIRECTORY_SEPARATOR;
            }

            
$sourceDir = $rootDir . '/' . $source . '/';

        $databaseLoader->setOutput($output);
        $databaseLoader->loadToDatabase($sourceDir$force);

        // Import plugin snippets         if ($input->getOption('include-plugins')) {
            $pluginRepository = $this->container->get('shopware.model_manager')->getRepository(Plugin::class);

            /** @var Plugin[] $plugins */
            $plugins = $pluginRepository->findBy(['active' => true]);

            $pluginDirectories = $this->container->getParameter('shopware.plugin_directories');

            if (!\is_array($pluginDirectories)) {
                throw new RuntimeException('Parameter shopware.plugin_directories has to be an array');
            }

            foreach ($plugins as $plugin) {
                if (\array_key_exists($plugin->getSource()$pluginDirectories)) {
                    $pluginPath = $pluginDirectories[$plugin->getSource()] . $plugin->getNamespace() . '/' . $plugin->getName();

                    


            return;
        }

        $localeRepository = $this->container->get(ModelManager::class)
            ->getRepository(Shopware\Models\Shop\Locale::class);

        $locale = $localeRepository->find($localeId);

        if (!$locale) {
            $locale = $localeRepository->findBy(['locale' => $localeId]);

            if ($locale && \count($locale) === 1) {
                $locale = $locale[0];
            }
        }

        if (!$locale) {
            $this->View()->assign([
                'success' => false,
                'message' => false,
            ]);

            


        $documentConfigKeys = array_map(function D$key) {
            return '__document_' . strtolower($key);
        }$documentConfigKeys);

        $documentConfigValues = array_intersect_key($valuesarray_flip($documentConfigKeys));
        $persistElements = [];

        foreach ($documentConfigValues as $key => $value) {
            $key = str_replace('__document_', '', $key);
            $elements = $this->get('models')->getRepository(DocumentElement::class)->findBy(['name' => $key]);

            if (empty($elements) || empty($value)) {
                continue;
            }

            if ($key === 'logo') {
                $hash = Random::getAlphanumericString(16);
                $value = sprintf(
                    '<p><img id="tinymce-editor-image-%s" class="tinymce-editor-image tinymce-editor-image-%s" src="{media path=\'%s\'}" style="max-height: 20mm;" data-src="%s" /></p>',
                    $hash,
                    $hash,
                    
'data' => $this->Request()->getParams(),
                'message' => 'File does not exist.',
            ]);

            return;
        }

        // Disable Smarty rendering         $this->Front()->Plugins()->ViewRenderer()->setNoRender();
        $this->Front()->Plugins()->Json()->setRenderer(false);

        $orderModel = $this->getManager()->getRepository(Document::class)->findBy(['hash' => $this->Request()->getParam('id')]);
        $orderModel = $this->getManager()->toArray($orderModel);

        $fileName = $this->container->get('events')->filter(
            'Shopware_Controllers_Order_OpenPdf_FilterName',
            $orderModel[0]['documentId'],
            ['data' => $orderModel[0]]
        );

        $response = $this->Response();
        $response->headers->set('cache-control', 'public', true);
        $response->headers->set('content-description', 'File Transfer');
        
Home | Imprint | This part of the site doesn't use cookies.