Commit b57c2ae9 authored by Avris's avatar Avris

readme

parent b53d20e5
## Micrus Doctrine Bridge ##
# Micrus Doctrine Bridge ##
This is a module for [Micrus framework](https://micrus.avris.it) that allows you
to integrate it with [Doctrine ORM](http://www.doctrine-project.org/projects/orm.html).
### Installation
## Installation
In your `App\App:registerModules` register the module:
Run:
composer require avris/micrus-doctrine
Then register the module in your `App\App:registerModules`:
yield new \Avris\Micrus\Doctrine\DoctrineModule;
then run:
Finally, run:
composer require avris/micrus-doctrine
bin/env
You will be asked for a [connection string](http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url)
and it will be saved in the `.env` file.
### EntityManager
## EntityManager
`DoctrineManager` will scan all modules for a `/src/Entity` directory and if it's there --
it will automatically register all classes from this directory as doctrine entities.
......@@ -34,7 +38,7 @@ Doctrine's `EntityManager` is registered in the container as `Doctrine\ORM\Entit
return $this->redirectToRoute('home');
}
### UserProvider
## UserProvider
This module registers Doctrine as the `UserProvider`.
It will try to find a user from `App\Entity\User` repository using `email` as identifier.
......@@ -44,7 +48,7 @@ To modify those values, just use the container:
arguments:
$column: username
### MatchProvider
## MatchProvider
Doctrine will automatically match the arguments of your controller if they are entities, for example:
......@@ -56,7 +60,7 @@ Doctrine will automatically match the arguments of your controller if they are e
For request `GET /post/8/read` will try to find `App\Entity\Post` with `id = 8`
and either return it or throw a `NotFoundHttpException` if failed.
### Console
## Console
Some Doctrine console commands are available in `bin/micrus` under `db` namespace:
......@@ -68,7 +72,7 @@ Some Doctrine console commands are available in `bin/micrus` under `db` namespac
php bin/micrus db:query:sql "SELECT * FROM user"
php bin/micrus db:query:dql "SELECT u FROM App\Model\User u WHERE u.role='ROLE_ADMIN'"
### Copyright
## Copyright
* **Author:** Andre Prusinowski [(Avris.it)](https://avris.it)
* **Licence:** [MIT](https://mit.avris.it)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment