Documentation

CreateSubmissionDTO extends AbstractBaseDto implements DTOInterface

Data Transfer Object for creating submissions in Canvas LMS

This DTO handles the creation of new submissions with all the necessary fields supported by the Canvas Submissions API.

Table of Contents

Interfaces

DTOInterface

Properties

$body  : string|null
Text content for online_text_entry submissions (HTML content)
$comment  : string|null
Comment to include with the submission
$fileIds  : array<string|int, int>|null
Array of file IDs for online_upload submissions
$mediaCommentId  : string|null
Media comment ID for media submissions
$mediaCommentType  : string|null
Media comment type ('audio' or 'video')
$submissionType  : string|null
Submission type (required) Valid values: online_text_entry, online_url, online_upload, media_recording, basic_lti_launch, student_annotation
$url  : string|null
URL for online_url submissions
$userId  : int|null
User ID for the submission (when submitting on behalf of another user)
$apiPropertyName  : string
The API property name for multipart requests

Methods

__construct()  : mixed
BaseDto constructor.
getBody()  : string|null
Get submission body content
getComment()  : string|null
Get comment
getFileIds()  : array<string|int, int>|null
Get file IDs
getMediaCommentId()  : string|null
Get media comment ID
getMediaCommentType()  : string|null
Get media comment type
getSubmissionType()  : string|null
Get submission type
getUrl()  : string|null
Get submission URL
getUserId()  : int|null
Get user ID
setBody()  : void
Set submission body content Sanitizes HTML to prevent XSS attacks
setComment()  : void
Set comment
setFileIds()  : void
Set file IDs
setMediaCommentId()  : void
Set media comment ID
setMediaCommentType()  : void
Set media comment type
setSubmissionType()  : void
Set submission type
setUrl()  : void
Set submission URL
setUserId()  : void
Set user ID
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

$body

Text content for online_text_entry submissions (HTML content)

public string|null $body = null

$fileIds

Array of file IDs for online_upload submissions

public array<string|int, int>|null $fileIds = null

$mediaCommentId

Media comment ID for media submissions

public string|null $mediaCommentId = null

$mediaCommentType

Media comment type ('audio' or 'video')

public string|null $mediaCommentType = null

$submissionType

Submission type (required) Valid values: online_text_entry, online_url, online_upload, media_recording, basic_lti_launch, student_annotation

public string|null $submissionType = null

$userId

User ID for the submission (when submitting on behalf of another user)

public int|null $userId = null

$apiPropertyName

The API property name for multipart requests

protected string $apiPropertyName = 'submission'

Methods

__construct()

BaseDto constructor.

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

getBody()

Get submission body content

public getBody() : string|null
Return values
string|null

getComment()

Get comment

public getComment() : string|null
Return values
string|null

getFileIds()

Get file IDs

public getFileIds() : array<string|int, int>|null
Return values
array<string|int, int>|null

getMediaCommentId()

Get media comment ID

public getMediaCommentId() : string|null
Return values
string|null

getMediaCommentType()

Get media comment type

public getMediaCommentType() : string|null
Return values
string|null

getSubmissionType()

Get submission type

public getSubmissionType() : string|null
Return values
string|null

getUrl()

Get submission URL

public getUrl() : string|null
Return values
string|null

setBody()

Set submission body content Sanitizes HTML to prevent XSS attacks

public setBody(string|null $body) : void
Parameters
$body : string|null

setComment()

Set comment

public setComment(string|null $comment) : void
Parameters
$comment : string|null

setFileIds()

Set file IDs

public setFileIds(array<string|int, int>|null $fileIds) : void
Parameters
$fileIds : array<string|int, int>|null
Tags
throws
InvalidArgumentException

setMediaCommentId()

Set media comment ID

public setMediaCommentId(string|null $mediaCommentId) : void
Parameters
$mediaCommentId : string|null

setMediaCommentType()

Set media comment type

public setMediaCommentType(string|null $mediaCommentType) : void
Parameters
$mediaCommentType : string|null

setSubmissionType()

Set submission type

public setSubmissionType(string|null $submissionType) : void
Parameters
$submissionType : string|null
Tags
throws
InvalidArgumentException

setUrl()

Set submission URL

public setUrl(string|null $url) : void
Parameters
$url : string|null
Tags
throws
InvalidArgumentException

setUserId()

Set user ID

public setUserId(int|null $userId) : void
Parameters
$userId : int|null

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