class NewsCategory extends AliasModel

A news category

Constants

TABLE

The name of the database table used for queries

Methods

void
delete()

Delete a category. Only delete a category if it is not protected

void
disableCategory()

Disable the category

void
enableCategory()

Enable the category

string
getStatus()

Get the status of the category

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

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

bool
isProtected()

Check if the category is protected from being deleted

static NewsCategory
addCategory(string $name)

Create a new category

static NewsCategory[]
getCategories()

Get all of the categories for the news

static string[]
getActiveStatuses()

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

static QueryBuilder
getQueryBuilder()

Get a query builder for news categories

static string
getParamName()

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

static string
getTypeForHumans()

Gets a human-readable format of the model's type

Details

at line line 50
void delete()

Delete a category. Only delete a category if it is not protected

Return Value

void

at line line 66
void disableCategory()

Disable the category

Return Value

void

at line line 79
void enableCategory()

Enable the category

Return Value

void

at line line 92
string getStatus()

Get the status of the category

Return Value

string

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

Get all the news entries in the category 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 127
bool isProtected()

Check if the category is protected from being deleted

Return Value

bool Whether or not the category is protected

at line line 139
static NewsCategory addCategory(string $name)

Create a new category

Parameters

string $name The name of the category

Return Value

NewsCategory An object representing the category that was just created

at line line 154
static NewsCategory[] getCategories()

Get all of the categories for the news

Return Value

NewsCategory[] An array of categories

at line line 167
static string[] getActiveStatuses()

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

Return Value

string[]

at line line 176
static QueryBuilder getQueryBuilder()

Get a query builder for news categories

Return Value

QueryBuilder

at line line 190
static string getParamName()

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

Return Value

string

at line line 198
static string getTypeForHumans()

Gets a human-readable format of the model's type

Return Value

string