Frontastic backend commandline tools
As we're using Symfony, we make use of the Symfony command-line interface. So if you're familiar with that, you'll be familiar with ours, of course with some Frontastic added functionality and commands.
Each project has its own
bin folder and within it, there are lots of handy commands that you can use to help debug issues or find information that you need.
To bring up your available options that come built-in, just run
<projectDirectory>bin/console list and you'll see everything that's available. There's quite a lot, so we've pulled out some of the most useful ones in this article and the reasons why you'd use them.
- If you need to clear all the caches, for example, some Symfony caches for dependency injection, or application caches, then you can use
- To clear all your local data so it will be applied from the Frontastic Editor using the Replicator, use
- To see a list of all the routes that are registered for your project, you can use
- If you need to manually rebuild routes from node definitions, you can use
- To create a basic bundle that follows the Frontastic naming schema, you can use
- To check your cronjobs are working properly, you can manually run the same command that's run by cron on the servers, so using
- To debug categories, use
- To debug products, use
- To generate a static sitemap file, use
help in front of any command in your console to find out more information for that specific command. For example,
<your-project>bin/console help frontastic:clear, you'll then be given more explanations of how it works plus more options.
You can also add your own commands within your console. To do this you need to add your
php code that says what you want it to do and then add it to your command folder in your project. You then need to make sure that it has a class that extends
ContainerAwareCommand. For example,
class DumpCategoriesCommand extends ContainerAwareCommand. Then you need to add the below to your
services.xml file for your config, this adds all commands that are in that directory:
<prototype namespace="Frontastic\Common\AccountApiBundle\Command\" resource="../../Command" autoconfigure="true" />