Starting with Symfony2 and creating bundles - console

I am trying to start use Symfony2, and i have troubles with a first step.
In the documentation I found
To create a bundle called AcmeHelloBundle (a play bundle that you'll
build in this chapter), run the following command and follow the
on-screen instructions (use all of the default options):
php app/console generate:bundle --namespace=Acme/HelloBundle
> --format=yml
and I really don’t understand where should I write this string? In which program or in which file?

As Molecule Man said, it's a command line thing. But just to give a few more details:
Open up a console window (also called a command prompt in Windows)
Type "php --version" (no quotes). It should come back with a version number. If it says something like "can't find php" then you need to set a path to php.
Change directory to your Symfony directory
Type "php app/console" If everything is working then you will see a list of available commands. There are many things you can do from the command line.
If you happen to be on a unix system then you can make console executable and just use "./app/console"
Now try creating your bundle

Related

Docfx failing on init command

I am trying to get docfx to generate a doc website based off of a C# library and I can't seem to get any of the commands covered in the documentation to work.
On the quickstart page it states to use the following command to initialize a template docfx init -q however when I run this command I get the following error message:
'init' was not matched. Did you mean 'new'?
'-q' was not matched. Did you mean '-h'?
Required command was not provided.
Unrecognized command or argument 'init'
Unrecognized command or argument '-q'
Usage:
docfx [options] [command]
Options:
--version Show version information
-?, -h, --help Show help and usage information
Commands:
new <templateName> Creates a new docset.
restore <directory> Restores dependencies before build.
build <directory> Builds a docset.
serve <directory> Serves content in a docset.
The documentation (as far as I can tell) doesn't cover the options displayed by the tools output. I have checked a number of times now to make sure I am not going insane but I definitely downloaded the package from the page listed on the quickstart page.
Does anyone regularly use Docfx and can tell me how to go about generating the html for my library?
Looks like you're using 3.x, which is undocumented.
You can download 2.59.2 here

Current configured path for make install

How do I find the current configured path for make install?
The resources that I have read till now only describe how to overwrite it.
configure creates a file called config.log this contains near the top the configure command with the arguments that was run. You should find your --prefix argument there.
Otherwise grepping for PREFIX should get you a result.
Another solution is to use make -n install which would perform a dry run and print what make install would do without doing it.

Running two Symfony commands at the same time

I have two separate console commands within Symfony that are both run as cron jobs. When these commands happen to run at the same time, however, they both want to clear / update the dev cache and this results in one command or the other failing with a PHP fatal error "Cannot redeclare class etc etc etc".
Apart from making sure these two commands run at different times and each clears the dev cache before they run, is there any way to prevent conflicts like this in Symfony console commands?
FWIW, we have tried forcing the environment to prod, but it still seems to want to use the dev cache (so this may end up being a different question altogether):
$ sudo php /var/www/prod/app/console console-command --env=prod orgs --report --do-sync --welcome
PHP Fatal error: Cannot redeclare class Monolog\Handler\FingersCrossedHandler in /var/www/prod/app/cache/dev/classes.php on line 3704
Edit: it turns out that some of our code was explicitly defining the dev environment, totally ignoring the CLI options. Apologies.
Could you try using something like a Makefile
both: make command-one make command-two
command-one:
app/console foo
command-two:
app/console bar
Then to run you could do
make both
or
make command-one
or
make command-two

What command-line to use in Symfony2 framework in windows

I'm creating a website using Symfony2 framework but I can't get proceed to the creation of the website because I don't know where to type like these
$ php symfony configure:database "mysql:host=localhost;dbname=jobeet" root mYsEcret,
$ php symfony doctrine:build-schema.
It seems an Linux command and it doesn't work on windows command-prompt.
What commandLine should I used for this ?
You need to add your PHP installation directory to the %PATH% environment variable, or work from the PHP installation directory.
To add it to path (The best approach - Edited for Windows 7):
Right-click on a My Computer icon
Click Properties
Click Advanced system settings from the left nav
Click Advanced tab
Click Environment Variables button
In the System Variables section, select Path (case-insensitive) and click Edit button
Add a semi-colon (;) to the end of the string, then add the full file system path of your PHP installation (e.g. C:\Program Files\PHP)
Keep clicking OK etc until all dialog boxes have disappeared
Close your command prompt and open it again
Sorted
Alternatively, you can run cd <PHP installation path> before you try and run you command, or call your script like <FULL file system path of php.exe> <path to script>
Then you open the CMD and you write the Symfony commands
I would suggest you to use Easyphp, it has phpreg.exe (or something like that) that will put php in %PATH% variable. It also allows you to create virtual hosts from browser, and easyphp will take care of everything else.
Instead of Sublime, use Phpstorm. It has by far the best Symfony2 plugin of all editors. If you are still learning S2, you will definatelly need autocompletion for forms, services, doctrine... Just amazing!

iexpress not executing installer

I have an install.bat file and a resource folder. so long as these two files are in the same directory, if you run install.bat, it will install a my lwjgl game. so what im trying to do is make a self extracting file that when completed runs the launch.bat file. I have tried using iexpress, and got it working for the most part. i have added in all my files and such so it will extract to some directory and then i can run the install.bat file to get my program to work. thing is though, i want the exe i created with iexpress to launch install.bat when its finished. so, i tried using the option in iexpress that says it will execute a command when finished the "installation" (using quotes because its not the actual installation, just extracting the files to some directory specified by the user). when i get to the step where it says what i would like to execute during and after the "installation". during the installation i left blank. after the installation i chose the install.bat file. when i try to click next though, it tells me i must choose something for the command during the extraction. I don't have anything specific to do during the installation so i just said "echo." (without quotes). after i was done i tried running the installer. before it even prompted me for a folder to extract to, it told me that echo. could not be executed. so i went back into my installation (via a .sed file) and changed the "echo." to "pause". that didn't work either. i then read on another website that in order to run a file the way i would like to, i put the file name in both the during and after installation boxes. i tried doing that and it didn't work either. can anyone please help me?
If I understood your question correctly you will need to specify what the iexpress must do at the post install command option provided so that cmd.exe is used instead of command.com, eg:
cmd.exe /c filethatyouwanttorun.bat
Refer to the question: Create Batch file for iexpress.
You can use the SED file and then modify the self extraction directive. This will run the batch file that you wanted to run and then install the application. (If you have chosen the option to extract and run an installation in iexpress, a temp folder will be used for the extraction I suppose.)
I'm not sure I understand your question exactly but perhaps a few points would help:
If you want a "do nothing" command, you can use something like:
cmd /c echo.
There is no "command during the extraction". There's only an install program and a post install command. Both of these execute after extraction. If you only need to execute one batch file, put it in the install program line and leave the post install command blank.
You can't ask the user for an extraction path and execute a file. You can only do one or the other. (The install program could prompt the user and copy the files there, though.)

Resources