public function delete() { $db = Database::connection(); $db->Execute('delete from AttributeFormsAttributeValues where afID = ? and akID = ? and avID = ?', array($this->item->getID(), $this->attributeKey->getAttributeKeyID(), $this->getAttributeValueID())); // Before we run delete() on the parent object, we make sure that attribute value isn't being referenced in the table anywhere else $num = $db->GetOne('select count(avID) from AttributeFormsAttributeValues where avID = ?', array($this->getAttributeValueID())); if ($num < 1) { parent::delete(); } }
public function delete() { $db = Loader::db(); $db->Execute('delete from UserAttributeValues where uID = ? and akID = ? and avID = ?', array($this->u->getUserID(), $this->attributeKey->getAttributeKeyID(), $this->getAttributeValueID())); // Before we run delete() on the parent object, we make sure that attribute value isn't being referenced in the table anywhere else $num = $db->GetOne('select count(avID) from UserAttributeValues where avID = ?', array($this->getAttributeValueID())); if ($num < 1) { parent::delete(); } }