当前位置: 首页>>代码示例>>PHP>>正文


PHP JTable::getKeyName方法代码示例

本文整理汇总了PHP中JTable::getKeyName方法的典型用法代码示例。如果您正苦于以下问题:PHP JTable::getKeyName方法的具体用法?PHP JTable::getKeyName怎么用?PHP JTable::getKeyName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JTable的用法示例。


在下文中一共展示了JTable::getKeyName方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testGetKeyNameComposite

	/**
	 * Test for getKeyName returning an array
	 *
	 * @covers JTable::getKeyName
	 *
	 * @return  void
	 *
	 * @since   12.3
	 */
	public function testGetKeyNameComposite()
	{
		$this->assertEquals(
			array('id1', 'id2'),
			$this->object->getKeyName(true)
		);
	}
开发者ID:robschley,项目名称:joomla-platform,代码行数:16,代码来源:JTableTest.php

示例2: deleteHistory

 /**
  * Method to delete the history for an item.
  *
  * @param   JTable  $table  JTable object being versioned
  *
  * @return  boolean  true on success, otherwise false.
  *
  * @since   3.2
  */
 public function deleteHistory($table)
 {
     $key = $table->getKeyName();
     $id = $table->{$key};
     $typeTable = JTable::getInstance('Contenttype', 'JTable');
     $typeId = $typeTable->getTypeId($this->typeAlias);
     $db = JFactory::getDbo();
     $query = $db->getQuery(true);
     $query->delete($db->quoteName('#__ucm_history'))->where($db->quoteName('ucm_item_id') . ' = ' . (int) $id)->where($db->quoteName('ucm_type_id') . ' = ' . (int) $typeId);
     $db->setQuery($query);
     return $db->execute();
 }
开发者ID:adjaika,项目名称:J3Base,代码行数:21,代码来源:contenthistory.php

示例3: clearPrimaryKeys

 /**
  * clearPrimaryKeys
  *
  * @param \JTable $itemTable
  *
  * @return  \JTable
  */
 public function clearPrimaryKeys(\JTable $itemTable)
 {
     foreach ($itemTable->getKeyName(true) as $key) {
         $itemTable->{$key} = null;
     }
     return $itemTable;
 }
开发者ID:lyrasoft,项目名称:lyrasoft.github.io,代码行数:14,代码来源:AbstractRelationHandler.php

示例4: unTagItem

 /**
  * Method to untag an item
  *
  * @param   integer  $contentId  ID of the content item being untagged
  * @param   JTable   $table      JTable object being untagged
  * @param   array    $tags       Array of tags to be untagged. Use an empty array to untag all existing tags.
  *
  * @return  boolean  true on success, otherwise false.
  *
  * @since   3.1
  */
 public function unTagItem($contentId, $table, $tags = array())
 {
     $key = $table->getKeyName();
     $id = $table->{$key};
     $db = JFactory::getDbo();
     $query = $db->getQuery(true)->delete('#__contentitem_tag_map')->where($db->quoteName('type_alias') . ' = ' . $db->quote($this->typeAlias))->where($db->quoteName('content_item_id') . ' = ' . (int) $id);
     if (is_array($tags) && count($tags) > 0) {
         $query->where($db->quoteName('tag_id') . ' IN ' . implode(',', $tags));
     }
     $db->setQuery($query);
     return (bool) $db->execute();
 }
开发者ID:fur81,项目名称:zofaxiopeu,代码行数:23,代码来源:tags.php

示例5: loadHistory

 /**
  * Method to load a row for editing from the version history table.
  *
  * @param   integer  $version_id  Key to the version history table.
  * @param   JTable   &$table      Content table object being loaded.
  *
  * @return  boolean  False on failure or error, true otherwise.
  *
  * @since   12.2
  */
 public function loadHistory($version_id, JTable &$table)
 {
     // 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('History', 'ContenthistoryTable');
         if (!$historyTable->load($version_id)) {
             $this->setError($historyTable->getError());
             return false;
         }
         $rowArray = JArrayHelper::fromObject(json_decode($historyTable->version_data));
         $typeId = JTable::getInstance('Types', 'ContentTable')->getTypeId($this->typeAlias);
         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);
 }
开发者ID:terryvisser,项目名称:joomlatools-platform,代码行数:36,代码来源:legacy.php

示例6: prepareTable

 /**
  * Prepare and sanitise the table data prior to saving.
  *
  * @param   JTable  $table  A reference to a JTable object.
  *
  * @return  void
  */
 protected function prepareTable(\JTable $table)
 {
     $date = DateHelper::getDate('now');
     $user = $this->container->get('user');
     $key = $table->getKeyName();
     // Alias
     if (property_exists($table, 'alias')) {
         if (!$table->alias) {
             $table->alias = JFilterOutput::stringURLSafe(trim($table->title));
         } else {
             $table->alias = JFilterOutput::stringURLSafe(trim($table->alias));
         }
         if (!$table->alias) {
             $table->alias = JFilterOutput::stringURLSafe($date->toSql(true));
         }
     }
     // Created date
     if (property_exists($table, 'created')) {
         if ($table->created) {
             $table->created = DateHelper::toServerTime($table->created);
         } else {
             $table->created = $date->toSql();
         }
     }
     // Publish_up date
     if (property_exists($table, 'publish_up')) {
         if ($table->publish_up) {
             $table->publish_up = DateHelper::toServerTime($table->publish_up);
         } else {
             $table->publish_up = $this->db->getNullDate();
         }
     }
     // Publish_down date
     if (property_exists($table, 'publish_down')) {
         if ($table->publish_down) {
             $table->publish_down = DateHelper::toServerTime($table->publish_down);
         } else {
             $table->publish_down = $this->db->getNullDate();
         }
     }
     // Modified date
     if (property_exists($table, 'modified') && $table->{$key}) {
         $table->modified = $date->toSql();
     }
     // Created user
     if (property_exists($table, 'created_by') && !$table->created_by) {
         $table->created_by = $user->get('id');
     }
     // Modified user
     if (property_exists($table, 'modified_by') && $table->{$key}) {
         $table->modified_by = $user->get('id');
     }
     // Set Ordering or Nested ordering
     if (property_exists($table, 'ordering')) {
         if (empty($table->id)) {
             $this->setOrderPosition($table);
         }
     }
 }
开发者ID:lyrasoft,项目名称:lyrasoft.github.io,代码行数:66,代码来源:AdminModel.php


注:本文中的JTable::getKeyName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。