Skip to content

Commit

Permalink
Improve README
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomas Votruba authored and Majkl578 committed Jul 12, 2015
1 parent 657455a commit c60283d
Showing 1 changed file with 18 additions and 24 deletions.
42 changes: 18 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,46 +3,39 @@
Nette addon for using Doctrine 2 entities directly as Nette identity


Motivation
------
## Motivation

If you are using Nette 2 and Doctrine 2 together, you will sooner or later
want to use some of your entities also as identity, because it is practical.

Fortunately, this addon is here to help you with this task!


Requirements
------
## Requirements

- PHP 5.3.2 or newer
- Nette 2.1 or newer
- Doctrine ORM 2.3 or newer
- PHP 5.3.2+
- Nette 2.1+
- Doctrine ORM 2.3+


Installation
------
## Installation

1. Add "`majkl578/nette-identity-doctrine`" to your dependencies in composer.json.
Don't forget to run `composer update`.
2. Register extension to start using this addon.
1. In Nette 2.0, add the following call just before the call `$configurator->createContainer()`:
```php
Majkl578\NetteAddons\Doctrine2Identity\DI\IdentityExtension::register($configurator);
```
1. Install via composer:

2. In Nette 2.1, register it in your configuration file in extensions section:
```
doctrine2identity: Majkl578\NetteAddons\Doctrine2Identity\DI\IdentityExtension
`composer require majkl578/nette-identity-doctrine`

2. Register extension in your configuration file in extensions section:
```yaml
extensions:
doctrine2identity: Majkl578\NetteAddons\Doctrine2Identity\DI\IdentityExtension
```
3. Delete cache.
You're done. ;)
Usage
------
## Usage
Imagine you have an application where you're implementing authentication.
All you have is a regular entity for the user in your application.
Expand All @@ -51,6 +44,8 @@ The only thing you have to do is to implement `Nette\Security\IIdentity` on your
so you get something like this:

```php
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
*/
Expand All @@ -72,7 +67,7 @@ class UserEntity implements IIdentity
public function getRoles()
{
return [];
return array();
}
}
```
Expand All @@ -84,7 +79,6 @@ That's all. Everything is automatic!
And you can even use entities with composite identifiers!


Issues
------
## Issues

In case of any problems, just leave an issue here on GitHub (or, better, send a pull request).

0 comments on commit c60283d

Please sign in to comment.