XOOPS  2.6.0
Xoops\Core\Kernel\XoopsPersistableObjectHandler Class Reference
Inheritance diagram for Xoops\Core\Kernel\XoopsPersistableObjectHandler:
Inheritance graph

Public Member Functions

 __call ($name, $args)
 
 cleanOrphan ($table_link= '', $field_link= '', $field_object= '')
 
 create ($isNew=true)
 
 delete (XoopsObject $object, $force=false)
 
 deleteAll (CriteriaElement $criteria, $force=true, $asObject=false)
 
 deleteByLink (CriteriaElement $criteria=null)
 
 get ($id=null, $fields=null)
 
 getAll (CriteriaElement $criteria=null, $fields=null, $asObject=true, $id_as_key=true)
 
 getByLink (CriteriaElement $criteria=null, $fields=null, $asObject=true, $field_link=null, $field_object=null)
 
 getCount (CriteriaElement $criteria=null)
 
 getCountByLink (CriteriaElement $criteria=null)
 
 getCounts (CriteriaElement $criteria=null)
 
 getCountsByLink (CriteriaElement $criteria=null)
 
 getIds (CriteriaElement $criteria=null)
 
 getList (CriteriaElement $criteria=null, $limit=0, $start=0)
 
 getObjects (CriteriaElement $criteria=null, $id_as_key=false, $as_object=true)
 
 insert (XoopsObject $object, $force=true)
 
 loadHandler ($name, $args=null)
 
 setHandler ($handler=null, $args=null, $path=null)
 
 synchronization ($table_link= '', $field_link= '', $field_object= '')
 
 updateAll ($fieldname, $fieldvalue, CriteriaElement $criteria, $force=false)
 
 updateByLink ($data, CriteriaElement $criteria=null)
 
- Public Member Functions inherited from Xoops\Core\Kernel\XoopsObjectHandler
 create ()
 
 delete (XoopsObject $object, $force=true)
 
 get ($int_id)
 
 insert (XoopsObject $object, $force=true)
 

Public Attributes

 $className
 
 $field_link
 
 $field_object
 
 $identifierName
 
 $keyName
 
 $keyName_link
 
 $table
 
 $table_link
 
- Public Attributes inherited from Xoops\Core\Kernel\XoopsObjectHandler
 $db2
 

Protected Member Functions

 __construct (Connection $db=null, $table= '', $className= '', $keyName= '', $identifierName= '')
 
- Protected Member Functions inherited from Xoops\Core\Kernel\XoopsObjectHandler
 __construct (Connection $db=null)
 

Protected Attributes

 $handler
 

Private Attributes

 $handlers = array('read' => null, 'stats' => null, 'joint' => null, 'write' => null, 'sync' => null)
 

Detailed Description

Definition at line 30 of file XoopsPersistableObjectHandler.php.

Constructor & Destructor Documentation

Xoops\Core\Kernel\XoopsPersistableObjectHandler::__construct ( Connection  $db = null,
  $table = '',
  $className = '',
  $keyName = '',
  $identifierName = '' 
)
protected

Constructor

Parameters
null | Connection$dbXoops\Core\Dattabase\Connectionobject@paramstring$tableNameofdatabasetable@paramstring$classNameNameofClass,thishandlerismanaging@paramstring$keyNameNameofthepropertyholdingthekey@paramstring$identifierNameNameofthepropertyholdinganidentifiername(title,name...),usedongetList()

Definition at line 109 of file XoopsPersistableObjectHandler.php.

References Xoops\Core\Kernel\XoopsPersistableObjectHandler\$className, Xoops\Core\Kernel\XoopsPersistableObjectHandler\$identifierName, Xoops\Core\Kernel\XoopsPersistableObjectHandler\$keyName, and Xoops\Core\Kernel\XoopsPersistableObjectHandler\$table.

Member Function Documentation

Xoops\Core\Kernel\XoopsPersistableObjectHandler::__call (   $name,
  $args 
)

Magic method for overloading of delegation

Parameters
string$namemethod name
array$argsarguments
Returns
mixed

Definition at line 191 of file XoopsPersistableObjectHandler.php.

References Xoops\Core\Kernel\XoopsPersistableObjectHandler\$handler, $name, and Xoops\Core\Kernel\XoopsPersistableObjectHandler\loadHandler().

