class RecordCommentService implements RecordCommentEditorInterface (View source)

Reads and writes the comment attached to a record.

On the SQL backend comments are stored per record through a linking table (record_comment_links), so records sharing a name and type can carry different comments. The API backend has no such table: it keeps one comment per RRset and the per-record operations report that they are unsupported.

Methods

__construct(RecordCommentRepositoryInterface $recordCommentRepository, RecordLinkedCommentRepositoryInterface|null $linkedComments = null)

No description

bool
supportsPerRecordComments()

Whether this backend can attach a comment to one record rather than its whole RRset

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, RecordLinkedCommentRepositoryInterface|null $linkedComments = null)

No description

Parameters

RecordCommentRepositoryInterface $recordCommentRepository
RecordLinkedCommentRepositoryInterface|null $linkedComments

Null on a backend without per-record links

bool supportsPerRecordComments()

Whether this backend can attach a comment to one record rather than its whole RRset

Return Value

bool

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

False when the backend has no per-record comments

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