class DbRecordCommentRepository implements RecordCommentRepositoryInterface (View source)

Methods

__construct(PDO $connection, ConfigurationManager $config, DnsBackendProvider|null $backendProvider = null)

No description

add(RecordComment $comment)

Add a new comment to the database.

bool
delete(int $domainId, string $name, string $type)

Delete all comments for an RRset (domain_id, name, type).

bool
deleteLegacyComment(int $domainId, string $name, string $type)

Delete only legacy RRset comments (no per-record links).

void
deleteByDomainId(int $domainId)

Delete all comments for a domain.

find(int $domainId, string $name, string $type)

Find a comment by RRset (domain_id, name, type).

update(int $domainId, string $oldName, string $oldType, RecordComment $comment)

Update an existing comment or create a new one.

findByRecordId(int|string $recordId)

Find a comment linked to a specific record ID.

bool
deleteByRecordId(int|string $recordId)

Delete the comment linked to a specific record ID.

bool
linkRecordToComment(int|string $recordId, int $commentId)

Link a record to a comment.

bool
unlinkRecord(int|string $recordId)

Unlink a record from its comment.

addForRecord(int|string $recordId, RecordComment $comment)

Add a comment for a specific record.

bool
migrateLegacyComments(int $domainId, string $name, string $type, int|string $excludeRecordId)

Migrate legacy RRset comments to per-record links for all records in the RRset that don't have linked comments yet.

Details

__construct(PDO $connection, ConfigurationManager $config, DnsBackendProvider|null $backendProvider = null)

No description

Parameters

PDO $connection
ConfigurationManager $config
DnsBackendProvider|null $backendProvider

RecordComment add(RecordComment $comment)

Add a new comment to the database.

Parameters

RecordComment $comment

The comment to add

Return Value

RecordComment

The added comment with ID

bool delete(int $domainId, string $name, string $type)

Delete all comments for an RRset (domain_id, name, type).

Parameters

int $domainId

Domain ID

string $name

Record name

string $type

Record type

Return Value

bool

bool deleteLegacyComment(int $domainId, string $name, string $type)

Delete only legacy RRset comments (no per-record links).

Parameters

int $domainId

Domain ID

string $name

Record name

string $type

Record type

Return Value

bool

void deleteByDomainId(int $domainId)

Delete all comments for a domain.

Parameters

int $domainId

Domain ID

Return Value

void

RecordComment|null find(int $domainId, string $name, string $type)

Find a comment by RRset (domain_id, name, type).

Returns the first matching comment.

Parameters

int $domainId

Domain ID

string $name

Record name

string $type

Record type

Return Value

RecordComment|null

RecordComment|null update(int $domainId, string $oldName, string $oldType, RecordComment $comment)

Update an existing comment or create a new one.

Parameters

int $domainId

Domain ID

string $oldName

Previous record name

string $oldType

Previous record type

RecordComment $comment

The updated comment

Return Value

RecordComment|null

RecordComment|null findByRecordId(int|string $recordId)

Find a comment linked to a specific record ID.

Parameters

int|string $recordId

The record ID

Return Value

RecordComment|null

bool deleteByRecordId(int|string $recordId)

Delete the comment linked to a specific record ID.

Parameters

int|string $recordId

The record ID

Return Value

bool

bool linkRecordToComment(int|string $recordId, int $commentId)

Link a record to a comment.

Parameters

int|string $recordId

The record ID

int $commentId

The comment ID

Return Value

bool

bool unlinkRecord(int|string $recordId)

Unlink a record from its comment.

Parameters

int|string $recordId

The record ID

Return Value

bool

RecordComment|null addForRecord(int|string $recordId, RecordComment $comment)

Add a comment for a specific record.

Creates the comment and links it to the record.

Parameters

int|string $recordId

The record ID

RecordComment $comment

The comment to add

Return Value

RecordComment|null

The added comment with ID, or null on failure

bool migrateLegacyComments(int $domainId, string $name, string $type, int|string $excludeRecordId)

Migrate legacy RRset comments to per-record links for all records in the RRset that don't have linked comments yet.

This prevents data loss when clearing a comment for one record.

Parameters

int $domainId

Domain ID

string $name

Record name

string $type

Record type

int|string $excludeRecordId

Record ID to exclude (int for SQL, encoded string for API)

Return Value

bool

True if siblings were actually migrated, false if skipped