PhpStorm 2018.2 Help

Shopware

Shopware is a powerful and flexible application that can be used for building eCommerce experiences. It is based on a number of Symfony framework components, supported in PhpStorm through the core features and the Symfony Plugin. The Shopware plugin adds additional support for developing Shopware eCommerce with PhpStorm. The source code for the Shopware plugin, as well as its issue tracker, can be found on GitHub.

Before you start

Before you start working with Shopware, make sure that the Symfony, PHP Annotations, and Shopware plugins are installed and enabled.

Enabling the Symfony Plugin for a project

Having installed the Symfony and Shopware plugins, you need to explicitly enable the Symfony plugin for the project. After creating or opening a Symfony project, PhpStorm will display a notification message suggesting you enable the plugin.

To enable the Symfony Plugin for a project

  1. Do any of the following:

    • Click the Enable the Symfony plugin with autoconfiguration link in the notification message.

      ps symfony plugin notification
    • In the Settings/Preferences dialog (Ctrl+Alt+S), navigate to Languages & Frameworks | PHP | Symfony and select the Enable Plugin for this Project checkbox.

  2. Restart PhpStorm for the changes to take effect.

Code Completion for Shopware

In the editor, press Ctrl+Space to invoke code completion and do any of the following:

  • Subscribe to events provided by Shopware and other plugins as well as complete the names of controllers and hooks.

    ps shopware complete subscribe event
  • Complete array keys and values when using setElement for forms.

    ps shopware complete form element
  • Complete array keys like module, controller and action when assembling a URL using the Enlight_Controller_Router 's assemble method.

    ps shopware assemble url completion
  • Complete array keys when creating a plugin in Shopware and implementing the getInfo or Path methods.

    ps shopware get info completion
  • Complete block names when working with Smarty templates.

    ps shopware smarty completion
  • Complete the names of existing templates when including or extending other templates by means of the {extends file="..."} and {include file="..."} constructs.

    ps shopware complete extend template
  • Complete the names of files (such as scripts, stylesheets, or images) when referencing them from a Smarty template.

    ps shopware complete template reference
  • Complete the snippets' and widgets' namespaces.

    ps shopware complete snippet
  • Complete the names of Doctrine repositories when calling getRepository.

    ps shopware complete doctrine
  • Complete ExtJs models or controllers, for example when creating model associations.

    ps shopware complete extjs

Code Navigation for Shopware

To navigate to the declaration of an item, position the caret at its usage and press Ctrl+B. Alternatively, Ctrl+Click (for Windows and Linux) or ⌘+Click (for macOS) the usage.

  • Navigate to a controller, hook, or event.

    ps shopware jump to event declaration
  • Navigate to a module, controller, or action when assembling a URL using the Enlight_Controller_Router 's assemble method.

    ps shopware jump to controller
  • Navigate to a Smarty template or a template's block definition.

    ps shopware jump to smarty block

    Within a block's definition, you can click icons gutter implementedMethod or icons gutter overridingMethod in the editor gutter to navigate to the templates where the corresponding block is implemented or overwritten.

Navigating to related items

Use the ps shopware icon icon in the editor gutter to navigate between related Shopware items.
  • From an event listener, navigate back to the subscribeEvent method where we're subscribing to the event.

    ps shopware jump to subscribed event
  • To navigate between several related items (for example, a Smarty template, an include, and a related controller), click ps shopware icon in the editor gutter and choose the desired item from the popup menu.

    ps shopware jump to related

Code inspection and quick-fixes for Shopware

When you subscribe to an event for which no listener is created, the Shopware plugin will provide a quick-fix (Alt+Enter) for generating an event handler stub.

ps shopware create event listener
Last modified: 21 November 2018

See Also