private function findOrMakeUserFieldFor(AttendeeExtraField $attendeeField)
    {
        if (!$field = $this->getUserFields()->byID($attendeeField->ID)) {
            /** @var UserField $field */
            $class = self::mapFieldType($attendeeField->FieldType, $attendeeField->FieldName);
            $field = $class::create();
        }

        $field->ClassName = self::mapFieldType($attendeeField->FieldType, $attendeeField->FieldName);
        $field->ID = $attendeeField->ID;
        $field->Name = $attendeeField->FieldName;
        $field->Title = $attendeeField->Title;
        $field->Default = $attendeeField->DefaultValue;
        $field->ExtraClass = $attendeeField->ExtraClass;
        $field->Required = $attendeeField->Required;
        $field->Editable = $attendeeField->Editable;
        $field->EventID = $attendeeField->EventID;
        $field->Sort = $attendeeField->Sort;

        if ($attendeeField->Options()->exists() && $field->ClassName === 'UserOptionSetField') {
            /** @var \UserOptionSetField $field */
            /** @var AttendeeExtraFieldOption $attendeeOption */
            foreach ($attendeeField->Options() as $option) {
                $field->Options()->add($this->findOrMakeUserOptionFor($option));
                echo "[{$field->ID}] Added AttendeeExtraFieldOption as UserFieldOption\n";
            }
        }

        $field->write();
        echo "[{$field->ID}] Migrated AttendeeExtraField to $field->ClassName\n";
    }
private function findOrMakeUserFieldFor(AttendeeExtraField $attendeeField)
    {
        if (!$field = $this->getUserFields()->byID($attendeeField->ID)) {
            /** @var UserField $field */
            $class = self::mapFieldType($attendeeField->FieldType, $attendeeField->FieldName);
            $field = $class::create();
        }

        $field->ClassName = self::mapFieldType($attendeeField->FieldType, $attendeeField->FieldName);
        $field->ID = $attendeeField->ID;
        $field->Name = $attendeeField->FieldName;
        $field->Title = $attendeeField->Title;
        $field->Default = $attendeeField->DefaultValue;
        $field->ExtraClass = $attendeeField->ExtraClass;
        $field->Required = $attendeeField->Required;
        $field->Editable = $attendeeField->Editable;
        $field->EventID = $attendeeField->EventID;
        $field->Sort = $attendeeField->Sort;

        if ($attendeeField->Options()->exists() && $field->ClassName === 'UserOptionSetField') {
            /** @var \UserOptionSetField $field */
            /** @var AttendeeExtraFieldOption $attendeeOption */
            foreach ($attendeeField->Options() as $option) {
                $field->Options()->add($this->findOrMakeUserOptionFor($option));
                echo "[{$field->ID}] Added AttendeeExtraFieldOption as UserFieldOption\n";
            }
        }

        $field->write();
        echo "[{$field->ID}] Migrated AttendeeExtraField to $field->ClassName\n";
    }
private function findOrMakeUserFieldFor ( AttendeeExtraField $ attendeeField ) { if ( ! $ field = $ this -> getUserFields ( ) -> byID ( $ attendeeField -> ID ) ) { /** @var UserField $field */ $ class = self :: mapFieldType ( $ attendeeField -> FieldType , $ attendeeField -> FieldName ) ; $ field = $ class :: create ( ) ; } $ field -> ClassName = self :: mapFieldType ( $ attendeeField -> FieldType , $ attendeeField -> FieldName ) ; $ field -> ID = $ attendeeField -> ID ; $ field -> Name = $ attendeeField -> FieldName ; $ field -> Title = $ attendeeField -> Title ; $ field -> Default = $ attendeeField -> DefaultValue ; $ field -> ExtraClass = $ attendeeField -> ExtraClass ; $ field -> Required = $ attendeeField -> Required ; $ field -> Editable = $ attendeeField -> Editable ; $ field -> EventID = $ attendeeField -> EventID ; $ field -> Sort = $ attendeeField -> Sort ; if ( $ attendeeField -> Options ( ) -> exists ( ) && $ field -> ClassName === 'UserOptionSetField' ) { /** @var \UserOptionSetField $field */ /** @var AttendeeExtraFieldOption $attendeeOption */ foreach ( $ attendeeField -> Options ( ) as $ option ) { $ field -> Options ( ) -> add ( $ this -> findOrMakeUserOptionFor ( $ option ) ) ; echo "[{$field->ID}] Added AttendeeExtraFieldOption as UserFieldOption\n" ; } } $ field -> write ( ) ; echo "[{$field->ID}] Migrated AttendeeExtraField to $field->ClassName\n" ; }
Make a new UserField based on the given AttendeeExtraField

@param AttendeeExtraField $attendeeField
Make a new UserField based on the given AttendeeExtraField