class RecordCommentService (View source)

Service for managing DNS record comments.

Comments are stored per-record using a linking table (record_comment_links) that associates individual record IDs with comment IDs in the PowerDNS comments table. This allows different records with the same name and type to have different comments.

Methods

__construct(RecordCommentRepositoryInterface $recordCommentRepository)

No description

createCommentForRecord(int $domainId, string $name, string $type, string $comment, int|string $recordId, string|null $account = null)

Create a comment for a specific record.

createComment(int $domainId, string $name, string $type, string $comment, string|null $account = null)

Create a comment for an RRset (legacy method).

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

Delete all comments for an RRset.

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

Delete legacy RRset comments that have no per-record links.

bool
deleteCommentByRecordId(int|string $recordId)

Delete comment for a specific record.

void
deleteCommentsByDomainId(int $domainId)

Delete all comments for a domain.

updateCommentForRecord(int $domainId, string $name, string $type, string $comment, int|string $recordId, string|null $account = null)

Update a comment for a specific record.

updateComment(int $domainId, string $oldName, string $oldType, string $newName, string $newType, string $comment, string|null $account = null)

Update a comment for an RRset when name/type changes (legacy method).

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

Find a comment for an RRset.

findCommentByRecordId(int|string $recordId)

Find a comment for a specific record.

Details

__construct(RecordCommentRepositoryInterface $recordCommentRepository)

No description

Parameters

RecordCommentRepositoryInterface $recordCommentRepository

RecordComment|null createCommentForRecord(int $domainId, string $name, string $type, string $comment, int|string $recordId, string|null $account = null)

Create a comment for a specific record.

Uses the linking table for per-record comment storage.

Parameters

int $domainId

Domain/zone ID

string $name

Record name

string $type

Record type

string $comment

Comment text

int|string $recordId

Record ID for per-record comment linking

string|null $account

Optional account/username

Return Value

RecordComment|null

RecordComment|null createComment(int $domainId, string $name, string $type, string $comment, string|null $account = null)

Create a comment for an RRset (legacy method).

This does NOT use the linking table - use createCommentForRecord() for per-record comments.

Parameters

int $domainId

Domain/zone ID

string $name

Record name

string $type

Record type

string $comment

Comment text

string|null $account

Optional account/username

Return Value

RecordComment|null

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

Delete all comments for an RRset.

Also removes any links pointing to those comments.

Parameters

int $domainId

Domain/zone ID

string $name

Record name

string $type

Record type

Return Value

bool

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

Delete legacy RRset comments that have no per-record links.

Parameters

int $domainId

Domain/zone ID

string $name

Record name

string $type

Record type

Return Value

bool

bool deleteCommentByRecordId(int|string $recordId)

Delete comment for a specific record.

Removes the link and the associated comment.

Parameters

int|string $recordId

Record ID

Return Value

bool

void deleteCommentsByDomainId(int $domainId)

Delete all comments for a domain.

Parameters

int $domainId

Domain/zone ID

Return Value

void

RecordComment|null updateCommentForRecord(int $domainId, string $name, string $type, string $comment, int|string $recordId, string|null $account = null)

Update a comment for a specific record.

Uses the linking table for per-record comment storage.

Parameters

int $domainId

Domain/zone ID

string $name

Record name

string $type

Record type

string $comment

Comment text

int|string $recordId

Record ID for per-record comment linking

string|null $account

Optional account/username

Return Value

RecordComment|null

RecordComment|null updateComment(int $domainId, string $oldName, string $oldType, string $newName, string $newType, string $comment, string|null $account = null)

Update a comment for an RRset when name/type changes (legacy method).

Parameters

int $domainId

Domain/zone ID

string $oldName

Previous record name

string $oldType

Previous record type

string $newName

New record name

string $newType

New record type

string $comment

Comment text

string|null $account

Optional account/username

Return Value

RecordComment|null

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

Find a comment for an RRset.

Parameters

int $domainId

Domain/zone ID

string $name

Record name

string $type

Record type

Return Value

RecordComment|null

RecordComment|null findCommentByRecordId(int|string $recordId)

Find a comment for a specific record.

Parameters

int|string $recordId

Record ID

Return Value

RecordComment|null