本文整理汇总了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);
}