\Amelaye\BioPHP\Domain\Database\Service RecordManager

Class RecordManager Stores what any of the registered parsers read, whatever its format, as ParsedRecord documents.

Summary

Methods
Properties
Constants
__construct
store
storeFile
find
No public properties found
No public constants found
No protected methods found
em
sPath
No protected constants found
upsert
No private properties found
BATCH_SIZE

Constant

BATCH_SIZE

BATCH_SIZE = 100

Records written between two flushes while a file is stored.

Properties

$em

$em : \Doctrine\ORM\EntityManagerInterface

Type

EntityManagerInterface

$sPath

$sPath : string

Type

string —

Methods

__construct()

__construct(\Doctrine\ORM\EntityManagerInterface  $em, string  $sPath) : mixed

RecordManager constructor.

Parameters

\Doctrine\ORM\EntityManagerInterface $em

Entity Manager, for Doctrine

string $sPath

Path to the data

Returns

mixed —

store()

store(string  $sDbFormat, array  $aLines, ?\Amelaye\BioPHP\Domain\Database\Entity\Collection  $oCollection = null) : \Amelaye\BioPHP\Domain\Database\Entity\ParsedRecord

Parses the lines of one record and stores what was read. A record already stored under the same format and identifier is updated rather than duplicated.

Parameters

string $sDbFormat

Database format, e.g. "GENBANK"

array $aLines

The lines of the record

?\Amelaye\BioPHP\Domain\Database\Entity\Collection $oCollection

The collection the record belongs to

Returns

\Amelaye\BioPHP\Domain\Database\Entity\ParsedRecord —

storeFile()

storeFile(string  $sDbName, string  $sDbFormat, string  ...$aDataFiles) : int

Parses every record of one or several data files and stores them in a collection.

Parameters

string $sDbName

Name of the collection, created when it does not exist

string $sDbFormat

Database format, e.g. "GENBANK"

string $aDataFiles variadic

Files to parse

Returns

int —

Number of records stored

find()

find(string  $sDbFormat, string  $sEntryId) : \Amelaye\BioPHP\Domain\Database\Entity\ParsedRecord|null

Parameters

string $sDbFormat

Database format, e.g. "GENBANK"

string $sEntryId

Identifier of the record

Returns

\Amelaye\BioPHP\Domain\Database\Entity\ParsedRecord|null —

upsert()

upsert(array  $aPending, string  $sDbFormat, string  $sEntryId, array  $aLines, \Amelaye\BioPHP\Domain\Database\Entity\Collection|null  $oCollection) : \Amelaye\BioPHP\Domain\Database\Entity\ParsedRecord

Parses a record and writes it, or rewrites the one already stored under the same identifier.

Parameters

array $aPending

Records persisted but not flushed yet, by format and identifier

string $sDbFormat
string $sEntryId
array $aLines
\Amelaye\BioPHP\Domain\Database\Entity\Collection|null $oCollection

Throws

\Exception

Returns

\Amelaye\BioPHP\Domain\Database\Entity\ParsedRecord —