Open Journal Systems  3.3.0
SchemaDAO Class Reference
Inheritance diagram for SchemaDAO:
DAO AnnouncementDAO ArticleGalleyDAO ContextDAO EmailTemplateDAO PKPAuthorDAO PKPPublicationDAO PKPSubmissionDAO JournalDAO AuthorDAO PublicationDAO SubmissionDAO ReviewerSubmissionDAO

Public Member Functions

 _fromRow ($primaryRow)
 
 deleteById ($objectId)
 
 deleteObject ($object)
 
 getById ($objectId)
 
 getInsertId ()
 
 insertObject ($object)
 
 newDataObject ()
 
 updateObject ($object)
 
- 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)
 
 getAdditionalFieldNames ()
 
 getAffectedRows ()
 
 getDataObjectSettings ($tableName, $idFieldName, $idFieldValue, $dataObject)
 
 getDataSource ()
 
 getDirectionMapping ($direction)
 
 getDriver ()
 
 getLocaleFieldNames ()
 
 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)
 

Data Fields

 $primaryKeyColumn
 
 $primaryTableColumns = array()
 
 $schemaName
 
 $settingsTableName
 
 $tableName
 
- Data Fields inherited from DAO
 $_dataSource
 

Additional Inherited Members

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

Detailed Description

A base class for DAOs which rely on a json-schema file to define the data object.

Definition at line 18 of file SchemaDAO.inc.php.

Member Function Documentation

◆ _fromRow()

SchemaDAO::_fromRow (   $primaryRow)

Return a DataObject from a result row

Parameters
$primaryRowarray The result row from the primary table lookup
Returns
DataObject

Reimplemented in ReviewerSubmissionDAO, PKPSubmissionDAO, PKPAuthorDAO, EmailTemplateDAO, PKPPublicationDAO, and PublicationDAO.

Definition at line 240 of file SchemaDAO.inc.php.

References PKPServices\get().

Referenced by ArticleGalleyDAO\getByBestGalleyId(), getById(), AnnouncementDAO\getById(), ContextDAO\getByPath(), and AnnouncementDAO\getMostRecentAnnouncementByAssocId().

◆ deleteById()

SchemaDAO::deleteById (   $objectId)

Delete an object by its ID

Parameters
$objectIdint

Reimplemented in PKPSubmissionDAO, SubmissionDAO, and PKPPublicationDAO.

Definition at line 223 of file SchemaDAO.inc.php.

Referenced by AnnouncementDAO\deleteByAssoc().

◆ deleteObject()

SchemaDAO::deleteObject (   $object)

Delete an object

A wrapper function for SchemaDAO::deleteObjectById().

Parameters
$objectDataObject The object to insert into the database

Reimplemented in PKPSubmissionDAO.

Definition at line 214 of file SchemaDAO.inc.php.

Referenced by PKPAuthorDAO\deleteBySubmissionId(), and AnnouncementDAO\deleteByTypeId().

◆ getById()

SchemaDAO::getById (   $objectId)

Retrieve an object by ID

Parameters
$objectIdint
Returns
DataObject

Reimplemented in PKPAuthorDAO.

Definition at line 61 of file SchemaDAO.inc.php.

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

Referenced by PKPSubmissionDAO\_cacheMiss(), PKPSubmissionDAO\deleteById(), ArticleGalleyDAO\getByBestGalleyId(), and PKPSubmissionDAO\getByPubId().

◆ getInsertId()

SchemaDAO::getInsertId ( )

Get the ID of the last inserted context.

Returns
int

Reimplemented in AnnouncementDAO, PKPSubmissionDAO, and PKPAuthorDAO.

Definition at line 282 of file SchemaDAO.inc.php.

Referenced by insertObject().

◆ insertObject()

SchemaDAO::insertObject (   $object)

Insert a new object

Parameters
DataObject$objectThe object to insert into the database
Returns
int The new object's id

Reimplemented in PKPPublicationDAO, and EmailTemplateDAO.

Definition at line 81 of file SchemaDAO.inc.php.

References PKPServices\get(), getInsertId(), and DAO\update().

◆ newDataObject()

SchemaDAO::newDataObject ( )
abstract

◆ updateObject()

SchemaDAO::updateObject (   $object)

Update an object

When updating an object, we remove table rows for any settings which are no longer present.

Multilingual fields are an exception to this. When a locale key is missing from the object, it is not removed from the database. This is to ensure that data from a locale which is later disabled is not automatically removed from the database, and will appear if the locale is re-enabled.

To delete a value for a locale key, a null value must be passed.

Parameters
$objectDataObject The object to insert into the database

Reimplemented in PKPPublicationDAO, and EmailTemplateDAO.

Definition at line 145 of file SchemaDAO.inc.php.

References PKPServices\get().

Referenced by PKPAuthorDAO\changePublicationLocale().

Field Documentation

◆ $primaryKeyColumn

string SchemaDAO::$primaryKeyColumn

The column name for the object id in primary and settings tables

Definition at line 41 of file SchemaDAO.inc.php.

◆ $primaryTableColumns

array SchemaDAO::$primaryTableColumns = array()

Maps schema properties for the primary table to their column names

Definition at line 47 of file SchemaDAO.inc.php.

◆ $schemaName

string SchemaDAO::$schemaName

One of the SCHEMA_... constants

Definition at line 23 of file SchemaDAO.inc.php.

◆ $settingsTableName

string SchemaDAO::$settingsTableName

The name of the settings table for this object

Definition at line 35 of file SchemaDAO.inc.php.

◆ $tableName

string SchemaDAO::$tableName

The name of the primary table for this object

Definition at line 29 of file SchemaDAO.inc.php.


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