public function getAttributeValue($avID, $method = 'getValue') { $av = FileAttributeValue::getByID($avID); if (is_object($av)) { $av->setAttributeKey($this); return $av->{$method}(); } }
public function getAttributeValue($avID, $method = 'getValue') { $av = FileAttributeValue::getByID($avID); if (is_object($av)) { $av->setAttributeKey($this); return call_user_func_array(array($av, $method), array()); } }
public function getAttributeValueObject($ak, $createIfNotFound = false) { $db = Loader::db(); $av = false; $v = array($this->getFileID(), $this->getFileVersionID(), $ak->getAttributeKeyID()); $avID = $db->GetOne("select avID from FileAttributeValues where fID = ? and fvID = ? and akID = ?", $v); if ($avID > 0) { $av = FileAttributeValue::getByID($avID); if (is_object($av)) { $av->setFile($this->getFile()); $av->setAttributeKey($ak); } } if ($createIfNotFound) { $cnt = 0; // Is this avID in use ? if (is_object($av)) { $cnt = $db->GetOne("select count(avID) from FileAttributeValues where avID = ?", $av->getAttributeValueID()); } if ((!is_object($av)) || ($cnt > 1)) { $av = $ak->addAttributeValue(); } } return $av; }