Documentation

CreateModuleDTO extends AbstractBaseDto
in package
implements DTOInterface

Abstract base class for Data Transfer Objects (DTOs).

Provides common functionality for all DTO classes including data population, array transformation for Canvas API multipart format, and date/time handling. DTOs are used to format and validate data before sending to the Canvas API.

Table of Contents

Interfaces

DTOInterface

Properties

$name  : string
$position  : int
$prerequisiteModuleIds  : array<string|int, mixed>
$publishFinalGrade  : bool
$requireSequentialProgress  : bool
$unlockAt  : DateTimeInterface|null
$apiPropertyName  : string
The name of the property in the API

Methods

__construct()  : mixed
BaseDto constructor.
toApiArray()  : array<string|int, mixed>
Convert the DTO to an array for API requests
toArray()  : array<string|int, mixed>
Convert the DTO to an array

Properties

$position

public int $position

The position of this module in the course (1-based)

$prerequisiteModuleIds

public array<string|int, mixed> $prerequisiteModuleIds

IDs of Modules that must be completed before this one is unlocked. Prerequisite modules must precede this module (i.e. have a lower position value), otherwise they will be ignored

$publishFinalGrade

public bool $publishFinalGrade

Whether to publish the student’s final grade for the course upon completion of this module.

$requireSequentialProgress

public bool $requireSequentialProgress

Whether module items must be unlocked in order

$unlockAt

public DateTimeInterface|null $unlockAt

The date the module will unlock

$apiPropertyName

The name of the property in the API

protected string $apiPropertyName = 'module'

Methods

__construct()

BaseDto constructor.

public __construct(array<string|int, mixed> $data) : mixed
Parameters
$data : array<string|int, mixed>
Tags
throws
Exception

toApiArray()

Convert the DTO to an array for API requests

public toApiArray() : array<string|int, mixed>
Return values
array<string|int, mixed>

toArray()

Convert the DTO to an array

public toArray() : array<string|int, mixed>
Return values
array<string|int, mixed>

        
On this page

Search results