Open Journal Systems  3.3.0
CategoryDAO Class Reference
Inheritance diagram for CategoryDAO:
DAO

Public Member Functions

 _fromRow ($row)
 
 categoryExistsByPath ($path)
 
 deleteByContextId ($contextId)
 
 deleteById ($categoryId, $contextId=null)
 
 deleteObject ($category)
 
 deletePublicationAssignments ($publicationId)
 
 getAdditionalFieldNames ()
 
 getByContextId ($contextId, $rangeInfo=null)
 
 getById ($categoryId, $contextId=null, $parentId=null)
 
 getByParentId ($parentId, $contextId=null, $rangeInfo=null)
 
 getByPath ($path, $contextId)
 
 getByPublicationId ($publicationId)
 
 getByTitle ($categoryTitle, $contextId, $locale=null)
 
 getCountByContextId ($contextId)
 
 getInsertId ()
 
 getLocaleFieldNames ()
 
 insertObject ($category)
 
 insertPublicationAssignment ($categoryId, $publicationId)
 
 newDataObject ()
 
 resequenceCategories ($contextId, $parentCategoryId=null)
 
 updateLocaleFields ($category)
 
 updateObject ($category)
 
- Public Member Functions inherited from DAO
 __construct ($dataSource=null, $callHooks=true)
 
 concat ()
 
 convertFromDB ($value, $type)
 
 convertToDB ($value, &$type)
 
 dateFromDB ($d)
 
 datetimeFromDB ($dt)
 
 datetimeToDB ($dt)
 
 dateToDB ($d)
 
 flushCache ()
 
 formatDateToDB ($date, $defaultNumWeeks=null, $acceptPastDate=true)
 
 getAffectedRows ()
 
 getDataObjectSettings ($tableName, $idFieldName, $idFieldValue, $dataObject)
 
 getDataSource ()
 
 getDirectionMapping ($direction)
 
 getDriver ()
 
 getType ($value)
 
 handleError ($dataSource, $sql)
 
 nullOrInt ($value)
 
 replace ($table, $arrFields, $keyCols)
 
retrieve ($sql, $params=false, $callHooks=true)
 
retrieveCached ($sql, $params=false, $secsToCache=3600, $callHooks=true)
 
retrieveLimit ($sql, $params=false, $numRows=false, $offset=false, $callHooks=true)
 
retrieveRange ($sql, $params=false, $dbResultRange=null, $callHooks=true)
 
 setCacheDir ()
 
 setDataSource ($dataSource)
 
 update ($sql, $params=false, $callHooks=true, $dieOnError=true)
 
 updateDataObjectSettings ($tableName, $dataObject, $idArray)
 

Additional Inherited Members

- Static Public Member Functions inherited from DAO
static getDataChangedEvent ($elementId=null, $parentElementId=null, $content='')
 
- Data Fields inherited from DAO
 $_dataSource
 
- Protected Member Functions inherited from DAO
 _getInsertId ($table='', $id='')
 

Detailed Description

Operations for retrieving and modifying Category objects.

See also
Category

Definition at line 19 of file CategoryDAO.inc.php.

Member Function Documentation

◆ _fromRow()

CategoryDAO::_fromRow (   $row)

Internal function to return an Category object from a row.

Parameters
$rowarray
Returns
Category

Definition at line 149 of file CategoryDAO.inc.php.

References HookRegistry\call(), DAO\getDataObjectSettings(), and newDataObject().

Referenced by getById(), getByPath(), and getByTitle().

◆ categoryExistsByPath()

CategoryDAO::categoryExistsByPath (   $path)

Check if a category exists with a specified path.

Parameters
$paththe path for the category
Returns
boolean

Definition at line 126 of file CategoryDAO.inc.php.

References DAO\retrieve().

◆ deleteByContextId()

CategoryDAO::deleteByContextId (   $contextId)

Delete category by context ID NOTE: This does not delete dependent entries. It is intended to be called only when deleting a context.

Parameters
$contextIdint

Definition at line 330 of file CategoryDAO.inc.php.

References deleteObject(), and getByContextId().

◆ deleteById()

CategoryDAO::deleteById (   $categoryId,
  $contextId = null 
)

Delete an category by ID.

Parameters
$categoryIdint
$contextIdint optional

Definition at line 297 of file CategoryDAO.inc.php.

References DAO\getAffectedRows(), and DAO\update().

Referenced by deleteObject().

◆ deleteObject()

CategoryDAO::deleteObject (   $category)

Delete an category.

Parameters
$categoryCategory

Definition at line 285 of file CategoryDAO.inc.php.

References deleteById().

Referenced by deleteByContextId().

◆ deletePublicationAssignments()

CategoryDAO::deletePublicationAssignments (   $publicationId)

Delete the assignment of a category to a publication

Parameters
int$publicationId

Definition at line 356 of file CategoryDAO.inc.php.

References DAO\update().

