Run command in symfony2 - php

I'm trying to create my first page in Symfony2 according to this tutorial: http://symfony.com/doc/2.0/book/page_creation.html. Can anyone please tell how should I run this command:
php app/console init:bundle "Acme\StudyBundle" src
I'm new to symfony and I have no idea what this means...

php app/console init:bundle "Acme\StudyBundle" src
is a shell command you're meant to run at the command line of the machine you've installed Symfony on. You change into the directory where you installed symfony, and run it -- how you do that is obviously operating system- and installation-dependent.
The command itself invokes the command-line version of your PHP interpreter (php) to run Symfony's console script (app/console) to initialise a new Symfony bundle (init:bundle) called StudyBundle, from the (pretend!) company Acme (Acme\StudyBundle) in the directory src.
For me, running it would look a bit like this (from Terminal, on a Mac):
Matt-Gibsons-iMac:~ matt$ cd Sites/Symfony
Matt-Gibsons-iMac:Symfony matt$ php app/console init:bundle "Acme\StudyBundle" src
Summary of actions
- The bundle "AcmeStudyBundle" was created at "src/Acme/StudyBundle" and is using the namespace "Acme\StudyBundle".
...
A word of warning, though: Symfony 2 is still very new -- not yet even officially released -- and while what documentation there is is okay, the docs are nothing like as complete or helpful to the beginner as the excellent, mature documentation for Symfony 1.4. Also, Symfony 2 best practices have yet to be established.
So, if you're a complete Symfony novice you might find Symfony 1.4 easier going, especially following the Jobeet tutorial. Even though Symfony 2 is quite a big change from Symfony 1, learning Symfony 1 will introduce you to a lot of concepts that remain familiar in Symfony 2, such as generating new code modules from the command line, like you're trying to do here.

Related

How can I specify the symfony version of my project in netbeans?

I am trying to create a symfony2 project, with the symfony2.8 version. However whenever I create a symfony project in netbeans I cannot find where to specify the version of symfony and it always creates a symfony3 project. Is there any way to tell netbeans to use the symfony2 version instead of 3?
I'd save yourself the headache and time of trying to figure that out, and instead use the Symfony recommended way.
php -r "readfile('https://symfony.com/installer');" > symfony
# for example, if WAMP is used ...
">c:\> move symfony c:\wamp\bin\php
# ... then, execute the command as:
">c:\> symfony
# moving it to your projects folder ...
">c:\> move symfony c:\projects
# ... then, execute the command as
">c:\> cd projects
">c:\projects\> php symfony
https://symfony.com/doc/current/setup.html
Net-beans will still recognise your project as a Symfony project along with all the added benefits, but also with the ease of setting up new Symfony projects with one command from the CLI.
If you really want to stick to the Net-beans way, simply allow Net-beans to install it, however it chooses. Once it's installed change the version number within the composer.json file. The biggest issue you'll have for this is you'll have to check all your version numbers are compatible.

Doctrine 2 orm:convert-d1-schema command missing in Symfony 2

I'm on windows 7 64 bits.
I will have to do the migration of a Symfony 1.4 website.
I found the command orm:convert-d1-schema to convert the Symfony 1.4 DB Schema to Symfony 2.
But this command is not implemented in Symfony 2.4
http://forum.symfony-project.org/viewtopic.php?f=23&t=33149
https://github.com/symfony/symfony/issues/1442
I tried to install the doctrine 2 CLI to do the converting but I got errors and stopped trying this as this is probably a bad idea.
Do you know how I can get this command working on Symfony ?
In order to use all the orm:* commands available in Doctrine 2 you will need to configure/setup the Commandline Tools.
If you've followed a standard symfony 2 project setup you probably have a bin/ directory under your project root. Inside that folder you should file two files doctrine and doctrine.php.
You should use this doctrine executable or probably the doctrine.php since you're on Windows instead of the app/console one.
This way you'll be able to use the Doctrine ORM commands directly instead of the "alias provided by symfony" for them.
If you have further questions regarding this let me know.
Regards,

Zend Framework 2 - Doctrine 2 - How to use command line under Windows

I found this website listing several interesting Doctrine CLI commands.
I set up a Doctrine model class like it is described in one of these tutorials.
But I still wonder how to use the CLI commands. How can Zend or Doctrine know where my classes are and how does Windows know that my Doctrine executable lies within my projects library?
Does anyone know how to utilize these CLI commands?
Doctrine cli is based on the symfony console package.
If you use composer for installing, take a look in the vendor/bin directory. You will find .bat files for the doctrine cli there.

Netbeans and Zend Framework 2 configuration - zh.sh file

I am new to PHP and Zend Framework 2.
I am currently going through the ZF2 tutorial. I've run the commands:
php composer.phar self-update
php composer.phar install
Then opened up the latest Netbeans version. However, when asked for the zh.sh file, I couldn't find it anywhere in the zf2-tutorial folder. Is this file something that we need to create or is it expected to exist by default in the ZF2?
It'd be great if someone could point me to the right direction.
As other have hinted, NetBeans has not caught up to ZF2 yet (ZF has only been out for a handful of weeks).
As of right now, ZF2 has no command-line tooling (ie: zf.sh). Instead, you're encouraged to use the Skeleton Application to get things started.
While NetBeans doesn't have any specific ZF2 support, it's still a great IDE to use while developing ZF2 projects.
Just skip the ZF-specific stuff. Grab the Skeleton App, and create a new NetBeans project ("from existing sources"), and start hacking.
In all honesty, I can't remember ever using any of the ZF-specific stuff in netbeans. The framework is just a bunch of PHP files, and NetBeans works well without any framework-specific knowledge.
I don't know the content of zf.sh, but I was using this zf.bat in windows as it should be zf.sh in linux so's. This way I got from netbeans my zend core in the creation project phase ( with no errors):
git clone git://github.com/zendframework/ZendSkeletonApplication.git
cd ZendSkeletonApplication
php composer.phar self-update
php composer.phar install
With Zend included in php.ini, and COMPOSER_PROCESS_TIMEOUT=5000 set in the same file (also set max_execution_time=5000). This is because it didn't work for me to put it in command line orders.

PHP Symfony 1.4: Task 'cc' is not defined

Recently I've been working on Symfony project using a git repo. My problem is that when I try to clear the symfony's cache using php symfony cc or php symfony cache:clear i get message like:
Task "cc" is not defined.
Also, when I list all the possible actions using php symfony I can't find anything connected with clearing cache.
What's weird is that my friend using the same repo can clear his cache.
I'm using Fedora 16, Symfony's version is 1.4.17-DEV.
Tom
Look in your .../symfony/lib/cache/ directory, may be empty, if so, recopy symfony files
Good luck

Categories