Here is the call graph for this function:

Xoops\Core\Kernel\XoopsPersistableObjectHandler::cleanOrphan (   $table_link = '',
  $field_link = '',
  $field_object = '' 
)

*#@- *#@+ Methods of sync handler XoopsObjectSync Clean orphan objects against linked objects

Parameters
string$table_linktable of linked object for JOIN
string$field_linkfield of linked object for JOIN
string$field_objectfield of current object for JOIN
Returns
bool true on success

Definition at line 578 of file XoopsPersistableObjectHandler.php.

References Xoops\Core\Kernel\XoopsPersistableObjectHandler\$field_link, Xoops\Core\Kernel\XoopsPersistableObjectHandler\$field_object, Xoops\Core\Kernel\XoopsPersistableObjectHandler\$handler, Xoops\Core\Kernel\XoopsPersistableObjectHandler\$table_link, and Xoops\Core\Kernel\XoopsPersistableObjectHandler\loadHandler().

Referenced by Xoops\Core\Kernel\XoopsPersistableObjectHandler\synchronization().

Here is the call graph for this function:

Here is the caller graph for this function:

Xoops\Core\Kernel\XoopsPersistableObjectHandler::create (   $isNew = true)

*#@+ Methods of native handler XoopsPersistableObjectHandler create a new object

Parameters
bool$isNewFlag the new objects as new
Returns
XoopsObject XoopsObject

Definition at line 218 of file XoopsPersistableObjectHandler.php.

Xoops\Core\Kernel\XoopsPersistableObjectHandler::delete ( XoopsObject  $object,
  $force = false 
)

delete an object from the database

Parameters
XoopsObject$objectXoopsObject reference to the object to delete
bool$forceforce delete
Returns
bool FALSE if failed.

Definition at line 311 of file XoopsPersistableObjectHandler.php.

References Xoops\Core\Kernel\XoopsPersistableObjectHandler\$handler, and Xoops\Core\Kernel\XoopsPersistableObjectHandler\loadHandler().

Here is the call graph for this function:

Xoops\Core\Kernel\XoopsPersistableObjectHandler::deleteAll ( CriteriaElement  $criteria,
  $force = true,
  $asObject = false 
)

delete all objects matching the conditions

Parameters
CriteriaElement$criteriaCriteriaElement with conditions to meet
boolean$forceforce to delete
boolean$asObjectdelete in object way: instantiate all objects and delete one by one
Returns
bool

Definition at line 328 of file XoopsPersistableObjectHandler.php.

References Xoops\Core\Kernel\XoopsPersistableObjectHandler\$handler, and Xoops\Core\Kernel\XoopsPersistableObjectHandler\loadHandler().

Referenced by XoopsGroupPermHandler\deleteByGroup(), XoopsGroupPermHandler\deleteByModule(), CommentsCommentHandler\deleteByModule(), XoopsOnlineHandler\destroy(), XoopsOnlineHandler\gc(), NotificationsNotificationHandler\unsubscribe(), NotificationsNotificationHandler\unsubscribeByItem(), NotificationsNotificationHandler\unsubscribeByModule(), and NotificationsNotificationHandler\unsubscribeByUser().

Here is the call graph for this function:

Here is the caller graph for this function:

Xoops\Core\Kernel\XoopsPersistableObjectHandler::deleteByLink ( CriteriaElement  $criteria = null)

Delete objects matching a condition against linked objects

Parameters
CriteriaElement | null$criteriaCriteriaElement to match
Returns
int count of objects

Definition at line 553 of file XoopsPersistableObjectHandler.php.

References $criteria, Xoops\Core\Kernel\XoopsPersistableObjectHandler\$handler, and Xoops\Core\Kernel\XoopsPersistableObjectHandler\loadHandler().

Here is the call graph for this function:

Xoops\Core\Kernel\XoopsPersistableObjectHandler::get (   $id = null,
  $fields = null 
)

Load a XoopsObject object from the database

Parameters
mixed$idID
array$fieldsfields to fetch
Returns
XoopsObject|null XoopsObject

Definition at line 238 of file XoopsPersistableObjectHandler.php.

References $id, Xoops\Core\Kernel\XoopsPersistableObjectHandler\$keyName, $result, and Xoops\Core\Kernel\XoopsObjectHandler\create().

Here is the call graph for this function:

