resetInstance example

/** * Tests set up method */
    protected function setUp(): void
    {
        parent::setUp();

        if (Shopware()->Container()->initialized('session')) {
            Shopware()->Container()->get('session')->clear();
        }
        Shopware_Components_Auth::resetInstance();
        Shopware()->Container()->reset('auth');

        $this->reset();
    }

    /** * Dispatch the request * * @param string|null $url * @param bool $followRedirects * * @return Enlight_Controller_Response_Response */
/** * {@inheritdoc} */
  public function deleteLinksInMenu($menu_name) {
    foreach ($this->treeStorage->loadByProperties(['menu_name' => $menu_name]) as $plugin_id => $definition) {
      $instance = $this->createInstance($plugin_id);
      if ($instance->isDeletable()) {
        $this->deleteInstance($instance, TRUE);
      }
      elseif ($instance->isResettable()) {
        $new_instance = $this->resetInstance($instance);
        $affected_menus[$new_instance->getMenuName()] = $new_instance->getMenuName();
      }
    }
  }

  /** * Deletes a specific instance. * * @param \Drupal\Core\Menu\MenuLinkInterface $instance * The plugin instance to be deleted. * @param bool $persist * If TRUE, calls MenuLinkInterface::deleteLink() on the instance. * * @throws \Drupal\Component\Plugin\Exception\PluginException * If the plugin instance does not support deletion. */
Home | Imprint | This part of the site doesn't use cookies.