Frontastic backend commands
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, 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
<projectDirectory>/bin/console cache:clear
-
To clear all your local data so it will be applied from the Frontastic studio using the Replicator, use
<projectDirectory>/bin/console frontastic:clear
-
To see a list of all the routes that are registered for your project, you can use
<projectDirectory>/bin/console debug:router
-
If you need to manually rebuild routes from node definitions, you can use
frontastic:routes:rebuild
-
To create a basic bundle that follows the Frontastic naming schema, you can use
<projectDirectory>/bin/console frontastic:create:bundle
-
To check your cronjobs are working properly, you can manually run the same command that's run by cron on the servers, so using
<projectDirectory>/bin/console frontastic:cron:run
-
To generate a static sitemap file, use
frontastic:sitemap:generate
By writing 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" />
Updated over 2 years ago