◆ getAdditionalFieldNames()

CategoryDAO::getAdditionalFieldNames ( )

Get a list of additional fields.

Returns
array

Reimplemented from DAO.

Definition at line 178 of file CategoryDAO.inc.php.

◆ getByContextId()

CategoryDAO::getByContextId (   $contextId,
  $rangeInfo = null 
)

Retrieve all categories for a context.

Parameters
$contextIdint Conext ID.
$rangeInfoObject Optional range information.
Returns
DAOResultFactory containing Category ordered by sequence

Definition at line 369 of file CategoryDAO.inc.php.

References DAO\retrieveRange().

Referenced by deleteByContextId().

◆ getById()

CategoryDAO::getById (   $categoryId,
  $contextId = null,
  $parentId = null 
)

Retrieve an category by ID.

Parameters
$categoryIdint
$contextIdint optional
$parentIdint optional
Returns
Category

Definition at line 27 of file CategoryDAO.inc.php.

References _fromRow(), and DAO\retrieve().

◆ getByParentId()

CategoryDAO::getByParentId (   $parentId,
  $contextId = null,
  $rangeInfo = null 
)

Retrieve all categories for a parent category.

Parameters
$parentIdint Parent category ID.
$contextIdint Context ID (optional).
$rangeInfoObject Range info (optional).
Returns
DAOResultFactory containing Category ordered by sequence

Definition at line 409 of file CategoryDAO.inc.php.

References DAO\retrieveRange().

◆ getByPath()

CategoryDAO::getByPath (   $path,
  $contextId 
)

Retrieve a category by path.

Parameters
$pathstring
$contextIdint
Returns
Category

Definition at line 55 of file CategoryDAO.inc.php.

References _fromRow(), and DAO\retrieve().

◆ getByPublicationId()

CategoryDAO::getByPublicationId (   $publicationId)

Retrieve categories by publication id

Parameters
int$publicationId
Returns
DAOResultFactory

Definition at line 109 of file CategoryDAO.inc.php.

References DAO\retrieve().

◆ getByTitle()

CategoryDAO::getByTitle (   $categoryTitle,
  $contextId,
  $locale = null 
)

Retrieve an category by title.

Parameters
$categoryTitlestring
$contextIdint
$localestring optional
Returns
Category

Definition at line 77 of file CategoryDAO.inc.php.

References _fromRow(), and DAO\retrieve().

◆ getCountByContextId()

CategoryDAO::getCountByContextId (   $contextId)

Retrieve the number of categories for a context.

Parameters
$contextIdint Context ID.
Returns
DAOResultFactory containing Category ordered by sequence

Definition at line 389 of file CategoryDAO.inc.php.

References DAO\retrieve().

◆ getInsertId()

CategoryDAO::getInsertId ( )

Get the ID of the last inserted category.

Returns
int

Definition at line 428 of file CategoryDAO.inc.php.

References DAO\_getInsertId().

Referenced by insertObject().

◆ getLocaleFieldNames()

CategoryDAO::getLocaleFieldNames ( )

Get the list of fields for which data can be localized.

Returns
array

Reimplemented from DAO.

Definition at line 170 of file CategoryDAO.inc.php.

◆ insertObject()

CategoryDAO::insertObject (   $category)

Insert a new category.

Parameters
$categoryCategory
Returns
int ID of the inserted category.

Definition at line 205 of file CategoryDAO.inc.php.

References getInsertId(), DAO\update(), and updateLocaleFields().

◆ insertPublicationAssignment()

CategoryDAO::insertPublicationAssignment (   $categoryId,
  $publicationId 
)

Assign a publication to a category

Parameters
int$categoryId
int$publicationId

Definition at line 343 of file CategoryDAO.inc.php.

References DAO\update().

◆ newDataObject()

CategoryDAO::newDataObject ( )

Construct a new data object corresponding to this DAO.

Returns
Category

Definition at line 140 of file CategoryDAO.inc.php.

Referenced by _fromRow().

◆ resequenceCategories()

CategoryDAO::resequenceCategories (   $contextId,
  $parentCategoryId = null 
)

Sequentially renumber categories in their sequence order by context ID and optionally parent category ID.

Parameters
$contextIdint
$parentCategoryIdint Optional parent category ID

Definition at line 256 of file CategoryDAO.inc.php.

References DAO\retrieve(), and DAO\update().

◆ updateLocaleFields()

CategoryDAO::updateLocaleFields (   $category)

Update the localized fields for this table

Parameters
$categoryobject

Definition at line 191 of file CategoryDAO.inc.php.

References DAO\updateDataObjectSettings().

Referenced by insertObject(), and updateObject().

◆ updateObject()

CategoryDAO::updateObject (   $category)

Update an existing category.

Parameters
$categoryCategory

Definition at line 229 of file CategoryDAO.inc.php.

References DAO\update(), and updateLocaleFields().


The documentation for this class was generated from the following file: