# KnowledgeBaseRepository

Implements \NPS\Repository\IObjectRepository

Knowledge base repository

author | Lukas Korinek
package | Default

### Methods

## __construct

    __construct(\Doctrine\ORM\EntityManagerInterface $em, \NPS\Factory\KnowledgeBaseFactory $factory)

### Arguments

#### $em

`\Doctrine\ORM\EntityManagerInterface`

#### $factory

`\NPS\Factory\KnowledgeBaseFactory`

## Clears the cache of this repository

    clearCache()

## Gets all available bases

    getAll() : array

### Response

`array`

## Gets a bind id by a knowledge base name

    getBindIdByName(string $name) : integer

### Arguments

#### $name

`string`

### Response

`integer`

## Gets knowledge bases by their name

    getByBindId(integer $bindId) : array

### Arguments

#### $bindId

`integer`

### Response

`array`

## Gets an object by its id

    getById(integer $id) : mixed

inheritDoc |

### Arguments

#### $id

`integer`

### Response

`mixed`

## Gets a knowledge base by its path

    getByPath(string $path) : \NPS\Repository\KnowledgeBase|null

### Arguments

#### $path

`string`

### Response

`\NPS\Repository\KnowledgeBase|null`

## Gets a knowledge base by a name and version

    getKnowledgeBaseByNameAndVersion(string $name, \DateTime|null $version) : \NPS\Repository\KnowledgeBase|null

### Arguments

#### $name

`string`

#### $version

`\DateTime|null`

### Response

`\NPS\Repository\KnowledgeBase|null`

## Gets knowledge bases by their name

    getKnowledgeBasesByName(string $name) : array

### Arguments

#### $name

`string`

### Response

`array`

## Gets a knowledge base bind id for a new knowledge base

    getNewKnowledgeBaseBindId() : integer

### Response

`integer`

## Loads existing knowledge bases from either database

    loadCache()

## Validates an int to be a valid existing knowledge base bind id

    validateBindId(integer $bindId) : boolean

### Arguments

#### $bindId

`integer`

### Response

`boolean`

### Properties

## em

    em : \Doctrine\ORM\EntityManagerInterface

var |

### Type(s)

`\Doctrine\ORM\EntityManagerInterface`

## Contains cached bases

    bases : array

var | Contains cached bases

### Type(s)

`array`

## factory

    factory : \NPS\Factory\KnowledgeBaseFactory

var |

### Type(s)

`\NPS\Factory\KnowledgeBaseFactory`