public class AuthorManager

class.authormanager.php #13

The AuthorManager class is responsible for managing all Author objects in Symphony. Unlike other Manager objects, Authors are stored in the database, and not on the file system. CRUD methods are implemented to allow Authors to be created (add), read (fetch), updated (edit) and deleted (delete).

Methods

static boolean activateAuthToken(integer $author_id)

This function will allow an Author to sign into Symphony by using their authentication token as well as username/password.

Parameters
  • $author_id integerThe Author ID to allow to use their authentication token.

static integer|boolean add(array $fields)

Given an associative array of fields, insert them into the database returning the resulting AuthorID if successful, or false if there was an error

Parameters
  • $fields arrayAssociative array of field names => values for the Author object

Returns

Returns an Author ID of the created Author on success, false otherwise.

static boolean deactivateAuthToken(integer $author_id)

This function will remove the ability for an Author to sign into Symphony by using their authentication token

Parameters
  • $author_id integerThe Author ID to allow to use their authentication token.

static boolean delete(integer $id)

Given an Author ID, delete an Author from Symphony.

Parameters
  • $id integerThe ID of the Author that should be deleted

static boolean edit(integer $id, array $fields)

Given an Author ID and associative array of fields, update an existing Author row in the tbl_authors database table. Returns boolean for success/failure

Parameters
  • $id integerThe ID of the Author that should be updated

  • $fields arrayAssociative array of field names => values for the Author object This array does need to contain every value for the author object, it can just be the changed values.

static array fetch(string $sortby, string $sortdirection, integer $limit, integer $start, string $where, string $joins)

The fetch method returns all Authors from Symphony with the option to sort or limit the output. This method returns an array of Author objects.

Parameters
  • $sortby stringThe field to sort the authors by, defaults to 'id'

  • $sortdirection stringAvailable values of ASC (Ascending) or DESC (Descending), which refer to the sort order for the query. Defaults to ASC (Ascending)

  • $limit integerThe number of rows to return

  • $start integerThe offset start point for limiting, maps to the LIMIT {x}, {y} MySQL functionality

  • $where stringAny custom WHERE clauses. The tbl_authors alias is a

  • $joins stringAny custom JOIN's

Returns

An array of Author objects. If no Authors are found, null is returned.

static mixed fetchByID(integer|array $id)

Returns Author's that match the provided ID's with the option to sort or limit the output. This function will search the AuthorManager::$_pool for Authors first before querying tbl_authors

Parameters
  • $id integer|arrayA single ID or an array of ID's

Returns

If $id is an integer, the result will be an Author object, otherwise an array of Author objects will be returned. If no Authors are found, or no $id is given, null is returned.

static Author|null fetchByUsername(string $username)

Returns an Author by Username. This function will search the AuthorManager::$_pool for Authors first before querying tbl_authors

Parameters
  • $username stringThe Author's username

Returns

If an Author is found, an Author object is returned, otherwise null.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details