PHP Class DraftModel, vanilla

Inheritance: extends VanillaModel
Afficher le fichier Open project: vanilla/vanilla Class Usage Examples

Méthodes publiques

Méthode Description
__construct ( ) Class constructor. Defines the related database table name.
delete ( $where = [], $options = [] ) Delete a draft.
deleteID ( integer $draftID, array $options = [] ) : boolean Deletes a specified draft.
draftQuery ( ) Build base SQL query used by get methods.
get ( $OrderFields = '', $OrderDirection = 'asc', $Limit = false, $PageNumber = false )
getByUser ( integer $UserID, integer $Offset = '0', integer $Limit = '', integer $DiscussionID = '' ) : object Get drafts matching a given criteria.
getCount ( $Wheres = '' )
getCountByUser ( integer $UserID ) : integer Gets number of drafts a user has.
getID ( integer $draftID, string | false $dataSetType = false, array $options = [] ) : object Gets data for a single draft.
save ( array $formPostValues, array $settings = [] ) : integer Insert or update a draft from form values.
updateUser ( integer $UserID ) Updates a user's draft count.

Method Details

__construct() public méthode

Class constructor. Defines the related database table name.
Since: 2.0.0
public __construct ( )

delete() public méthode

public delete ( $where = [], $options = [] )

deleteID() public méthode

This is a hard delete that completely removes it.
public deleteID ( integer $draftID, array $options = [] ) : boolean
$draftID integer Unique ID of the draft to be deleted.
$options array Not used.
Résultat boolean Always returns TRUE.

draftQuery() public méthode

Build base SQL query used by get methods.
Since: 2.0.0
public draftQuery ( )

get() public méthode

public get ( $OrderFields = '', $OrderDirection = 'asc', $Limit = false, $PageNumber = false )

getByUser() public méthode

Get drafts matching a given criteria.
public getByUser ( integer $UserID, integer $Offset = '0', integer $Limit = '', integer $DiscussionID = '' ) : object
$UserID integer Unique ID of user that wrote the drafts.
$Offset integer Number of results to skip.
$Limit integer Max number of drafts to return.
$DiscussionID integer Limits drafts returned to a single discussion.
Résultat object Gdn_DataSet SQL results.

getCount() public méthode

public getCount ( $Wheres = '' )

getCountByUser() public méthode

Gets number of drafts a user has.
public getCountByUser ( integer $UserID ) : integer
$UserID integer Unique ID of user to count drafts for.
Résultat integer Total drafts.

getID() public méthode

Gets data for a single draft.
public getID ( integer $draftID, string | false $dataSetType = false, array $options = [] ) : object
$draftID integer Unique ID of draft to get data for.
$dataSetType string | false The format of the data.
$options array Not used.
Résultat object SQL results.

save() public méthode

Insert or update a draft from form values.
public save ( array $formPostValues, array $settings = [] ) : integer
$formPostValues array Form values sent from form model.
$settings array Not used.
Résultat integer Unique ID of draft.

updateUser() public méthode

Updates a user's draft count.
Since: 2.0.0
public updateUser ( integer $UserID )
$UserID integer Unique ID of the user to be updated.