本文整理匯總了PHP中Element::getElementClass方法的典型用法代碼示例。如果您正苦於以下問題:PHP Element::getElementClass方法的具體用法?PHP Element::getElementClass怎麽用?PHP Element::getElementClass使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Element
的用法示例。
在下文中一共展示了Element::getElementClass方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: updateElement
/**
* Updates an element in cache
* @param Element $element The element to update
*/
public static function updateElement($element)
{
$elementClass = $element->getElementClass();
$elementId = $element->id;
// Updates element attributes if already cached
if (self::isCachedElement($elementClass, $elementId)) {
self::$cachedElementArray[$elementClass][$elementId] = $element;
}
}
示例2: deleteElement
/**
* Deletes an element in database
* @param Element $element The element to delete
*/
public static function deleteElement($element)
{
// Builds request string
$elementClass = $element->getElementClass();
$tableName = DatabaseFactory::getElementTableName($elementClass);
$request = 'DELETE FROM ' . $tableName . ' WHERE ' . $tableName . '_id = \'' . $element->id . '\'';
// Gets database connection instance
$databaseConnection = $elementClass::getDatabaseConnection();
$affectedRowNumber = $databaseConnection->deleteRequest($request);
// Affected row number is incorrect
if ($affectedRowNumber != 1) {
throw new DatabaseException('Invalid affected row number while deleting ' . $elementType . ' element with id #' . $elementId);
}
}
示例3: deleteElement
/**
* Deletes an element
* @param Element $element The element to delete
*/
public static function deleteElement($element)
{
$logInstance = LogTool::getInstance();
$logInstance->logDebug('Deletes ' . $element->getElementClass() . ' element with id #' . $element->id);
// Updates element in database
DatabaseFactory::deleteElement($element);
}