Review main Merged

51148[TASK] Introduce abstract class AbstractAjaxController

Mona Muzaffar CR +2 V +2 Normal +75 −59 updated 01/09/17, 16:25

Commit message

Extract duplicate code in method and let FormFlexAjaxController
and FormInlineAjaxController extend from abstract class.

Review

  • Code review CR +2
    • Anja Leichsenring +2
    • Daniel Goerz +1
    • Christian Kuhn +1
  • Verified V +2
    • Anja Leichsenring +2
    • Christian Kuhn +1
    • TYPO3com +1 CI

Issues 1

Files 3

Review log 2633

Show 68 earlier messages
  1. Mona Muzaffar uploaded patch set 1 01/05/17, 12:12

  2. TYPO3com voted on patch set 1 V -1 01/05/17, 12:16 Completed build in 04m 37s on Thu, 5 Jan, 01:16 PM Test Summary: 54907 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-6226

  3. Mona Muzaffar uploaded patch set 2 01/05/17, 12:27

  4. Christian Kuhn commented on patch set 1 01/05/17, 12:29

    good you changed that, AbstractFormEngineAjaxController is a good name. You could remove that line from the commit message however, it gives no additional value in the commit of the final patch version.

    AbstractFormEngineAjaxController.php:20

    please give it some description - the method basically takes the result array from the render part of FormEngine, looks at array 'requireJsModules' and creates a string that advises JS to load those potentially newly registered js modules and evals() them in js later.

    AbstractFormEngineAjaxController.php:24

    createExecutableStringRepresentationOfRegisteredRequireJsModules() ... maybe as method name, if you don't find something shorter.
  5. TYPO3com voted on patch set 2 V +1 01/05/17, 12:32 Completed build in 04m 20s on Thu, 5 Jan, 01:32 PM Test Summary: 54907 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-6227

  6. Christian Müllenhagen commented on patch set 2 01/05/17, 13:03

    I think this method should not be part of a Controller as it does some kind of business logic. And choose composition over inheritance. So better move it to a class like "RequireJsModuleWriter" and name the method something like "writeExecutableModule".
  7. Christian Kuhn commented on patch set 2 01/05/17, 13:48

    No Christian. This is imho the correct place for the code for now. In long run, this will probably change again, but not now.
  8. Christian Müllenhagen commented on patch set 2 01/05/17, 14:14

    Hey Christian. I do not understand your point. Why is the controller the correct place for business/view logic? And what means "for now"? In a separate (not abstract) class, the method would be much easier to test ...
  1. Mona Muzaffar uploaded patch set 3 01/05/17, 14:18

  2. TYPO3com voted on patch set 3 V +1 01/05/17, 14:22 Completed build in 04m 00s on Thu, 5 Jan, 03:22 PM Test Summary: 54907 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-6229

  3. Christian Kuhn commented on patch set 3 01/05/17, 14:31

    @christian: I do not want to have that code extracted at the moment since what the JS side currently does is to "eval()" that stuff. this is rather ugly and i think we'll have something different in the end when the whole js area in formEngine evolves further (currently every patch in there improves the situation a bit). Moving that helper code to an own class would expose that code as API, which is a thing that i don't want at the moment since that implementation will likely change later again. Thus, we'll go for the abstract for now and will then see how and if that abstract class evolves the next month to take a good decision on it if time is ready. We'll probably mark that abstract as "internal, do not re-use" for that reason, so we don't have to cope with b/w compat issues for now.
  4. Christian Müllenhagen commented on patch set 3 01/05/17, 14:57

    Makes sense. Thanks for the explanation!
  5. Anja Leichsenring voted on patch set 3 CR +1 V +1 01/05/17, 15:31

  6. Daniel Goerz commented on patch set 3 01/05/17, 16:11

    AbstractFormEngineAjaxController.php:18

    Don't we always use class annotations to describe whats going on?

    AbstractFormEngineAjaxController.php:30

    I am no fan of conditons that wrap a whole method. Rather turn it around for an early return. if (empty($result['requireJsModules'])) { return ''; }

    AbstractFormEngineAjaxController.php:54

    This does not seem right. You override the $return varibale in each iteration. Is this wanted?
  7. Christian Kuhn commented on patch set 3 CR -1 01/05/17, 23:32

    temporary -1 for now. will review and probably push a new patch set tomorrow.
  8. Christian Kuhn commented on patch set 3 01/07/17, 11:26

    AbstractFormEngineAjaxController.php:18 Reply

    Done

    AbstractFormEngineAjaxController.php:30 Reply

    Done

    AbstractFormEngineAjaxController.php:54 Reply

    true. not fixed, yet. Mona, would you like to have a look at that again?
  9. Christian Kuhn uploaded patch set 4 01/07/17, 11:27

  10. Christian Kuhn commented on patch set 3 01/07/17, 11:27

    Fixed two comments by Daniel, but one issue is still left open. Mona, would you like to have a look at the remaining issue?
  11. TYPO3com voted on patch set 4 V +1 01/07/17, 11:31 Completed build in 04m 13s on Sat, 7 Jan, 12:31 PM Test Summary: 54907 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-6258

  12. Christian Müllenhagen commented on patch set 4 01/08/17, 14:25

    AbstractFormEngineAjaxController.php:37

    This will now always be true. Anyway, as the returned $result is completely different to the given $result, one of them should be renamed. I suggest the given one.

    AbstractFormEngineAjaxController.php:49

    If you just want the first key and value, you can use $callback = reset($module); $moduleName = key($module);
  13. Mona Muzaffar commented on patch set 4 01/09/17, 08:06

    > Fixed two comments by Daniel, but one issue is still left open. > Mona, would you like to have a look at the remaining issue? Sure I will work on it today.
  14. Daniel Goerz commented on patch set 4 CR -1 01/09/17, 08:21

    AbstractFormEngineAjaxController.php:37 Reply

    Yes, the varibale inside the method was named $return before. Dont't know why Christian changed it. But I agree that $result is not a good name for the argument at all.
  15. Mona Muzaffar uploaded patch set 5 01/09/17, 11:24

  16. TYPO3com voted on patch set 5 V +1 01/09/17, 11:28 Completed build in 04m 03s on Mon, 9 Jan, 12:28 PM Test Summary: 54921 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-6321

  17. Daniel Goerz commented on patch set 5 01/09/17, 11:30

    AbstractFormEngineAjaxController.php:62

    So, now we are adding stuff to the array that is passed into the function. Is this the intended behavior?
  18. Mona Muzaffar uploaded patch set 6 01/09/17, 16:01

  19. TYPO3com voted on patch set 6 V -1 01/09/17, 16:04 Completed build in 03m 34s on Mon, 9 Jan, 05:04 PM Test Summary: 54921 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-6340

  20. Mona Muzaffar uploaded patch set 7 01/09/17, 16:18

  21. Christian Kuhn voted on patch set 7 CR +1 V +1 01/09/17, 16:19

  22. Daniel Goerz voted on patch set 7 CR +1 01/09/17, 16:23

  23. TYPO3com voted on patch set 7 V +1 01/09/17, 16:25 Completed build in 06m 48s on Mon, 9 Jan, 05:25 PM Test Summary: 54921 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-6341

  24. Anja Leichsenring voted on patch set 7 CR +2 V +2 01/09/17, 16:25

  25. Gerrit merged patch set 7 01/09/17, 16:25