class News extends UrlModel implements NamedModel

A news article

Constants

TABLE

The name of the database table used for queries

CREATE_PERMISSION

EDIT_PERMISSION

SOFT_DELETE_PERMISSION

HARD_DELETE_PERMISSION

Methods

getAuthor()

Get the author of the news article

int
getAuthorID()

Get the user ID of the author who wrote this article

getCategory()

Get the category of the news article

int
getCategoryID()

Get the database ID from the category the article belongs into

string
getContent()

Get the content of the article

getCreated()

Get the time when the article was submitted

getLastEdit()

Get the time when the article was last updated

getLastEditor()

Get the last editor of the post

int
getLastEditorID()

Get the ID of the person who last edited the article

string
getSubject()

Get the subject of the news article

string
getName()

Get the name of the entity

static string
getParamName()

Get the name of the object's parameter in the route

static string
getRouteName(string $action = 'show')

Get the name of the route that shows the object

updateContent(string $content)

Update the content of a post

updateEditTimestamp()

Update the last edit timestamp

updateLastEditor(int $editorID)

Update the editor of the post

updateCategory(int $categoryID)

Update the category of the post

updateStatus(string $status = 'published')

Update the status of a post

updateSubject(string $subject)

Update the subject of a post

static string[]
getActiveStatuses()

Get the possible statuses representing an active model (visible to everyone)

static News
addNews(string $subject, string $content, int $authorID, int $categoryId = 1, string $status = 'published')

Add a new news article

static News[]
getNews(int $start, int $limit = 5, bool $getDrafts = false)

Get all the news entries in the database that aren't disabled or deleted

static QueryBuilder
getQueryBuilder()

Get a query builder for news

Details

at line line 92
Player getAuthor()

Get the author of the news article

Return Value

Player The author of the post

at line line 101
int getAuthorID()

Get the user ID of the author who wrote this article

Return Value

int The author ID

at line line 110
NewsCategory getCategory()

Get the category of the news article

Return Value

NewsCategory The category of the post

at line line 119
int getCategoryID()

Get the database ID from the category the article belongs into

Return Value

int The category ID

at line line 128
string getContent()

Get the content of the article

Return Value

string The raw content of the article

at line line 138
TimeDate getCreated()

Get the time when the article was submitted

Return Value

TimeDate The article's creation time

at line line 148
TimeDate getLastEdit()

Get the time when the article was last updated

Return Value

TimeDate The article's last update time

at line line 157
Player getLastEditor()

Get the last editor of the post

Return Value

Player A Player object of the last editor

at line line 166
int getLastEditorID()

Get the ID of the person who last edited the article

Return Value

int The ID of the last editor

at line line 175
string getSubject()

Get the subject of the news article

Return Value

string

at line line 183
string getName()

Get the name of the entity

Return Value

string

at line line 191
static string getParamName()

Get the name of the object's parameter in the route

Return Value

string

at line line 199
static string getRouteName(string $action = 'show')

Get the name of the route that shows the object

Parameters

string $action The route's suffix

Return Value

string

at line line 211
News updateContent(string $content)

Update the content of a post

Parameters

string $content The new content of the post

Return Value

News

at line line 220
News updateEditTimestamp()

Update the last edit timestamp

Return Value

News

at line line 231
News updateLastEditor(int $editorID)

Update the editor of the post

Parameters

int $editorID The ID of the editor

Return Value

News

at line line 242
News updateCategory(int $categoryID)

Update the category of the post

Parameters

int $categoryID The ID of the category

Return Value

News

at line line 253
News updateStatus(string $status = 'published')

Update the status of a post

Parameters

string $status The new status of a post

Return Value

News

at line line 264
News updateSubject(string $subject)

Update the subject of a post

Parameters

string $subject The new subject of a post

Return Value

News

at line line 272
static string[] getActiveStatuses()

Get the possible statuses representing an active model (visible to everyone)

Return Value

string[]

at line line 288
static News addNews(string $subject, string $content, int $authorID, int $categoryId = 1, string $status = 'published')

Add a new news article

Parameters

string $subject The subject of the article
string $content The content of the article
int $authorID The ID of the author
int $categoryId The ID of the category this article will be published under
string $status The status of the article: 'published', 'disabled', or 'deleted'

Return Value

News An object representing the article that was just created or false if the article was not created

at line line 309
static News[] getNews(int $start, int $limit = 5, bool $getDrafts = false)

Get all the news entries in the database that aren't disabled or deleted

Parameters

int $start The offset used when fetching matches, i.e. the starting point
int $limit The amount of matches to be retrieved
bool $getDrafts Whether or not to fetch drafts

Return Value

News[] An array of news objects

at line line 329
static QueryBuilder getQueryBuilder()

Get a query builder for news

Return Value

QueryBuilder