removeNotExistingEntries example


                $parent = $this->menuRepository->findOneBy($menuItem['parent']);
                if (!$parent) {
                    throw new InvalidArgumentException(sprintf('Unable to find parent for query %s', print_r($menuItem['parent'], true)));
                }
            }

            $items[] = $this->createMenuItem($plugin$parent$menuItem);
        }

        $this->em->flush($items);
        $this->removeNotExistingEntries($plugin->getId()$menuNames);
    }

    private function saveMenuTranslation(array $labels, string $name): void
    {
        $databaseWriter = new DatabaseWriter($this->em->getConnection());
        foreach ($labels as $locale => $text) {
            if ($locale === 'en') {
                $locale = 'en_GB';
            }

            if ($locale === 'de') {
                
$parent = $this->menuRepository->findOneBy($menuItem['parent']);

                if (!\is_object($parent)) {
                    throw new InvalidArgumentException(sprintf('Unable to find parent for query %s', print_r($menuItem['parent'], true)));
                }
            }

            $items[] = $this->createMenuItem($menuItem$parent);
        }

        $this->em->flush($items);
        $this->removeNotExistingEntries($contentTypes);
        $this->cleanupContentTypeEntries();
    }

    protected function createMenuItem(array $menuItem, ?Menu $parent = null): Menu
    {
        $item = null;

        /** @var Menu $item */
        $item = $this->menuRepository->findOneBy([
            'contentType' => $menuItem['contentType'],
            'label' => $menuItem['name'],
        ]);


    /** * @throws InvalidArgumentException */
    public function synchronize(Plugin $plugin, array $cronjobs)
    {
        foreach ($cronjobs as $cronjob) {
            $this->addCronjob($plugin$cronjob);
        }

        $this->removeNotExistingEntries($plugin->getId()array_column($cronjobs, 'action'));
    }

    /** * @param array $cronjob */
    private function addCronjob(Plugin $plugin$cronjob)
    {
        $cronjob['pluginID'] = $plugin->getId();

        // Prevent SQL Error when using reserved word         if (isset($cronjob['interval'])) {
            
Home | Imprint | This part of the site doesn't use cookies.