Xoops\Core\Kernel\XoopsPersistableObjectHandler::getAll ( CriteriaElement  $criteria = null,
  $fields = null,
  $asObject = true,
  $id_as_key = true 
)

get all objects matching a condition

Parameters
CriteriaElement | null$criteriaCriteriaElement to match
array$fieldsvariables to fetch
bool$asObjectflag indicating as object, otherwise as array
bool$id_as_keyuse the ID as key for the array
Returns
array of objects/array XoopsObject

Definition at line 392 of file XoopsPersistableObjectHandler.php.

References $criteria, Xoops\Core\Kernel\XoopsPersistableObjectHandler\$handler, and Xoops\Core\Kernel\XoopsPersistableObjectHandler\loadHandler().

Here is the call graph for this function:

Xoops\Core\Kernel\XoopsPersistableObjectHandler::getByLink ( CriteriaElement  $criteria = null,
  $fields = null,
  $asObject = true,
  $field_link = null,
  $field_object = null 
)

*#@- *#@+ Methods of joint handler XoopsObjectJoint get a list of objects matching a condition joint with another related object

Parameters
CriteriaElement | null$criteriaCriteriaElement to match
array$fieldsvariables to fetch
bool$asObjectflag indicating as object, otherwise as array
string$field_linkfield of linked object for JOIN
string$field_objectfield of current object for JOIN
Returns
array of objects XoopsObject

Definition at line 487 of file XoopsPersistableObjectHandler.php.

References $criteria, Xoops\Core\Kernel\XoopsPersistableObjectHandler\$field_link, Xoops\Core\Kernel\XoopsPersistableObjectHandler\$field_object, Xoops\Core\Kernel\XoopsPersistableObjectHandler\$handler, and Xoops\Core\Kernel\XoopsPersistableObjectHandler\loadHandler().

Here is the call graph for this function:

Xoops\Core\Kernel\XoopsPersistableObjectHandler::getCount ( CriteriaElement  $criteria = null)

*#@- *#@+ Methods of stats handler XoopsObjectStats count objects matching a condition

Parameters
CriteriaElement | null$criteriaCriteriaElement to match
Returns
int count of objects

Definition at line 447 of file XoopsPersistableObjectHandler.php.

References $criteria, Xoops\Core\Kernel\XoopsPersistableObjectHandler\$handler, and Xoops\Core\Kernel\XoopsPersistableObjectHandler\loadHandler().

Referenced by XoopsGroupPermHandler\checkRight(), CommentsCommentHandler\getCountByItemId(), CommentsCommentHandler\getCountByModuleId(), NotificationsNotificationHandler\isSubscribed(), and XoopsTplfileHandler\templateExists().

Here is the call graph for this function:

Here is the caller graph for this function:

Xoops\Core\Kernel\XoopsPersistableObjectHandler::getCountByLink ( CriteriaElement  $criteria = null)

Count of objects matching a condition

Parameters
CriteriaElement | null$criteriaCriteriaElement to match
Returns
int count of objects

Definition at line 507 of file XoopsPersistableObjectHandler.php.

References $criteria, Xoops\Core\Kernel\XoopsPersistableObjectHandler\$handler, and Xoops\Core\Kernel\XoopsPersistableObjectHandler\loadHandler().

Here is the call graph for this function:

Xoops\Core\Kernel\XoopsPersistableObjectHandler::getCounts ( CriteriaElement  $criteria = null)

Get counts of objects matching a condition

Parameters
CriteriaElement | null$criteriaCriteriaElement to match
Returns
array of counts

Definition at line 461 of file XoopsPersistableObjectHandler.php.

References $criteria, Xoops\Core\Kernel\XoopsPersistableObjectHandler\$handler, and Xoops\Core\Kernel\XoopsPersistableObjectHandler\loadHandler().

Here is the call graph for this function:

Xoops\Core\Kernel\XoopsPersistableObjectHandler::getCountsByLink ( CriteriaElement  $criteria = null)

array of count of objects matching a condition of, groupby linked object keyname

Parameters
CriteriaElement | null$criteriaCriteriaElement to match
Returns
int count of objects

Definition at line 522 of file XoopsPersistableObjectHandler.php.

References $criteria, Xoops\Core\Kernel\XoopsPersistableObjectHandler\$handler, and Xoops\Core\Kernel\XoopsPersistableObjectHandler\loadHandler().

