Review main Merged

65580[BUGFIX] Don't call ResourceFactory::getStorageObject twice

Helmut Hummel CR +2 V +2 Easy +21 −7 updated 09/06/20, 13:08

Commit message

In http://review.typo3.org/11011 a plain DB call
that fetched the storage record was replaced with
usage of StorageRepository::findByUid, which in
turn calls ResourceFactory::getStorageObject again.

This leads to all events also called twice.

To avoid this a new internal method is introduced
on StorageRepository, which only fetches the storage
row again.

Review

  • Code review CR +2 Done
    • Helmut Hummel +2
    • Benni Mack +2
    • Oli Bartsch +1
    • Oliver Klee +1
    • Andreas Kienast +1
    • Nicole Hummel +1
  • Verified V +2 Done
    • Helmut Hummel +2
    • Oli Bartsch +1
    • Nicole Hummel +1
    • Benni Mack +1
    • TYPO3com +1 CI

Issues 1

Files 2

Review log 1620

  1. Helmut Hummel uploaded patch set 1 09/04/20, 16:28

  2. TYPO3com voted on patch set 1 V -1 09/04/20, 16:39 Completed build in 10m 28s on Fri, 4 Sep, 04:39 PM Test Summary: 73206 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-5246

  3. Benni Mack commented on patch set 1 09/04/20, 16:41

    let's get it in, but also see my WIP patch pending, where I get rid of a lot of this coupling.
  4. Oli Bartsch commented on patch set 1 09/04/20, 17:05

    ResourceFactory.php:171

    Would suggest using strict type check here: $recordData !== []

    ResourceFactory.php:174

    See comment in StorageRepository.

    ResourceFactory.php:175

    Also strict type checking here.

    StorageRepository.php:83

    Could we just return empty array here? Especially because you then use null coalescing again in ResourceFactory.
  5. Helmut Hummel commented on patch set 1 09/04/20, 18:11

    ResourceFactory.php:171 Reply

    fine with me

    ResourceFactory.php:175 Reply

    fine

    StorageRepository.php:83 Reply

    if you look at the above method, it returns null as well. It does not make sense to me that a method that should return a db row returns an empty array. it should rather throw an exception, or return null. I opted for null here as otherwise I would have needed to try and catch in caller code
  6. Helmut Hummel uploaded patch set 2 09/04/20, 18:27

  7. Helmut Hummel commented on patch set 2 09/04/20, 18:28

    ResourceFactory.php:171 Reply

    Done

    ResourceFactory.php:174 Reply

    Done

    ResourceFactory.php:175 Reply

    Done

    StorageRepository.php:83 Reply

    found that an exception can indeed be thrown here, which resolves the optional array return type
  8. TYPO3com commented on patch set 1 09/04/20, 18:31 Completed build in 10m 51s on Fri, 4 Sep, 06:31 PM Test Summary: 73206 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-5247

  9. Helmut Hummel commented on patch set 2 09/04/20, 18:33

    > Patch Set 1: > > let's get it in, but also see my WIP patch pending, where I get rid of a lot of this coupling. https://review.typo3.org/c/Packages/TYPO3.CMS/+/65184 is indeed nice. I absolutely agree that the coupling needs to be removed and your effort there is highly appreciated. I almost started with refactoring the code (and am happy I didn't now knowing that you are on it already), but decided to do a low impact change first to get rid of the most annoying effect of this coupling. As you already agreed, I think as well that this low impact change is still worth getting in beforehand.
  10. Helmut Hummel uploaded patch set 3 09/04/20, 18:38

  11. TYPO3com voted on patch set 2 V +1 09/04/20, 18:39 Completed build in 12m 43s on Fri, 4 Sep, 06:39 PM Test Summary: 73205 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-5248

  12. Oli Bartsch commented on patch set 3 CR +1 09/04/20, 18:41

    StorageRepository.php:83 Reply

    Great!
  13. TYPO3com voted on patch set 3 V +1 09/04/20, 18:50 Completed build in 11m 43s on Fri, 4 Sep, 06:50 PM Test Summary: 73206 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-5249

  14. Benni Mack voted on patch set 3 V +1 CR +2 09/04/20, 20:19

  15. Oli Bartsch voted on patch set 3 V +1 09/05/20, 07:20

  16. Andreas Kienast voted on patch set 3 CR +1 09/05/20, 09:51

  17. Oliver Klee voted on patch set 3 CR +1 09/05/20, 10:52

  18. Nicole Hummel voted on patch set 3 V +1 CR +1 09/06/20, 12:31

  19. Helmut Hummel voted on patch set 3 V +2 CR +2 09/06/20, 13:08

  20. Helmut Hummel merged patch set 4 09/06/20, 13:08