If you are working with the team and it is your first time running this application to start developing it, relax. You just need to reproduce a few steps first.
Before we start, make sure you are on the project directory: $ cd path/to/the/project
- Install Composer on your computer and make sure you renamed
composer.phar
tocomposer
and moved it to thebin
directory. - Create a file named
.env
. It should be a copy of.env.example
for now. - Run the command:
$ php bin/composer install
.
After these steps, a new file is created in your root directory: vendor
. It contains all our dependencies installed and managed by Composer.
- Modify your
DATABASE_URL
config in.env
file. - Configure the
driver
aspdo_mysql
andserver_version
as5.7
inconfig/packages/doctrine.yaml
. - Create your database:
$ php bin/composer run-script sge:database:create
. - Run all the migrations:
$ php bin/composer run-script sge:database:migrate
. - Populate it with an initial data:
$ php bin/composer run-script sge:database:populate
After these steps, your Database should be created and populated with a few tables.
- Start your server:
$ php -S 127.0.0.1:8000 -t public
OR; - Use Composer's server:
$ php bin/composer require server --dev
.
You do not need to use both of them. Choose only one option (we usually use the 1st one).
- Write your tests in the
tests/
folder. - Run
$ php bin/phpunit
.
Whenever you need to change anything in your database structure (e.g. changing columns of an entity), you also need to create migrations.
Migration is a concept. It saves your database's change history, so the latest changes can also be executed by the other developers.
If you to change any Entity, the following steps must be followed:
- Generate the migration file:
$ php bin/console make:migration
. - Run the recently created migration:
$ php bin/console doctrine:migrations:migrate
.
More info can be found at Symfony's official docs.