1A) Download composer, which will download the composer.phar file which can be kept anywhere:
cd /path/to/composer/install/dir
curl -s https://getcomposer.org/installer | php
1B) Install symfony:
cd /path/to/composer/install/dir
php composer.phar create-project symfony/framework-standard-edition /path/to/webroot/Symfony 2.1.x-dev
2) Check the configuration
Go to http://localhost/Symfony/web/config.php
3) Configure the database
Edit the /path/to/webroot/Symfony/app/config/parameters.yml file
4A) If you already have the database table created, make sure that the primary key is named id.
4B) If you already have the database table created, you can skip to creating an entity class:
php app/console doctrine:generate:entity --entity "MySpecificBundle:Things" --fields="id:int(11) price:float"
5) Edit the src/.../Controller/DefaultController.php file to do something interesting with the database table.
For example:
$row = $this->getDoctrine()
->getRepository('MySpecificBundle:Things')
->find($name);
if (!$row)
{
throw $this->createNotFoundException('No row found for id: '.$name);
}
$otherVariable = $row->getOtherVariable();
return array('name' => $otherVaraible);
6) Open your browser to http://localhost/Symfony/web/app_dev.php/hello/1 to view the row
7) To create a CRUD scaffold, perform the following command:
php app/console doctrine:generate:crud --entity="MySpecificBundle:Things"
Then open your browser to http://localhost/Symfony/web/app_dev.php/things
Showing posts with label composer. Show all posts
Showing posts with label composer. Show all posts
Tuesday, February 12, 2013
Friday, February 8, 2013
Install Symfony2 and propel using composer
1A) Download composer, which will download the composer.phar file which can be kept anywhere:
cd /path/to/composer/install/dir
curl -s https://getcomposer.org/installer | php
1B) Install symfony:
cd /path/to/composer/install/dir
php composer.phar create-project symfony/framework-standard-edition /path/to/webroot/Symfony 2.1.x-dev
_____________________
2) To optionally install propel:
2A) Configure composer.json file
cd /path/to/webroot/Symfony
Open /path/to/webroot/Symfony/composer.json in a text editor
Add in the following line:
"require": {
... ,
"propel/propel-bundle": "1.1.*"
},
2B) Download and install propel:
cd /path/to/webroot/Symfony
php /path/to/composer/install/dir/composer.phar update
After this step, you'll need to manually register the bundle in the AppKernel.php file. See the following page for how to do that: http://propelorm.org/cookbook/symfony2/working-with-symfony2.html#configuration (Search for "The second step is to register this bundle in the
After that, you'll need to "configure the bundle": http://propelorm.org/cookbook/symfony2/working-with-symfony2.html#configuration Note: I had to comment out or delete the doctrine: block, otherwise symfony would get confused and thought I was using doctrine.
cd /path/to/composer/install/dir
curl -s https://getcomposer.org/installer | php
1B) Install symfony:
cd /path/to/composer/install/dir
php composer.phar create-project symfony/framework-standard-edition /path/to/webroot/Symfony 2.1.x-dev
_____________________
2) To optionally install propel:
2A) Configure composer.json file
cd /path/to/webroot/Symfony
Open /path/to/webroot/Symfony/composer.json in a text editor
Add in the following line:
"require": {
... ,
"propel/propel-bundle": "1.1.*"
},
2B) Download and install propel:
cd /path/to/webroot/Symfony
php /path/to/composer/install/dir/composer.phar update
After this step, you'll need to manually register the bundle in the AppKernel.php file. See the following page for how to do that: http://propelorm.org/cookbook/symfony2/working-with-symfony2.html#configuration (Search for "The second step is to register this bundle in the
AppKernel class:") (Note that I had to add the first configuration on that page, even though I was using Composer")After that, you'll need to "configure the bundle": http://propelorm.org/cookbook/symfony2/working-with-symfony2.html#configuration Note: I had to comment out or delete the doctrine: block, otherwise symfony would get confused and thought I was using doctrine.
Labels:
composer,
propel,
symfony,
web application development
Subscribe to:
Posts (Atom)