/** * {@inheritdoc} */ public function delete(IMetaModelItem $objItem) { $arrIds = array($objItem->get('id')); // determine if the model is a variant base and if so, fetch the variants additionally. if ($objItem->isVariantBase()) { $objVariants = $objItem->getVariants(new MetaModelFilter($this)); foreach ($objVariants as $objVariant) { $arrIds[] = $objVariant->get('id'); } } // complex attributes shall delete their values first. foreach ($this->getAttributes() as $objAttribute) { if ($this->isComplexAttribute($objAttribute)) { // complex saving $objAttribute->unsetDataFor($arrIds); } } // now make the real row disappear. Database::getInstance()->execute(sprintf('DELETE FROM %s WHERE id IN (%s)', $this->getTableName(), implode(',', $arrIds))); }
/** * {@inheritdoc} */ public function generateFilterUrlFrom(IMetaModelItem $objItem, IMetaModelRenderSettings $objRenderSetting) { $objAttribute = $this->getMetaModel()->getAttributeById($this->get('attr_id')); if ($objAttribute) { // TODO: shall we omit returning of empty values? $strResult = $objAttribute->getFilterUrlValue($objItem->get($objAttribute->getColName())); return array($this->getParamName() => $strResult); } }