Documentation

RecordManager implements RecordStorageInterface

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

Tags
author

Amélie DUVERNET aka Amelaye amelieonline@gmail.com

Table of Contents

Interfaces

RecordStorageInterface
Interface RecordStorageInterface

Constants

BATCH_SIZE  : mixed = 100
Records written between two flushes while a file is stored.

Properties

$em  : EntityManagerInterface
$sPath  : string

Methods

__construct()  : mixed
RecordManager constructor.
find()  : ParsedRecord|null
store()  : 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.
storeFile()  : int
Parses every record of one or several data files and stores them in a collection.
upsert()  : ParsedRecord
Parses a record and writes it, or rewrites the one already stored under the same identifier.

Constants

BATCH_SIZE

Records written between two flushes while a file is stored.

private mixed BATCH_SIZE = 100

Properties

Methods

__construct()

RecordManager constructor.

public __construct(EntityManagerInterface $em, string $sPath) : mixed
Parameters
$em : EntityManagerInterface

Entity Manager, for Doctrine

$sPath : string

Path to the data

find()

public find(string $sDbFormat, string $sEntryId) : ParsedRecord|null
Parameters
$sDbFormat : string

Database format, e.g. "GENBANK"

$sEntryId : string

Identifier of the record

Return values
ParsedRecord|null

store()

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.

public store(string $sDbFormat, array<string|int, mixed> $aLines[, Collection|null $oCollection = null ]) : ParsedRecord
Parameters
$sDbFormat : string

Database format, e.g. "GENBANK"

$aLines : array<string|int, mixed>

The lines of the record

$oCollection : Collection|null = null

The collection the record belongs to

Return values
ParsedRecord

storeFile()

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

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

Name of the collection, created when it does not exist

$sDbFormat : string

Database format, e.g. "GENBANK"

$aDataFiles : string

Files to parse

Return values
int —

Number of records stored

upsert()

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

private upsert(array<string|int, mixed> &$aPending, string $sDbFormat, string $sEntryId, array<string|int, mixed> $aLines, Collection|null $oCollection) : ParsedRecord
Parameters
$aPending : array<string|int, mixed>

Records persisted but not flushed yet, by format and identifier

$sDbFormat : string
$sEntryId : string
$aLines : array<string|int, mixed>
$oCollection : Collection|null
Tags
throws
Exception
Return values
ParsedRecord
On this page

Search results