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();
     }
 }
Esempio n. 3
0
 protected function getAttributeValueID()
 {
     if (is_object($this->attributeValue)) {
         return $this->attributeValue->getAttributeValueID();
     }
 }
Esempio n. 4
0
 /**
  * Adds a generic attribute record (with this type) to the AttributeValues table
  */
 public function addAttributeValue()
 {
     $db = Loader::db();
     $u = new User();
     $dh = Loader::helper('date');
     $uID = $u->isRegistered() ? $u->getUserID() : 0;
     $avDate = $dh->getOverridableNow();
     $v = array($this->atID, $this->akID, $uID, $avDate);
     $db->Execute('insert into AttributeValues (atID, akID,  uID, avDateAdded) values (?, ?, ?, ?)', $v);
     $avID = $db->Insert_ID();
     return AttributeValue::getByID($avID);
 }
Esempio n. 5
0
 /**
  * Adds a generic attribute record (with this type) to the AttributeValues table.
  */
 public function addAttributeValue()
 {
     $db = Database::connection();
     $u = new User();
     $dh = Core::make('helper/date');
     $uID = $u->isRegistered() ? $u->getUserID() : 0;
     $avDate = $dh->getOverridableNow();
     $v = array($this->atID, $this->akID, $uID, $avDate);
     $db->executeQuery('insert into AttributeValues (atID, akID,  uID, avDateAdded) values (?, ?, ?, ?)', $v);
     $avID = $db->lastInsertId();
     return AttributeValue::getByID($avID);
 }
Esempio n. 6
0
 public function __destruct()
 {
     parent::__destruct();
     unset($this->form);
 }