# UserFactory

Implements \NPS\Factory\IObjectFactory

User object factory

author | Lukas Korinek
package | Default

### Methods

## __construct

    __construct(\Doctrine\ORM\EntityManagerInterface $em, \Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface $encoder)

### Arguments

#### $em

`\Doctrine\ORM\EntityManagerInterface`

#### $encoder

`\Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface`

## Creates a new user

    create(string $email, string $username, string $password, array $roles) : \NPS\Model\User|null

### Arguments

#### $email

`string`

#### $username

`string`

#### $password

`string`

#### $roles

`array`

### Response

`\NPS\Model\User|null`

## 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`

### Properties

## em

    em : \Doctrine\ORM\EntityManagerInterface

var |

### Type(s)

`\Doctrine\ORM\EntityManagerInterface`

## encoder

    encoder : \Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface

var |

### Type(s)

`\Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface`

## memory

    memory : array

inherited

var |

### Type(s)

`array`