| Conditions | 2 |
| Paths | 2 |
| Total Lines | 21 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| 1 | <?php |
||
| 24 | public function soloUpdateAction() |
||
| 25 | { |
||
| 26 | |||
| 27 | $name = $this->request->getPost('name', 'string'); |
||
| 28 | //Cr�er la fonction variable 'set' en fonction du name en POST |
||
| 29 | $func = 'set' . ucfirst($name); |
||
| 30 | $projet = call_user_func($this->model . '::findFirst', $_POST['pk']); |
||
| 31 | $projet->$func($_POST['value']); |
||
| 32 | $projet->save(); |
||
| 33 | |||
| 34 | //Update l'avancement de la usecase lors de changements sur une usecase |
||
| 35 | $avancementTotal = 0; |
||
| 36 | $usecase = Usecase::findFirst("code='" . $projet->getCodeUseCase() . "'"); |
||
| 37 | $taches = Tache::find("codeUseCase LIKE '" . $projet->getCodeUseCase() . "'"); |
||
| 38 | foreach ($taches as $tache) { |
||
| 39 | $avancementTotal += $tache->getAvancement(); |
||
| 40 | } |
||
| 41 | $avancementTotal = $avancementTotal / count($taches); |
||
| 42 | $usecase->setAvancement($avancementTotal); |
||
| 43 | $usecase->save(); |
||
| 44 | } |
||
| 45 | } |
||
| 47 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.