/** * Method to get an object containing all of the table columns and values. * * @param JTableInterface $table JTable object. * * @return stdClass Contains all of the columns and values. * * @since 3.2 */ public function getDataObject(JTableInterface $table) { $fields = $table->getFields(); $dataObject = new stdClass(); foreach ($fields as $field) { $fieldName = $field->Field; $dataObject->{$fieldName} = $table->get($fieldName); } return $dataObject; }
/** * Method to add or update tags associated with an item. * * @param integer $ucmId Id of the #__ucm_content item being tagged * @param JTableInterface $table JTable object being tagged * @param array $tags Array of tags to be applied. * @param boolean $replace Flag indicating if all exising tags should be replaced * * @return boolean true on success, otherwise false. * * @since 3.1 */ public function tagItem($ucmId, JTableInterface $table, $tags = array(), $replace = true) { $key = $table->get('_tbl_key'); $oldTags = $this->getTagIds((int) $table->{$key}, $this->typeAlias); $oldTags = explode(',', $oldTags); $result = $this->unTagItem($ucmId, $table); if ($replace) { $newTags = $tags; } else { if ($tags == array()) { $newTags = $table->newTags; } else { $newTags = $tags; } if ($oldTags[0] != '') { $newTags = array_unique(array_merge($newTags, $oldTags)); } } if (is_array($newTags) && count($newTags) > 0 && $newTags[0] != '') { $result = $result && $this->addTagMapping($ucmId, $table, $newTags); } return $result; }