What are the Slack Archives?

It’s a history of our time together in the Slack Community! There’s a ton of knowledge in here, so feel free to search through the archives for a possible answer to your question.

Because this space is not active, you won’t be able to create a new post or comment here. If you have a question or want to start a discussion about something, head over to our categories and pick one to post in! You can always refer back to a post from Slack Archives if needed; just copy the link to use it as a reference..

Any tips on debugging Twig on Spryker? Possible to enable debug mode?

U039B0RUXMF
U039B0RUXMF Posts: 39 πŸ§‘πŸ»β€πŸš€ - Cadet

Any tips on debugging Twig on Spryker? Possible to enable debug mode?

Comments

  • Valerii Trots
    Valerii Trots SRE @ Spryker Sprykee Posts: 1,654 ✨ - Novice
  • U039B0RUXMF
    U039B0RUXMF Posts: 39 πŸ§‘πŸ»β€πŸš€ - Cadet

    Yeah it just makes the dump output Symfony like πŸ€” πŸ™‚

  • U039B0RUXMF
    U039B0RUXMF Posts: 39 πŸ§‘πŸ»β€πŸš€ - Cadet

    Ideally I'd like to receive Twig errors, when there is a problem with template

  • Alberto Reyer
    Alberto Reyer Posts: 690 πŸͺ - Explorer
    1. Make sure your twig cache is in a path that is mounted to your host system (config/Shared/config_default-development.php)

    1. Now you can search for the template you want to debug in data/DE/cache/Yves/twig (e.g.: search for pagination/pagination.twig) this will guide you to the right template which is pure PHP code and can be debugged like any other PHP class. But be warned, debugging Twig templates is very different and complex
  • sebastian.larisch
    sebastian.larisch Spryker Customer Posts: 143 πŸ§‘πŸ»β€πŸš€ - Cadet

    you can also set a breakpoint directly in each twig file and debug it as you would do with a php file. you just need to add the cache file in phpstorm settings PHP -> Debug -> Templates in the Twig Debug Cache path.