symfony-console

How to hide or delete the defaults available console commands?

家住魔仙堡 提交于 2021-02-19 05:37:59
问题 I created a new Symfony 4 project via symfony new my_project_name . Currently when I execute ./bin/console , the output shows I will create some custom console commands and I want show only my custom commands when I do ./bin/console Maybe I should create a custom executable 'console' from scratch, but I don't know how do that. 回答1: You are creating a complete Symfony application, so all the commands provided by the included packages are available. Instead of starting from a framework and

How to run bin/console messenger:consume command out of Symfony project?

杀马特。学长 韩版系。学妹 提交于 2021-01-29 07:13:44
问题 I use Messenger Component in a non-Symfony project and Doctrine as a DSN transport. Now I want to test my code and consume the messages on my local machine, but I don't know how to run the messenger command in the console. I tried to use Symfony\Component\Console\Application and register the \Symfony\Component\Messenger\Command\ConsumeMessagesCommand command in the console but there are many nested dependencies. Do you have any idea? 回答1: We actually do this in many projects, even WordPress

PhpStorm terminal : Cygwin colors does not work

旧街凉风 提交于 2020-01-13 19:19:29
问题 I have PhpStorm 2016.2 and I added Cygwin in the Shell path as follow : "C:\cygwin64\bin\env.exe" CHERE_INVOKING=1 /bin/bash.exe It's working well, but the colors do not work. For exemple I have ?[32m Name instead of having Name colored in green. I tried several things like adding the plugin Grep Console to have the support of ANSI Color, but didn't work. It's really hard to work with lines with multiple ANSI colors ?[39m ?[32m Scheme ?[39m ?[32m Host ?[39m ?[32m Path . Do not hesitate to ask

Symfony2 like database creation command in laravel console?

若如初见. 提交于 2019-12-30 13:40:29
问题 I have used symfony2 console to create database. If I want to create a database named "symfony" I usually mentioned that name in parameters.yml file and run the below command in console php app/console doctrine:database:create But when came to laravel, I don't find similar command to create database in laravel. Can anyone help me to find out those command to create database directly from Laravel Console . 回答1: You can do that but you will have to create your own command. First, run php

Symfony 4 - 3rd-party bundle commands are no longer automatically discovered

筅森魡賤 提交于 2019-12-23 16:05:18
问题 According to the documentation, a command class must extend Command or ContainerAwareCommand to be automatically discovered and registered (provided its bundle is registered in the Kernel, of course). Since Symfony 4+, this discovery doesn't work as expected. Try this: composer create-project symfony/skeleton test-maxmind-sf4 cd test-maxmind-sf4 composer req cravler/maxmind-geoip-bundle dev-master php bin/console list You will notice that: cravler:maxmind:geoip-update is not registered

Doctrine standalone without cli-config.php

对着背影说爱祢 提交于 2019-12-21 02:50:06
问题 I want to integrate Doctrine ORM into my (non-Symfony) project. I already done this in another project and used the famous cli-config.php into the project root directory. But now, in my new project, I use the Symfony Console component and the Dependency Injection component (to reference services and commands, by tagging them). 1. I absolutely don't want to have a cli-config.php in the project root. How the Sf Doctrine Bundle do this? 2. Also (but it is less important), I would like to have

is it bad practice to kill a script inside of a function?

不羁岁月 提交于 2019-12-13 11:10:32
问题 I'm referring to using the die() function for something else than debugging. This is a "well it works" situation, but is it bad practice? use Symfony\Component\Filesystem\Filesystem; use Symfony\Component\Filesystem\Exception\IOExceptionInterface; /** * This Command will help Cjw create a new demo site to start off * with the Multisite bundle. * * Class CreateSiteCommand * @package Cjw\GeneratorBundle\Command */ class RemoveSiteCommand extends ContainerAwareCommand { private $vendor; //eg

Run multiple Symfony console commands, from within a command

别来无恙 提交于 2019-12-10 18:51:45
问题 I have two commands defined in a Symfony console application, clean-redis-keys and clean-temp-files . I want to define a command clean that executes these two commands. How should I do this? 回答1: See the documentation on How to Call Other Commands: Calling a command from another one is straightforward: use Symfony\Component\Console\Input\ArrayInput; // ... protected function execute(InputInterface $input, OutputInterface $output) { $command = $this->getApplication()->find('demo:greet');

Workaround for doctrine generator in PSR-4 codebase

筅森魡賤 提交于 2019-12-09 19:10:04
问题 With Symfony 2 & Doctrine on a Windows machine I'm trying to generate entities from an existing schema: php app/console doctrine:mapping:import --force CoreBundle annotation generate getters/setters on them: php app/console doctrine:generate:entities --path=/path/to/codebase/src/MyProject/CoreBundle/Entities CoreBundle generate REST CRUD controllers on them using Voryx: php app/console voryx:generate:rest --entity="CoreBundle:User" The first steps works fine and I can find the entities in my

Symfony Console - Overwrite default options

自闭症网瘾萝莉.ら 提交于 2019-12-07 05:35:35
问题 I'm building a CLI application for my app using Symfony Console. The application is required to do some simple package management operations to manage plugins. Therefore, I need a command option named --version with shortcut -v , which does not seem to be possible since --version is reserved for the application version and -v is reserved for the default verbosity setting. How can I either disable the default options or overwrite them for this subcommand? The error popping up states [Symfony