/**
  * returns the right CustomFieldValuexxx object but this method can be used
  * in those occasions when we know the fieldId but we do not know its type so what we need to do
  * is first load the field definition and then work on creating the right object type
  *
  * @param fieldId
  * @param row An array
  * @see getCustomFieldValueObject
  */
 function getCustomFieldValueByFieldId($fieldId, $row)
 {
     // load the field definition first
     $customFields = new CustomFields();
     $customField = $customFields->getCustomField($fieldId);
     if (!$customField) {
         return false;
     }
     // if everything went fine, then continue
     $row["field_id"] = $fieldId;
     $row["field_type"] = $customField->getType();
     $row["field_description"] = $customField->getDescription();
     $row["field_name"] = $customField->getName();
     $fieldValueObject = CustomFieldValueFactory::getCustomFieldValueObject($row);
     return $fieldValueObject;
 }
 /**
  * @private
  */
 function _getArticleCustomFields()
 {
     // prepare the custom fields
     $fields = array();
     if (is_array($this->_customFields)) {
         foreach ($this->_customFields as $fieldId => $fieldValue) {
             // 3 of those parameters are not really need when creating a new object... it's enough that
             // we know the field definition id.
             $row = array("field_id" => $fieldId, "field_value" => $fieldValue, "field_name" => "", "field_type" => -1, "field_description" => "", "article_id" => -1, "blog_id" => $this->_blogInfo->getId(), "id" => -1);
             // let's get the right value
             $customField = CustomFieldValueFactory::getCustomFieldValueByFieldId($fieldId, $row);
             $fieldName = $customField->getName();
             $fields["{$fieldName}"] = $customField;
         }
     }
     return $fields;
 }
 /**
  * @private
  */
 function _fillCustomFieldValueInformation($row)
 {
     return CustomFieldValueFactory::getCustomFieldValueObject($row);
 }