public function getAttributeValue($avID, $method = 'getValue') { $av = CollectionAttributeValue::getByID($avID); if (is_object($av)) { $av->setAttributeKey($this); $value = $av->{$method}(); $av->__destruct(); unset($av); return $value; } }
public function getAttributeValue($avID, $method = 'getValue') { $av = CollectionAttributeValue::getByID($avID); if (is_object($av)) { $av->setAttributeKey($this); $value = call_user_func_array(array($av, $method), array()); $av->__destruct(); unset($av); return $value; } }
public function getAttributeValueObject($ak, $createIfNotFound = false) { $db = Loader::db(); $av = false; $v = array($this->getCollectionID(), $this->getVersionID(), $ak->getAttributeKeyID()); $avID = $db->GetOne("select avID from CollectionAttributeValues where cID = ? and cvID = ? and akID = ?", $v); if ($avID > 0) { $av = CollectionAttributeValue::getByID($avID); if (is_object($av)) { $av->setCollection($this); $av->setAttributeKey($ak); } } if ($createIfNotFound) { $cnt = 0; // Is this avID in use ? if (is_object($av)) { $cnt = $db->GetOne("select count(avID) from CollectionAttributeValues where avID = ?", $av->getAttributeValueID()); } if ((!is_object($av)) || ($cnt > 1)) { $av = $ak->addAttributeValue(); } } return $av; }