本文整理汇总了PHP中JTable::set方法的典型用法代码示例。如果您正苦于以下问题:PHP JTable::set方法的具体用法?PHP JTable::set怎么用?PHP JTable::set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JTable
的用法示例。
在下文中一共展示了JTable::set方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: prepareTable
/**
* Prepare and sanitise the table prior to saving.
*
* @param JTable $table
*
* @since 1.6
*/
protected function prepareTable($table)
{
// get maximum order number
if (!$table->get("id")) {
// Set ordering to the last item if not set
if (!$table->get("ordering")) {
$db = $this->getDbo();
$query = $db->getQuery(true);
$query->select("MAX(a.ordering)")->from($db->quoteName("#__itpm_tags", "a"))->where("a.url_id =" . (int) $table->get("url_id"));
$db->setQuery($query, 0, 1);
$max = $db->loadResult();
$table->set("ordering", $max + 1);
}
}
}
示例2: prepareTable
/**
* Prepare project images before saving.
*
* @param JTable $table
*
* @throws Exception
*
* @since 1.6
*/
protected function prepareTable($table)
{
// Set order value
if (!$table->get('id') and !$table->get('ordering')) {
$db = $this->getDbo();
$query = $db->getQuery(true);
$query->select('MAX(a.ordering)')->from($db->quoteName('#__crowdf_rewards', 'a'))->where('a.project_id = ' . (int) $table->get('project_id'));
$db->setQuery($query, 0, 1);
$max = $db->loadResult();
$table->set('ordering', $max + 1);
}
}
示例3: __set
/**
* Method to set object attributes
* This method automatically updates the deprecated attributes corresponding to the definition
* @access public
* @since 2.1
* @param string $property
* @param any $value
* @return object previous value
*/
public function __set($property, $value = null)
{
$previous = parent::set($property, $value);
// updating deprecated attributes based on property name
if (array_key_exists($property, self::$deprecatedAttribs)) {
$oldAttrib = self::$deprecatedAttribs[$property];
$this->{$oldAttrib} = $value;
}
// updating aggregated attributes
if (array_key_exists($property, get_object_vars($this->jLanguageTable))) {
$this->jLanguageTable->set($property, $value);
}
if (array_key_exists($property, get_object_vars($this->jfLanguageExt))) {
$this->jfLanguageExt->set($property, $value);
}
return $previous;
}