# KnowledgeBaseFactory

Implements \NPS\Factory\IObjectFactory

Knowledge base object factory

author | Lukas Korinek
package | Default

### Methods

## __construct

    __construct(\Doctrine\ORM\EntityManagerInterface $em, \NPS\DependencyInjection\IKnowledgeBaseInfoProvider $provider, string $basesPath)

### Arguments

#### $em

`\Doctrine\ORM\EntityManagerInterface`

#### $provider

`\NPS\DependencyInjection\IKnowledgeBaseInfoProvider`

#### $basesPath

`string`

Path to the knowledge bases directory

## Creates a new Knowledge base

    create(string $name, string $content, integer $bindId, \DateTime $version = null) : \NPS\Model\KnowledgeBase|null

### Arguments

#### $name

`string`

#### $content

`string`

#### $bindId

`integer`

#### $version

`\DateTime`

### Response

`\NPS\Model\KnowledgeBase|null`

## Gets the directory in which knowledge bases are stored

    getKnowledgeBasesDirectory() : string

### Response

`string`

without trailing slash

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

## Creates a normalized path to a knowledge base based on its name and version date

    normalizeKnowledgeBasePath(string $name, \NPS\Factory\DateTime $version = null) : string

### Arguments

#### $name

`string`

#### $version

`\NPS\Factory\DateTime`

### Response

`string`

### Properties

## provider

    provider : \NPS\DependencyInjection\IKnowledgeBaseInfoProvider

var |

### Type(s)

`\NPS\DependencyInjection\IKnowledgeBaseInfoProvider`

## em

    em : \Doctrine\ORM\EntityManagerInterface

var |

### Type(s)

`\Doctrine\ORM\EntityManagerInterface`

## Path to the source knowledge base directory

    path : string

var | Path to the source knowledge base directory

### Type(s)

`string`

## memory

    memory : array

inherited

var |

### Type(s)

`array`