Here is the call graph for this function:

Xoops\Core\Kernel\XoopsPersistableObjectHandler::getIds ( CriteriaElement  $criteria = null)

get IDs of objects matching a condition

Parameters
CriteriaElement | null$criteriaCriteriaElement to match
Returns
array of object IDs

Definition at line 424 of file XoopsPersistableObjectHandler.php.

References $criteria, Xoops\Core\Kernel\XoopsPersistableObjectHandler\$handler, and Xoops\Core\Kernel\XoopsPersistableObjectHandler\loadHandler().

Here is the call graph for this function:

Xoops\Core\Kernel\XoopsPersistableObjectHandler::getList ( CriteriaElement  $criteria = null,
  $limit = 0,
  $start = 0 
)

Retrieve a list of objects data

Parameters
CriteriaElement | null$criteriaCriteriaElement conditions to be met
int$limitMax number of objects to fetch
int$startWhich record to start at
Returns
array

Definition at line 409 of file XoopsPersistableObjectHandler.php.

References $criteria, Xoops\Core\Kernel\XoopsPersistableObjectHandler\$handler, $limit, $start, and Xoops\Core\Kernel\XoopsPersistableObjectHandler\loadHandler().

Here is the call graph for this function:

Xoops\Core\Kernel\XoopsPersistableObjectHandler::getObjects ( CriteriaElement  $criteria = null,
  $id_as_key = false,
  $as_object = true 
)

*#@- *#@+ Methods of read handler XoopsObjectRead Retrieve objects from the database

Parameters
CriteriaElement | null$criteriaCriteriaElement conditions to be met
bool$id_as_keyuse the ID as key for the array
bool$as_objectreturn an array of objects
Returns
array

Definition at line 374 of file XoopsPersistableObjectHandler.php.

References $criteria, Xoops\Core\Kernel\XoopsPersistableObjectHandler\$handler, and Xoops\Core\Kernel\XoopsPersistableObjectHandler\loadHandler().

Referenced by CommentsCommentHandler\getByItemId(), XoopsGroupPermHandler\getGroupIds(), XoopsGroupPermHandler\getItemIds(), AvatarsAvatarHandler\getListByType(), XoopsTplsetHandler\getNameList(), CommentsCommentHandler\getThread(), and CommentsCommentHandler\getTopComments().

Here is the call graph for this function:

Here is the caller graph for this function:

Xoops\Core\Kernel\XoopsPersistableObjectHandler::insert ( XoopsObject  $object,
  $force = true 
)

*#@- *#@+ Methods of write handler XoopsObjectWrite insert an object into the database

Parameters
XoopsObject$objectXoopsObject reference to object
bool$forceflag to force the query execution despite security settings
Returns
mixed

Definition at line 296 of file XoopsPersistableObjectHandler.php.

References Xoops\Core\Kernel\XoopsPersistableObjectHandler\$handler, and Xoops\Core\Kernel\XoopsPersistableObjectHandler\loadHandler().

Referenced by XoopsGroupPermHandler\addRight(), NotificationsNotificationHandler\doLoginMaintenance(), NotificationsNotificationHandler\subscribe(), CommentsCommentHandler\updateByField(), and NotificationsNotificationHandler\updateByField().

Here is the call graph for this function:

Here is the caller graph for this function:

Xoops\Core\Kernel\XoopsPersistableObjectHandler::loadHandler (   $name,
  $args = null 
)

Load predefined handler

Parameters
string$namehandler name
mixed$argsargs
Returns
XoopsModelAbstract of handler XoopsModelAbstract

// Following code just kept as placeholder for PHP5 if (!isset(self::$handlers[$name])) { self::$handlers[$name] = XoopsModelFactory::loadHandler($this, $name, $args); } else { self::$handlers[$name]->setHandler($this); self::$handlers[$name]->setVars($args); }

return self::$handlers[$name];

Definition at line 156 of file XoopsPersistableObjectHandler.php.

References Xoops\Core\Kernel\XoopsPersistableObjectHandler\$handler, Xoops\Core\Kernel\XoopsPersistableObjectHandler\$handlers, $name, and Xoops\Core\Kernel\XoopsModelFactory\getInstance().

