2017 © Pedro Peláez
 

nette-addon nette-identity-doctrine

Integration of entities implementing IIdentity in Nette 2

image

majkl578/nette-identity-doctrine

Integration of entities implementing IIdentity in Nette 2

  • Friday, November 27, 2015
  • by Majkl578
  • Repository
  • 6 Watchers
  • 25 Stars
  • 60,547 Installations
  • PHP
  • 4 Dependents
  • 0 Suggesters
  • 12 Forks
  • 6 Open issues
  • 10 Versions
  • 5 % Grown

The README.md

Nette 2 & Doctrine 2 entities

Nette addon for using Doctrine 2 entities directly as Nette identity, (*1)

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., (*2)

Fortunately, this addon is here to help you with this task!, (*3)

Requirements

  • PHP 5.3.2+
  • Nette 2.2+
  • Doctrine ORM 2.3+

Installation

  1. Install via composer:, (*4)

    composer require majkl578/nette-identity-doctrine, (*5)

  2. Register extension in your configuration file in extensions section:, (*6)

    extensions:
        doctrine2identity: Majkl578\NetteAddons\Doctrine2Identity\DI\IdentityExtension
    
  3. Delete cache., (*7)

You're done. ;), (*8)

Usage

Imagine you have an application where you're implementing authentication. All you have is a regular entity for the user in your application. Now you want to implement the authentication itself - you need to have an identity. The only thing you have to do is to implement Nette\Security\IIdentity on your user entity, so you get something like this:, (*9)

use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\Entity
 */
class UserEntity implements IIdentity
{
    /** @ORM\Column(type="integer") @ORM\Id @ORM\GeneratedValue */
    private $id;

    /** @ORM\Column */
    private $name;

    ... other properties, getters & setters

    /* implementation of IIdentity */
    public function getId()
    {
        return $this->id;
    }

    public function getRoles()
    {
        return array();
    }
}

(Notice the empty getRoles() method. That is due to the requirement of IIdentity. If you don't use authorization, unfortunately, it can't be omitted, sorry.), (*10)

That's all. Everything is automatic! And you can even use entities with composite identifiers!, (*11)

Issues

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

The Versions

27/11 2015

dev-master

9999999-dev

Integration of entities implementing IIdentity in Nette 2

  Sources   Download

MIT

The Requires

 

The Development Requires

by Michael Moravec

orm authentication security doctrine nette identity

27/11 2015

v2.3-rc1

2.3.0.0-RC1

Integration of entities implementing IIdentity in Nette 2

  Sources   Download

MIT

The Requires

 

The Development Requires

by Michael Moravec

orm authentication security doctrine nette identity

25/11 2015

dev-nette-packages

dev-nette-packages

Integration of entities implementing IIdentity in Nette 2

  Sources   Download

MIT

The Requires

 

The Development Requires

by Michael Moravec

orm authentication security doctrine nette identity

12/07 2015

v2.2

2.2.0.0

Integration of entities implementing IIdentity in Nette 2

  Sources   Download

MIT

The Requires

 

The Development Requires

by Michael Moravec

orm authentication security doctrine nette identity

16/05 2014

dev-feature/storage-delegated

dev-feature/storage-delegated

Integration of entities implementing IIdentity in Nette 2

  Sources   Download

MIT

The Requires

 

by Michael Moravec

orm authentication security doctrine nette identity

09/12 2013

2.1

2.1.0.0

Integration of entities implementing IIdentity in Nette 2

  Sources   Download

MIT

The Requires

 

by Michael Moravec

orm authentication security doctrine nette identity

28/11 2013

2.0

2.0.0.0

Integration of entities implementing IIdentity in Nette 2

  Sources   Download

MIT

The Requires

 

by Michael Moravec

orm authentication security doctrine nette identity

11/09 2013

1.2

1.2.0.0

Integration of entities implementing IIdentity in Nette 2

  Sources   Download

MIT

The Requires

 

by Michael Moravec

security doctrine nette identity

01/03 2013

1.1

1.1.0.0

Integration of entities implementing IIdentity in Nette 2

  Sources   Download

MIT

The Requires

 

by Michael Moravec

security doctrine nette identity

01/03 2013

1.0

1.0.0.0

Integration of entities implementing IIdentity in Nette 2

  Sources   Download

MIT

The Requires

 

by Michael Moravec

security doctrine nette identity