Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 17216 | Rev 17219 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 17216 Rev 17217
Línea 182... Línea 182...
182
                }
182
                }
Línea 183... Línea 183...
183
 
183
 
Línea 184... Línea 184...
184
                $dataPost = (array) $form->getData();
184
                $dataPost = (array) $form->getData();
-
 
185
 
-
 
186
                $topic = new MicrolearningTopic();
185
 
187
                $topic->name = $dataPost['name'];
-
 
188
                $topic->description = $dataPost['description'];
-
 
189
                $topic->order = $dataPost['order'];
186
                $topic = new MicrolearningTopic();
190
                $topic->status = $dataPost['status'];        
187
                $hydrator = new ObjectPropertyHydrator();
-
 
-
 
191
                $topic->privacy = $dataPost['privacy'];
188
                $hydrator->hydrate($dataPost, $topic);
192
                $topic->type = $dataPost['type'];
189
 
193
                $topic->cost = $dataPost['cost'];
190
                $topic->company_id = $currentCompany->id;
194
                $topic->company_id = $currentCompany->id;
Línea 191... Línea 195...
191
                $topic->image = '';
195
                $topic->image = '';
Línea 431... Línea 435...
431
                    return new JsonModel([
435
                    return new JsonModel([
432
                        'success'   => false,
436
                        'success'   => false,
433
                        'data'   => $messages
437
                        'data'   => $messages
434
                    ]);
438
                    ]);
435
                }
439
                }
436
 
440
                
437
                $dataPost = (array) $form->getData();
-
 
438
 
-
 
439
                $topicMapper = MicrolearningTopicMapper::getInstance($this->adapter);
441
                $topicMapper = MicrolearningTopicMapper::getInstance($this->adapter);
440
                $topic = $topicMapper->fetchOneByUuid($id);
442
                $topic = $topicMapper->fetchOneByUuid($id);
441
 
443
                
442
                if(!$topic) {
444
                if(!$topic) {
443
                    return $this->createErrorResponse('ERROR_TOPIC_NOT_FOUND');
445
                    return $this->createErrorResponse('ERROR_TOPIC_NOT_FOUND');
444
                }
446
                }
445
 
447
                
446
                if($topic->company_id != $currentCompany->id) {
448
                if($topic->company_id != $currentCompany->id) {
447
                    return $this->createErrorResponse('ERROR_UNAUTHORIZED');
449
                    return $this->createErrorResponse('ERROR_UNAUTHORIZED');
448
                }
450
                }
Línea 449... Línea 451...
449
 
451
 
450
                $hydrator = new ObjectPropertyHydrator();
-
 
451
                // Don't create a new topic, use the existing one
-
 
Línea -... Línea 452...
-
 
452
                $dataPost = (array) $form->getData();
-
 
453
                
452
                $hydrator->hydrate($dataPost, $topic);
454
                $topic->name = $dataPost['name'] ?? $topic->name;
-
 
455
                $topic->description = $dataPost['description'] ?? $topic->description;
-
 
456
                $topic->order = $dataPost['order'] ?? $topic->order;
-
 
457
                $topic->status = $dataPost['status'] ?? $topic->status;        
453
                
458
                $topic->privacy = $dataPost['privacy'] ?? $topic->privacy;
Línea 454... Línea 459...
454
                // Ensure company_id is preserved
459
                $topic->type = $dataPost['type'] ?? $topic->type;
455
                $topic->company_id = $currentCompany->id;
460
                $topic->cost = $dataPost['cost'] ?? $topic->cost;
456
                
461
                
457
                // Update basic topic data first
462
                // Update basic topic data first