public function getAttributeValue($avID, $method = 'getValue')
 {
     $av = AttributeFormAttributeValue::getByID($avID);
     if (is_object($av)) {
         $av->setAttributeKey($this);
         return $av->{$method}();
     }
 }
 public function getAttributeValueObject($ak, $createIfNotFound = false)
 {
     $db = Database::connection();
     $av = false;
     $v = array($this->getID(), $ak->getAttributeKeyID());
     $avID = $db->GetOne("select avID from AttributeFormsAttributeValues where afID = ? and akID = ?", $v);
     if ($avID > 0) {
         $av = AttributeFormValue::getByID($avID);
         if (is_object($av)) {
             $av->setAttributeForm($this);
             $av->setAttributeKey($ak);
         }
     }
     if ($createIfNotFound) {
         $cnt = 0;
         // Is this avID in use ?
         if (is_object($av)) {
             $cnt = $db->GetOne("select count(avID) from AttributeFormsAttributeValues where avID = ?", $av->getAttributeValueID());
         }
         if (!is_object($av) || $cnt > 1) {
             $av = $ak->addAttributeValue();
         }
     }
     return $av;
 }