/** * 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); } } }
/** * 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); } }
/** * 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; }