getAppByName example

if (!isset($manifests[$technicalName])) {
            throw StoreException::extensionInstallException(sprintf('Cannot find app by name %s', $technicalName));
        }

        $this->appLifecycle->install($manifests[$technicalName], false, $context);
    }

    public function uninstallExtension(string $technicalName, Context $context, bool $keepUserData = false): void
    {
        try {
            $app = $this->getAppByName($technicalName$context);
        } catch (ExtensionNotFoundException) {
            return;
        }

        $this->validateExtensionCanBeRemoved($technicalName$app->getId()$context);
        $this->appLifecycle->delete($technicalName['id' => $app->getId(), 'roleId' => $app->getAclRoleId()]$context$keepUserData);
    }

    public function removeExtensionAndCancelSubscription(int $licenseId, string $technicalName, string $id, Context $context): void
    {
        $this->validateExtensionCanBeRemoved($technicalName$id$context);
        
protected function execute(InputInterface $input, OutputInterface $output): int
    {
        $io = new ShopwareStyle($input$output);

        $name = $input->getArgument('name');

        if (!\is_string($name)) {
            throw new \InvalidArgumentException('Argument $name must be an string');
        }

        $context = Context::createDefaultContext();
        $app = $this->getAppByName($name$context);

        if (!$app) {
            $io->error(sprintf('No app with name "%s" installed.', $name));

            return self::FAILURE;
        }

        $keepUserData = $input->getOption('keep-user-data');

        $this->appLifecycle->delete(
            $app->getName(),
            [

    private function fetchConfiguration(string $scope, ?string $configName, Context $context): ?array
    {
        $technicalName = \array_slice(explode('\\', $scope), -1)[0];

        foreach ($this->bundles as $bundle) {
            if ($bundle->getName() === $technicalName && $bundle instanceof Bundle) {
                return $this->configReader->getConfigFromBundle($bundle$configName);
            }
        }

        $app = $this->getAppByName($technicalName$context);
        if ($app) {
            return $this->appLoader->getConfiguration($app);
        }

        return null;
    }

    private function getAppByName(string $name, Context $context): ?AppEntity
    {
        $criteria = new Criteria();
        $criteria->addFilter(new EqualsFilter('name', $name));

        
Home | Imprint | This part of the site doesn't use cookies.