Skip to content

abdounikarim/poc-symfony-doctrine-mariadb

Repository files navigation

Symfony with Doctrine and MariaDB

This POC is just a Symfony minimalist app with Doctrine and MariaDB. It uses a Docker container for MariaDB Database.

Requirements

Installation

Clone this repository:

https://github.com/abdounikarim/poc-symfony-doctrine-mariadb

Go on the project root folder:

cd poc-symfony-doctrine-mariadb/

Install PHP dependencies:

composer install

Run docker container for MariaDB:

docker-compose up -d

Create database:

symfony console doctrine:database:create

Run database migrations:

symfony console doctrine:migrations:migrate --no-interaction

Insert data with symfony command:

symfony console doctrine:query:sql "INSERT INTO dummy (name) VALUES ('Foo'), ('Bar'), ('Baz');"

Select data with symfony command:

symfony console doctrine:query:sql "SELECT * FROM dummy;"

Usage

Start the web server:

symfony serve

Then access the application in your browser at the given URL (https://localhost:8000 by default).

Tests

Create database in test env:

symfony console doctrine:database:create --env=test

Run database migrations in test env:

symfony console doctrine:migrations:migrate --no-interaction --env=test

Insert data with symfony command in test env:

symfony console doctrine:query:sql "INSERT INTO dummy (name) VALUES ('Foo'), ('Bar'), ('Baz');" --env=test

Select data with symfony command in test env:

symfony console doctrine:query:sql "SELECT * FROM dummy;" --env=test

Execute this command to run tests:

symfony run bin/phpunit

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published