Dblayer : set the @return with a type
This commit is contained in:
@@ -112,7 +112,8 @@ class Dblayer
|
||||
// Based on an idea of http://tonylandis.com/php/php5-pdo-singleton-class/
|
||||
private static $instance = array ();
|
||||
|
||||
/** Connection to the database engine
|
||||
/**
|
||||
* Connection to the database engine
|
||||
* See http://fr2.php.net/manual/en/pdo.construct.php for the $dsn format
|
||||
* @param string $dsn PDO Data Source Name
|
||||
* @param string|null $username Username to connect
|
||||
@@ -232,7 +233,8 @@ class Dblayer
|
||||
return self::$instance[$this->dsn];
|
||||
}
|
||||
|
||||
/** Return the connected database name from DSN used to connect
|
||||
/**
|
||||
* Return the connected database name from DSN used to connect
|
||||
*/
|
||||
public function databasename ()
|
||||
{
|
||||
@@ -251,7 +253,8 @@ class Dblayer
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/** Return all the tables available in the database
|
||||
/**
|
||||
* Return all the tables available in the database
|
||||
*/
|
||||
public function listTables ()
|
||||
{
|
||||
@@ -295,10 +298,11 @@ class Dblayer
|
||||
return $res;
|
||||
}
|
||||
|
||||
/** Verify if the provided data can be inserted/updated in the database.
|
||||
/**
|
||||
* Verify if the provided data can be inserted/updated in the database.
|
||||
* @param array $data An array containing the data to verify with keys
|
||||
* @param mixed|null $updatekey the key to update
|
||||
* @return an array with the errors in array($key=>array($priority,$message))
|
||||
* @return array an array with the errors in array($key=>array($priority,$message))
|
||||
*/
|
||||
public function verify ($data, $updatekey=false)
|
||||
{
|
||||
@@ -692,7 +696,8 @@ class Dblayer
|
||||
return $lastID;
|
||||
}
|
||||
|
||||
/** Read the table content based on a select filter, ordered by order
|
||||
/**
|
||||
* Read the table content based on a select filter, ordered by order
|
||||
* operator and the associated select value
|
||||
* @param array|null $select Rows to select with
|
||||
* $select = array (array ($key, $val, $operator), ...)
|
||||
@@ -882,12 +887,13 @@ class Dblayer
|
||||
return $res;
|
||||
}
|
||||
|
||||
/** Update the key tuple with the provided data
|
||||
/**
|
||||
* Update the key tuple with the provided data
|
||||
* Return the number of rows modified
|
||||
* @param string|integer $updatekey The key applied on primary key to be
|
||||
* updated
|
||||
* @param array $data The values to be updated
|
||||
* @return the number of lines modified
|
||||
* @return integer the number of lines modified
|
||||
*/
|
||||
public function update ($updatekey, $data)
|
||||
{
|
||||
@@ -1464,7 +1470,8 @@ class Dblayer
|
||||
|
||||
}
|
||||
|
||||
/** Hook postread
|
||||
/**
|
||||
* Hook postread
|
||||
* This hook is run after selecting the data.
|
||||
* @param array $data the data selected by the select
|
||||
* @return array The data modified by the hook
|
||||
@@ -1474,67 +1481,73 @@ class Dblayer
|
||||
return $data;
|
||||
}
|
||||
|
||||
/** Hook preinsert
|
||||
/**
|
||||
* Hook preinsert
|
||||
* This hook is run before inserting a new data in the database, after the
|
||||
* verification
|
||||
* @param array $data the data to insert in the database
|
||||
* @return the modified data
|
||||
* @return array the modified data
|
||||
*/
|
||||
public function hookpreinsert ($data)
|
||||
{
|
||||
return $data;
|
||||
}
|
||||
|
||||
/** Hook postinsert
|
||||
/**
|
||||
* Hook postinsert
|
||||
* This hook is run after successfuly insert a new data in the database
|
||||
* @param array $data the data selected by the select
|
||||
* @param integer $lastID the insert identifier
|
||||
* @return the modified lastID
|
||||
* @return integer the modified lastID
|
||||
*/
|
||||
public function hookpostinsert ($data, $lastID)
|
||||
{
|
||||
return $lastID;
|
||||
}
|
||||
|
||||
/** Hook preupdate
|
||||
/**
|
||||
* Hook preupdate
|
||||
* This hook is run before updating a data in the database, after the
|
||||
* verification
|
||||
* @param string $updatekey the key to be modify
|
||||
* @param array $data the data selected by the select
|
||||
* @return the modified data
|
||||
* @return array the modified data
|
||||
*/
|
||||
public function hookpreupdate ($updatekey, $data)
|
||||
{
|
||||
return $data;
|
||||
}
|
||||
|
||||
/** Hook postupdate
|
||||
/**
|
||||
* Hook postupdate
|
||||
* This hook is run after successfuly update a data in the database
|
||||
* @param string $updatekey the key which was modified
|
||||
* @param array $data the data selected by the select
|
||||
* @param integer $nbLinesUpdated The number of modified lines
|
||||
* @return the modified $nbLinesUpdated
|
||||
* @return integer the modified $nbLinesUpdated
|
||||
*/
|
||||
public function hookpostupdate ($updatekey, $data, $nbLinesUpdated)
|
||||
{
|
||||
return $nbLinesUpdated;
|
||||
}
|
||||
|
||||
/** Hook predelete
|
||||
/**
|
||||
* Hook predelete
|
||||
* This hook is run before deleting a data in the database
|
||||
* @param string $deletekey The key to be removed
|
||||
* @return the modified $deletekey
|
||||
* @return string the modified $deletekey
|
||||
*/
|
||||
public function hookpredelete ($deletekey)
|
||||
{
|
||||
return $deletekey;
|
||||
}
|
||||
|
||||
/** Hook postdelete
|
||||
/**
|
||||
* Hook postdelete
|
||||
* This hook is run after successfuly deleting a data in the database
|
||||
* @param string $deletekey The removed key
|
||||
* @param integer $nbLinesDeleted The number of deleted lines
|
||||
* @return $nbLinesUpdated
|
||||
* @return integer $nbLinesUpdated
|
||||
*/
|
||||
public function hookpostdelete ($deletekey, $nbLinesDeleted)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user