1 | <?php |
||
21 | class MigrateUserFieldsTask extends BuildTask |
||
22 | { |
||
23 | protected $title = 'Migrate user fields task'; |
||
24 | |||
25 | protected $description = 'Migrate the AttendeeExtraFields to the new UserFields'; |
||
26 | |||
27 | protected $userFields; |
||
28 | protected $userFieldOption; |
||
29 | |||
30 | /** |
||
31 | * @param \SS_HTTPRequest $request |
||
32 | */ |
||
33 | public function run($request) |
||
49 | |||
50 | /** |
||
51 | * Migrate the AttendeeExtraFields to UserFields |
||
52 | */ |
||
53 | private function migrateFields() |
||
61 | |||
62 | /** |
||
63 | * Make a new UserField based on the given AttendeeExtraField |
||
64 | * |
||
65 | * @param AttendeeExtraField $attendeeField |
||
66 | */ |
||
67 | private function findOrMakeUserFieldFor(AttendeeExtraField $attendeeField) |
||
98 | |||
99 | /** |
||
100 | * Find or make an option based on the given AttendeeExtraFieldOption |
||
101 | * |
||
102 | * @param AttendeeExtraFieldOption $attendeeOption |
||
103 | * |
||
104 | * @return \DataObject|UserFieldOption |
||
105 | */ |
||
106 | private function findOrMakeUserOptionFor(AttendeeExtraFieldOption $attendeeOption) |
||
118 | |||
119 | /** |
||
120 | * Map the given field type to one of the available class names |
||
121 | * Also looks into the current mapping if the field has a new type |
||
122 | * |
||
123 | * @param $type |
||
124 | * @param null $name |
||
125 | * |
||
126 | * @return string |
||
127 | */ |
||
128 | private static function mapFieldType($type, $name = null) |
||
145 | |||
146 | /** |
||
147 | * Migrate the set values |
||
148 | */ |
||
149 | public function migrateValues() |
||
158 | |||
159 | /** |
||
160 | * Get and store the user fields list |
||
161 | * |
||
162 | * @return \DataList |
||
163 | */ |
||
164 | private function getUserFields() |
||
168 | |||
169 | /** |
||
170 | * Get and store the User field options |
||
171 | * |
||
172 | * @return \DataList |
||
173 | */ |
||
174 | private function getUserFieldOption() |
||
178 | } |
||
179 |