Account management abstract library
The Account class is a base abstraction for Account features such as Staff, Clients, Members, Subscribers, etc.
It is not intended to be used by itself, however the functions are documented here as they are inherited by extenders.
Check example/lib/clients.php for an example of extension (this can be used as-is)
Check example/lib/client_contact.php for an example of extending lib/contact.php which is also available with this package.
SQL files are included as well
The account suite also interfaces quite nicely with openlss/lib-session for a complete working interface to show this the following examples are also included
use \LSS\Db;
//connect
Db::_get()->setConfig($dbconfig)->connect();
//execute a fetch
$result = Db::_get()->fetch('SELECT * FROM `table` WHERE `col` = ?',array($col));
Any functions not shown in the reference are passed directly to PDO
Db can be and is recommended to be used as a singleton to reuse the same PDO instance.
If multiple connections are needed use a custom method of maintaining the instances.
Sets the config of the database system.
Takes an array with the following structure
$config = array(
'driver' => 'mysql'
,'database' => 'database_name'
,'host' => 'server_host'
,'port' => 'server_port'
,'user' => 'username'
,'password' => 'password'
);
Will use the current configuration and connect
Returns the current query count
Close the open PDO istance (if any)
Prepares WHERE strings to be used in queries
Insert into a table with given parameters
When $update_if_exists is set to TRUE it will perform an INSERT OR UPDATE query.
Updates a record in the database
Fetches a single row from a query and returns the result
These are to be used internally by the extending class, and are used internally within the methods in the Account parent abstract class, if the methods are not extended.
Protected internal macro function; Optionally restricted by the raw $pairs which are passed direct to Db::prepWhere() Returns Db::fetchAll() from the selected target tables, augmented via addMacroFields().
Protected internal macro function; This creates entries in both the Contacts table and the Accounts table. Returns the (int)Account_ID of the resulting new Account, or (bool)false on any error.
protected static function _createParams($extra=array())
protected static function _fetchByEmail($pairs=array(),$except)
protected static function _fetch($pairs=array())
protected static function getQuery()
final public static function auth($password,&$c)
final public static function contactDrop($account_id=null,$value=null,$name='contact_id')
final public static function deactivate($id,$contact=true)
final public static function delete($id,$contact=true)
final public static function fetchContacts($account_id)
final public static function update($account_id,$data)
final public static function updateLastLogin(&$c)
final public static function validate($data,$password=true)
public static function fetchAll();
public static function create($data);
public static function createParams();
public static function fetch($account_id);
public static function fetchByContact($contact_id);
public static function fetchByEmail($email,$except=false);
public static function register($data);
Language | php |
Version | 0.0.0 |
Git URL | https://github.com/nullivex/lib-account |
License | GPL-3.0 |
Description | Account management abstract library |
Keywords |