/**
  * Create field description.
  * It is used in feeds and their derivatives.
  */
 public function createFieldDescription()
 {
     if ($this->isActive) {
         if (!($f = $this->dataDescription->getFieldDescriptionByName('attachments'))) {
             $f = new FieldDescription('attachments');
             $this->dataDescription->addFieldDescription($f);
         }
         $f->setType(FieldDescription::FIELD_TYPE_CUSTOM);
     }
 }
Exemple #2
0
 /**
  * Create field description.
  */
 public function createFieldDescription()
 {
     if ($this->isActive) {
         if (!($fd = $this->dataDescription->getFieldDescriptionByName('tags'))) {
             $fd = new FieldDescription('tags');
             $this->dataDescription->addFieldDescription($fd);
         }
         $fd->setType(FieldDescription::FIELD_TYPE_TEXTBOX_LIST)->setProperty('url', 'tag-autocomplete')->setProperty('separator', TagManager::TAG_SEPARATOR);
     }
 }
 /**
  * Intersect this data description with other object data description.
  *
  * @param DataDescription $otherDataDescr Other data description.
  * @return DataDescription
  */
 public function intersect(DataDescription $otherDataDescr)
 {
     $result = false;
     if ($this->isEmpty()) {
         $result = $otherDataDescr;
     } else {
         // проходимся по описаниям полей текущего объекта
         foreach ($this->fieldDescriptions as $fieldName => $fieldDescription) {
             // если существует описание из БД - пересекаем с ним
             if ($otherDataDescr->getFieldDescriptionByName($fieldName)) {
                 $this->fieldDescriptions[$fieldName] = FieldDescription::intersect($this->fieldDescriptions[$fieldName], $otherDataDescr->getFieldDescriptionByName($fieldName));
             } else {
                 $this->getFieldDescriptionByName($fieldName)->setProperty('customField', 'customField');
             }
         }
         $result = $this;
     }
     return $result;
 }