本文整理汇总了PHP中F0FTable::getKeyName方法的典型用法代码示例。如果您正苦于以下问题:PHP F0FTable::getKeyName方法的具体用法?PHP F0FTable::getKeyName怎么用?PHP F0FTable::getKeyName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类F0FTable
的用法示例。
在下文中一共展示了F0FTable::getKeyName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addMultipleRelation
/**
* Defining a ∞:∞ (multiple) relation. This adds relations to the getMultiple() method.
*
* In other words: is a table RELATED TO MANY other records?
*
* @param string $itemName is how it will be known locally to the getRelatedItems method (plural)
* @param string $tableClass if skipped it is defined automatically as ComponentnameTableItemname
* @param string $localKey is the column containing our side of the FK relation, default: our primary key field name
* @param string $ourPivotKey is the column containing our side of the FK relation in the pivot table, default: $localKey
* @param string $theirPivotKey is the column containing the other table's side of the FK relation in the pivot table, default $remoteKey
* @param string $remoteKey is the remote table's FK column, default: componentname_itemname_id
* @param string $glueTable is the name of the glue (pivot) table, default: #__componentname_thisclassname_itemname with plural items (e.g. #__foobar_users_roles)
* @param boolean $default is this the default multiple relation?
*/
public function addMultipleRelation($itemName, $tableClass = null, $localKey = null, $ourPivotKey = null, $theirPivotKey = null, $remoteKey = null, $glueTable = null, $default = true)
{
$itemName = $this->normaliseItemName($itemName, true);
if (empty($localKey)) {
$localKey = $this->table->getKeyName();
}
$this->addBespokePivotRelation('multiple', $itemName, $tableClass, $localKey, $remoteKey, $ourPivotKey, $theirPivotKey, $glueTable, $default);
}
示例2: loadhistory
/**
* Method to load a row for editing from the version history table.
*
* @param integer $version_id Key to the version history table.
* @param F0FTable &$table Content table object being loaded.
* @param string $alias The type_alias in #__content_types
*
* @return boolean False on failure or error, true otherwise.
*
* @since 2.3
*/
public function loadhistory($version_id, F0FTable &$table, $alias)
{
// Only attempt to check the row in if it exists.
if ($version_id) {
$user = JFactory::getUser();
// Get an instance of the row to checkout.
$historyTable = JTable::getInstance('Contenthistory');
if (!$historyTable->load($version_id)) {
$this->setError($historyTable->getError());
return false;
}
$rowArray = JArrayHelper::fromObject(json_decode($historyTable->version_data));
$typeId = JTable::getInstance('Contenttype')->getTypeId($alias);
if ($historyTable->ucm_type_id != $typeId) {
$this->setError(JText::_('JLIB_APPLICATION_ERROR_HISTORY_ID_MISMATCH'));
$key = $table->getKeyName();
if (isset($rowArray[$key])) {
$table->checkIn($rowArray[$key]);
}
return false;
}
}
$this->setState('save_date', $historyTable->save_date);
$this->setState('version_note', $historyTable->version_note);
return $table->bind($rowArray);
}