Referenced by Xoops\Core\Kernel\XoopsPersistableObjectHandler\__call(), Xoops\Core\Kernel\XoopsPersistableObjectHandler\cleanOrphan(), Xoops\Core\Kernel\XoopsPersistableObjectHandler\delete(), Xoops\Core\Kernel\XoopsPersistableObjectHandler\deleteAll(), Xoops\Core\Kernel\XoopsPersistableObjectHandler\deleteByLink(), Xoops\Core\Kernel\XoopsPersistableObjectHandler\getAll(), Xoops\Core\Kernel\XoopsPersistableObjectHandler\getByLink(), Xoops\Core\Kernel\XoopsPersistableObjectHandler\getCount(), Xoops\Core\Kernel\XoopsPersistableObjectHandler\getCountByLink(), Xoops\Core\Kernel\XoopsPersistableObjectHandler\getCounts(), Xoops\Core\Kernel\XoopsPersistableObjectHandler\getCountsByLink(), Xoops\Core\Kernel\XoopsPersistableObjectHandler\getIds(), Xoops\Core\Kernel\XoopsPersistableObjectHandler\getList(), Xoops\Core\Kernel\XoopsPersistableObjectHandler\getObjects(), Xoops\Core\Kernel\XoopsPersistableObjectHandler\insert(), Xoops\Core\Kernel\XoopsPersistableObjectHandler\updateAll(), and Xoops\Core\Kernel\XoopsPersistableObjectHandler\updateByLink().

Here is the call graph for this function:

Here is the caller graph for this function:

Xoops\Core\Kernel\XoopsPersistableObjectHandler::setHandler (   $handler = null,
  $args = null,
  $path = null 
)

Set custom handler

Parameters
string | object$handlerhandler
array | null$argsarguments
string | null$pathpath
Returns
object|null

Definition at line 134 of file XoopsPersistableObjectHandler.php.

References Xoops\Core\Kernel\XoopsPersistableObjectHandler\$handler, $path, and Xoops\Core\Kernel\XoopsModelFactory\getInstance().

Here is the call graph for this function:

Xoops\Core\Kernel\XoopsPersistableObjectHandler::synchronization (   $table_link = '',
  $field_link = '',
  $field_object = '' 
)
Xoops\Core\Kernel\XoopsPersistableObjectHandler::updateAll (   $fieldname,
  $fieldvalue,
CriteriaElement  $criteria,
  $force = false 
)

Change a field for objects with a certain criteria

Parameters
string$fieldnameName of the field
mixed$fieldvalueValue to write
CriteriaElement$criteriaCriteriaElement
boolean$forceforce to query
Returns
bool

Definition at line 347 of file XoopsPersistableObjectHandler.php.

References Xoops\Core\Kernel\XoopsPersistableObjectHandler\$handler, and Xoops\Core\Kernel\XoopsPersistableObjectHandler\loadHandler().

Here is the call graph for this function:

Xoops\Core\Kernel\XoopsPersistableObjectHandler::updateByLink (   $data,
CriteriaElement  $criteria = null 
)

upate objects matching a condition against linked objects

Parameters
array$dataarray of key => value
CriteriaElement | null$criteriaCriteriaElement to match
Returns
int count of objects

Definition at line 538 of file XoopsPersistableObjectHandler.php.

References $criteria, Xoops\Core\Kernel\XoopsPersistableObjectHandler\$handler, and Xoops\Core\Kernel\XoopsPersistableObjectHandler\loadHandler().

Here is the call graph for this function:

Member Data Documentation

Xoops\Core\Kernel\XoopsPersistableObjectHandler::$handlers = array('read' => null, 'stats' => null, 'joint' => null, 'write' => null, 'sync' => null)
private

holds reference to predefined extended object handlers: read, stats, joint, write, sync

The handlers hold methods for different purposes, which could be all put together inside of current class. However, load codes only if they are necessary, thus they are now splitted out.

var array of objects

private

Definition at line 54 of file XoopsPersistableObjectHandler.php.

Referenced by Xoops\Core\Kernel\XoopsPersistableObjectHandler\loadHandler().

Xoops\Core\Kernel\XoopsPersistableObjectHandler::$keyName_link

Definition at line 97 of file XoopsPersistableObjectHandler.php.

Xoops\Core\Kernel\XoopsPersistableObjectHandler::$table_link

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