class DbZoneTemplateRepository (View source)

Methods

__construct(object $db, ConfigurationInterface $config)

No description

array
listZoneTemplates(int|null $userId, bool $isUeberuser)

List zone templates visible to the given user

array|false
getZoneTemplateDetails(int $id)

Get zone template details by ID

array
getZoneTemplateRecords(int $templateId)

Get all records for a zone template

array
getZoneTemplateRecordById(int $id)

Get a single zone template record by ID

int
countZoneTemplateRecords(int $templateId)

Count records in a zone template

int
createZoneTemplate(string $name, string $description, int $owner, int $createdBy)

Create a new zone template with a default SOA record

bool
updateZoneTemplate(int $id, string $name, string $description, int|null $owner = null)

Update a zone template

bool
deleteZoneTemplate(int $id)

Delete a zone template and all related records

void
deleteZoneTemplatesOwnedBy(int $ownerId)

Deletes every template the user owns, with its records and zone links.

int
addRecord(int $templateId, string $name, string $type, string $content, int $ttl, int $prio)

Add a record to a zone template

bool
updateRecord(int $id, string $name, string $type, string $content, int $ttl, int $prio)

Update a zone template record

bool
deleteRecord(int $id)

Delete a zone template record

bool
zoneTemplateExists(int $id)

Check if a zone template exists

bool
zoneTemplateNameExists(string $name, int|null $excludeId = null)

Check if a zone template name already exists

bool
isOwner(int $templateId, int $userId)

Check if user is the owner of a zone template

int|null
getOwner(int $templateId)

Get the owner ID of a zone template

Details

__construct(object $db, ConfigurationInterface $config)

No description

Parameters

object $db
ConfigurationInterface $config

array listZoneTemplates(int|null $userId, bool $isUeberuser)

List zone templates visible to the given user

Parameters

int|null $userId

User ID (null for all)

bool $isUeberuser

Whether user is an ueberuser

Return Value

array

List of zone templates

array|false getZoneTemplateDetails(int $id)

Get zone template details by ID

Parameters

int $id

Zone template ID

Return Value

array|false

Template details or false if not found

array getZoneTemplateRecords(int $templateId)

Get all records for a zone template

Parameters

int $templateId

Zone template ID

Return Value

array

Template records

array getZoneTemplateRecordById(int $id)

Get a single zone template record by ID

Parameters

int $id

Record ID

Return Value

array

Record details or empty array

int countZoneTemplateRecords(int $templateId)

Count records in a zone template

Parameters

int $templateId

Zone template ID

Return Value

int

Number of records

int createZoneTemplate(string $name, string $description, int $owner, int $createdBy)

Create a new zone template with a default SOA record

Parameters

string $name

Template name

string $description

Template description

int $owner

Owner user ID (0 for global)

int $createdBy

Creator user ID

Return Value

int

New template ID

Exceptions

Exception

bool updateZoneTemplate(int $id, string $name, string $description, int|null $owner = null)

Update a zone template

Parameters

int $id

Template ID

string $name

New name

string $description

New description

int|null $owner

New owner (null to keep current)

Return Value

bool

True on success

bool deleteZoneTemplate(int $id)

Delete a zone template and all related records

Parameters

int $id

Template ID

Return Value

bool

True on success

Exceptions

Exception

void deleteZoneTemplatesOwnedBy(int $ownerId)

Deletes every template the user owns, with its records and zone links.

Runs inside the caller's transaction (used by user deletion).

Parameters

int $ownerId

Return Value

void

int addRecord(int $templateId, string $name, string $type, string $content, int $ttl, int $prio)

Add a record to a zone template

Parameters

int $templateId

Template ID

string $name

Record name

string $type

Record type

string $content

Record content

int $ttl TTL
int $prio Priority

Return Value

int

New record ID

bool updateRecord(int $id, string $name, string $type, string $content, int $ttl, int $prio)

Update a zone template record

Parameters

int $id

Record ID

string $name

Record name

string $type

Record type

string $content

Record content

int $ttl TTL
int $prio Priority

Return Value

bool

True on success

bool deleteRecord(int $id)

Delete a zone template record

Parameters

int $id

Record ID

Return Value

bool

True on success

bool zoneTemplateExists(int $id)

Check if a zone template exists

Parameters

int $id

Template ID

Return Value

bool

True if exists

bool zoneTemplateNameExists(string $name, int|null $excludeId = null)

Check if a zone template name already exists

Parameters

string $name

Template name

int|null $excludeId

Exclude this template ID from the check (for updates)

Return Value

bool

True if name exists

bool isOwner(int $templateId, int $userId)

Check if user is the owner of a zone template

Parameters

int $templateId

Template ID

int $userId

User ID

Return Value

bool

True if user is owner

int|null getOwner(int $templateId)

Get the owner ID of a zone template

Parameters

int $templateId

Template ID

Return Value

int|null

Owner ID or null if not found