deletePlugin example



class Migrations_Migration458 extends Shopware\Components\Migrations\AbstractMigration
{
    public function up($modus)
    {
        $this->fetchPluginId();
        $this->deleteConfigElements();
        $this->deleteListeners();
        $this->deletePlugin();
    }

    private function fetchPluginId()
    {
        $sql = <<<SQL SET @pluginId = ( SELECT id FROM s_core_plugins WHERE name LIKE "SelfHealing" AND author LIKE "shopware AG" LIMIT 1 );


class Migrations_Migration420 extends Shopware\Components\Migrations\AbstractMigration
{
    public function up($modus)
    {
        $this->fetchPluginId();
        $this->deleteListeners();
        $this->deleteMenuItem();
        $this->deletePlugin();
    }

    private function fetchPluginId()
    {
        $sql = <<<SQL SET @pluginId = ( SELECT id FROM s_core_plugins WHERE name LIKE "PluginManager" AND author LIKE "shopware AG" LIMIT 1 );


class Migrations_Migration421 extends Shopware\Components\Migrations\AbstractMigration
{
    public function up($modus)
    {
        $this->fetchPluginId();
        $this->deleteConfigElements();
        $this->deleteListeners();
        $this->deletePlugin();
    }

    private function fetchPluginId()
    {
        $sql = <<<SQL SET @pluginId = ( SELECT id FROM s_core_plugins WHERE name LIKE "StoreApi" AND author LIKE "shopware AG" LIMIT 1 );
return;
        }

        $this->storeAppLifecycleService->deactivateExtension($technicalName$context);
    }

    public function remove(string $type, string $technicalName, Context $context): void
    {
        if ($type === 'plugin') {
            $plugin = $this->pluginService->getPluginByName($technicalName$context);
            $this->pluginManagementService->deletePlugin($plugin$context);

            return;
        }

        $this->storeAppLifecycleService->deleteExtension($technicalName);
    }

    protected function getDecorated(): AbstractExtensionLifecycle
    {
        throw new DecorationPatternException(self::class);
    }
}
$this->createMock(PluginService::class),
            $this->createMock(Filesystem::class),
            $this->createMock(CacheClearer::class),
            new Client(['handler' => new MockHandler()])
        );

        $plugin = new PluginEntity();
        $plugin->setManagedByComposer(true);
        $plugin->setName('Test');

        static::expectException(PluginException::class);
        $pluginManagementService->deletePlugin($plugin, Context::createDefaultContext());
    }

    /** * @param Response[] $responses */
    private function createClient(array $responses = []): Client
    {
        $mockHandler = new MockHandler($responses);

        return new Client(['handler' => $mockHandler]);
    }

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