# TokenFactory

Implements \NPS\Factory\IObjectFactory

Token object factory

author | Lukas Korinek
package | Default

### Methods

## __construct

    __construct(\Doctrine\ORM\EntityManagerInterface $em, \NPS\Factory\UserFactory $userFactory, \NPS\DependencyInjection\Mailer $mailer, integer $tokenTTL)

### Arguments

#### $em

`\Doctrine\ORM\EntityManagerInterface`

#### $userFactory

`\NPS\Factory\UserFactory`

#### $mailer

`\NPS\DependencyInjection\Mailer`

#### $tokenTTL

`integer`

Time of token life in seconds

## Creates a new token

    create(string $type, string $backlink, \NPS\Model\User $user) : \NPS\Model\AbstractToken

### Arguments

#### $type

`string`

Target token type, refer to constants in this class

#### $backlink

`string`

Backlink to the token verification URL

#### $user

`\NPS\Model\User`

### Response

`\NPS\Model\AbstractToken`

## Loads a factored object from the memory

    load(mixed $entity, \Closure $callback) : mixed

inherited

### Arguments

#### $entity

`mixed`

Entity for which to load the object

#### $callback

`\Closure`

### Response

`mixed`

## Creates an object out of its doctrine entity

    make(\NPS\Entity\IEntity $entity) : \NPS\Model\IDomainObject

inheritDoc |

### Arguments

#### $entity

`\NPS\Entity\IEntity`

Entity object

### Response

`\NPS\Model\IDomainObject`

### Constants

## TOKEN_PASSWORD_RESET

    TOKEN_PASSWORD_RESET

## TOKEN_USER_ACTIVATION

    TOKEN_USER_ACTIVATION

### Properties

## em

    em : \Doctrine\ORM\EntityManagerInterface

var |

### Type(s)

`\Doctrine\ORM\EntityManagerInterface`

## userFactory

    userFactory : \NPS\Factory\UserFactory

var |

### Type(s)

`\NPS\Factory\UserFactory`

## mailer

    mailer : \NPS\DependencyInjection\Mailer

var |

### Type(s)

`\NPS\DependencyInjection\Mailer`

## tokenTTL

    tokenTTL : integer

var |

### Type(s)

`integer`

## memory

    memory : array

inherited

var |

### Type(s)

`array`