BlogPost
extends Entity
in package
implements
JsonSerializable
This class contains the information of a blog post
Tags
Interfaces, Classes, Traits and Enums
- JsonSerializable
Table of Contents
- $categoryId : int|null
- $createdAt : DateTime
- $creatorId : int
- $headerImageId : int|null
- $id : int
- $lastUpdatedAt : DateTime
- $public : bool
- $slug : string
- $title : string
- $updatedById : int
- create() : void
- Creates the current blog post
- findBySlug() : BlogPost|null
- Finds the blog post by the given slug
- findPublicPosts() : Iterator<string|int, BlogPost>
- Finds all public blog posts
- format() : array<string, array<string, array<string, string|null>|int|string>|bool|int|string|null>
- Formats the blog post into an array
- getCategory() : BlogCategory|null
- The category of the post, if the post has no category, null is returned
- getCreator() : Artist|null
- Gets the creator of the blog post
- getHeaderImage() : File|null
- Gets the header image file of the blog post
- getSections() : Iterator<string|int, BlogPostSection>
- Gets all sections of the current post
- getSegments() : Iterator<string|int, BlogPostSection>
- Gets all sections of the current post
- getUpdatedBy() : Artist|null
- Gets the artist that last updated this post
- jsonSerialize() : mixed
- replaceSections() : void
- Replaces all blog post sections with the new sections
- replaceSegments() : void
- Replaces all blog post sections with the new sections
- update() : void
- Updates the current blog post
- executeHook() : void
- Executes the webhook defined in the category
- getDefaultPort() : int
- Returns the default port for the given scheme
Properties
$categoryId
public
int|null
$categoryId
= null
The ID of the category this post belongs to
Tags
$createdAt
public
DateTime
$createdAt
The time the post was created
Tags
$creatorId
public
int
$creatorId
The ID of the artist who created the post
Tags
$headerImageId
public
int|null
$headerImageId
= null
The ID of the file used as header image
Tags
$id
public
int
$id
Tags
$lastUpdatedAt
public
DateTime
$lastUpdatedAt
The time the post was last updated at
Tags
$public
public
bool
$public
= false
Whether the post is publicly available
Tags
$slug
public
string
$slug
The slug of the blog post
Tags
$title
public
string
$title
The title of the blog post
Tags
$updatedById
public
int
$updatedById
The ID of the artist who last touched the post
Tags
Methods
create()
Creates the current blog post
public
create() : void
Tags
Return values
void —findBySlug()
Finds the blog post by the given slug
public
static findBySlug(string $slug) : BlogPost|null
Parameters
- $slug : string
-
The slug to search for
Tags
Return values
BlogPost|null —findPublicPosts()
Finds all public blog posts
public
static findPublicPosts() : Iterator<string|int, BlogPost>
Tags
Return values
Iterator<string|int, BlogPost> —format()
Formats the blog post into an array
public
format() : array<string, array<string, array<string, string|null>|int|string>|bool|int|string|null>
Tags
Return values
array<string, array<string, array<string, string|null>|int|string>|bool|int|string|null> —getCategory()
The category of the post, if the post has no category, null is returned
public
getCategory() : BlogCategory|null
Tags
Return values
BlogCategory|null —getCreator()
Gets the creator of the blog post
public
getCreator() : Artist|null
Tags
Return values
Artist|null —getHeaderImage()
Gets the header image file of the blog post
public
getHeaderImage() : File|null
Tags
Return values
File|null —getSections()
Gets all sections of the current post
public
getSections() : Iterator<string|int, BlogPostSection>
Tags
Return values
Iterator<string|int, BlogPostSection> —getSegments()
Gets all sections of the current post
public
getSegments() : Iterator<string|int, BlogPostSection>
Tags
Return values
Iterator<string|int, BlogPostSection> —getUpdatedBy()
Gets the artist that last updated this post
public
getUpdatedBy() : Artist|null
Tags
Return values
Artist|null —jsonSerialize()
public
jsonSerialize() : mixed
Tags
Return values
mixed —replaceSections()
Replaces all blog post sections with the new sections
public
replaceSections(array<int, array<string, int|string>> $newSections) : void
Parameters
- $newSections : array<int, array<string, int|string>>
-
The new sections
Tags
Return values
void —replaceSegments()
Replaces all blog post sections with the new sections
public
replaceSegments(array<int, array<string, int|string>> $newSections) : void
Parameters
- $newSections : array<int, array<string, int|string>>
-
The new sections
Tags
Return values
void —update()
Updates the current blog post
public
update() : void
Tags
Return values
void —executeHook()
Executes the webhook defined in the category
private
executeHook() : void
Tags
Return values
void —getDefaultPort()
Returns the default port for the given scheme
private
getDefaultPort(string $scheme) : int
Parameters
- $scheme : string
-
The scheme to check for, if the scheme is https the return value is 443 otherwise 80