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's 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 Backstage 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" />