Review main Abandoned

59853[FEATURE] Limit restriction to table/s in QueryBuilder

Manuel Selbach CR 0 V 0 Hard +676 −22 updated 03/30/20, 19:47

Commit message

With this feature it is possible to limit a restriction to a given
table during the construct of the restriction.

Example:

$queryBuilder->getRestrictions()->add(
    GeneralUtility::makeInstance(HiddenRestriction::class, ['sys_language'])
);

Review

  • Code review CR 0
  • Verified V 0

Issues 1

Files 27

Show 7 more files

Review log 3043

Show 1218 earlier messages
  1. Manuel Selbach uploaded patch set 1 03/04/19, 21:08

  2. TYPO3com voted on patch set 1 V -1 03/04/19, 21:13 Completed build in 32s on Mon, 4 Mar, 10:13 PM Test Summary: No tests found Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-32526

  3. Manuel Selbach uploaded patch set 2 03/04/19, 21:28

  4. TYPO3com voted on patch set 2 V -1 03/04/19, 21:28 Completed build in 12s on Mon, 4 Mar, 10:28 PM Test Summary: No tests found Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-32527

  5. Manuel Selbach uploaded patch set 3 03/04/19, 21:36

  6. TYPO3com voted on patch set 3 V +1 03/04/19, 21:46 Completed build in 09m 44s on Mon, 4 Mar, 10:46 PM Test Summary: 46884 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-32528

  7. Soren Malling commented on patch set 3 03/05/19, 10:19

    Be aware that a new DocumentTypeExclusion restriction class has been introduced in master since your latest changeset
  8. Manuel Selbach uploaded patch set 4 03/05/19, 12:08

  9. Manuel Selbach commented on patch set 4 03/05/19, 12:10

    > Patch Set 3: > > Be aware that a new DocumentTypeExclusion restriction class has been introduced in master since your latest changeset Thanks for the hint. I also added a test for that one.
  10. TYPO3com voted on patch set 4 V +1 03/05/19, 12:23 Completed build in 15m 06s on Tue, 5 Mar, 01:23 PM Test Summary: 46896 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-32533

  11. Soren Malling wrote 03/05/19, 12:24

    Removed reviewer Soren Malling.
  12. Manuel Selbach uploaded patch set 5 03/14/19, 20:06

  13. TYPO3com voted on patch set 5 V +1 03/14/19, 20:22 Completed build in 15m 22s on Thu, 14 Mar, 09:22 PM Test Summary: 47284 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-32736

  14. Manuel Selbach uploaded patch set 6 03/14/19, 20:33

  15. TYPO3com voted on patch set 6 V +1 03/14/19, 20:51 Completed build in 17m 33s on Thu, 14 Mar, 09:51 PM Test Summary: 47284 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-32739

  16. Manuel Selbach wrote 03/15/19, 09:17

    Topic set to persistence
  17. Jörg Bösche commented on patch set 6 CR -1 04/09/19, 07:17

    AbstractQueryRestriction.php:25

    Should be string[]. A list of tableNames.

    BackendWorkspaceRestriction.php:42

    Should be string[]. A list of tableNames.

    DocumentTypeExclusionRestriction.php:33

    Should be string[]. A list of tableNames.

    EndTimeRestriction.php:33

    Should be string[]. A list of tableNames.

    FrontendGroupRestriction.php:36

    Should be string[]. A list of tableNames.

    FrontendWorkspaceRestriction.php:48

    array or null? Should be string[]. A list of tableNames.

    RootLevelRestriction.php:33

    Should be string[]. A list of tableNames.

    StartTimeRestriction.php:28

    Should be string[]. A list of tableNames.

    WorkspaceRestriction.php:45

    Should be string[]. A list of tableNames.

    Feature-87776-LimitRestrictionToTablesInQueryBuilder.rst:65

    Should be string[]. A list of tableNames.
  18. Tobi Kretschmann commented on patch set 6 04/09/19, 08:00

    AbstractQueryRestriction.php:41 Unresolved

    please add the third param for strict type comparison

    AbstractRestrictionContainerTest.php:36

    is the string key necessary?
  1. Manuel Selbach commented on patch set 6 04/09/19, 10:17

    AbstractRestrictionContainerTest.php:36 Reply Unresolved

    Yes, as this is the input of queried tables where the string key may be the alias.
  2. Manuel Selbach rebased onto patch set 7 04/09/19, 10:19

  3. Manuel Selbach uploaded patch set 8 04/09/19, 10:22

  4. TYPO3com voted on patch set 7 V +1 04/09/19, 10:31 Completed build in 11m 47s on Tue, 9 Apr, 12:31 PM Test Summary: 47351 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-33132

  5. TYPO3com voted on patch set 8 V +1 04/09/19, 10:39 Completed build in 16m 22s on Tue, 9 Apr, 12:39 PM Test Summary: 47351 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-33133

  6. Jörg Bösche voted on patch set 8 V +1 CR +1 04/09/19, 11:20

  7. Anja Leichsenring commented on patch set 8 V +1 04/23/19, 19:09

    AbstractQueryRestriction.php:26 Unresolved

    an explanation what this array does, especially if empty, would probably be a good idea.

    AbstractQueryRestriction.php:27 Unresolved

    `restrictedTables` might be a more fitting name. If set, the restriction will apply to this tables.

    AbstractQueryRestriction.php:36

    isEmpty() maybe?

    Feature-87776-LimitRestrictionToTablesInQueryBuilder.rst:26 Unresolved

    this is a pretty bad example, as the table does not exist anymore. Can you come up with something more recent and therefor relevant, please?

    Feature-87776-LimitRestrictionToTablesInQueryBuilder.rst:56 Unresolved

    form -> from. The sentence in whole is not really good to read and understand.

    Feature-87776-LimitRestrictionToTablesInQueryBuilder.rst:63 Unresolved

    can you spare this example a class name? Mentioning that you talk about custom Restriction classes might also be a good idea.

    AbstractRestrictionContainerTest.php:37 Unresolved

    you can skip the shouldBeCalled() when you ask for a return. One is enough.

    BackendWorkspaceRestrictionTest.php:96 Unresolved

    the r of restricted wants to be upper case. Look, it's sad.
  8. Anja Leichsenring voted on patch set 8 CR -1 04/23/19, 19:10

  9. Manuel Selbach rebased onto patch set 9 04/25/19, 20:37

  10. Manuel Selbach uploaded patch set 10 04/25/19, 20:38

  11. Manuel Selbach commented on patch set 10 04/25/19, 20:46

    AbstractQueryRestriction.php:36 Reply Unresolved

    Is it necessary to check with "empty()" in that case? Should we also array_filter() on that property to remove all "empty" values before then?
  12. TYPO3com voted on patch set 9 V +1 04/25/19, 20:53 Completed build in 15m 50s on Thu, 25 Apr, 10:53 PM Test Summary: 47572 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-33450

  13. TYPO3com voted on patch set 10 V +1 04/25/19, 20:53 Completed build in 14m 57s on Thu, 25 Apr, 10:53 PM Test Summary: 47572 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-33451

  14. Manuel Selbach uploaded patch set 11 05/02/19, 08:45

  15. Manuel Selbach uploaded patch set 12 05/02/19, 08:48

  16. TYPO3com voted on patch set 11 V +1 05/02/19, 08:57 Completed build in 11m 25s on Thu, 2 May, 10:57 AM Test Summary: 47559 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-33687

  17. TYPO3com voted on patch set 12 V +1 05/02/19, 09:03 Completed build in 14m 32s on Thu, 2 May, 11:03 AM Test Summary: 47559 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-33688

  18. Anja Leichsenring commented on patch set 12 05/19/19, 07:19

    Feature-87776-LimitRestrictionToTablesInQueryBuilder.rst:54 Unresolved

    a 'k' ran away here, also in line 90.
  19. Anja Leichsenring commented on patch set 13 05/19/19, 07:24

    Published edit on patch set 12.
  20. Anja Leichsenring voted on patch set 13 V +1 CR +1 05/19/19, 07:24

  21. TYPO3com voted on patch set 13 V -1 05/19/19, 07:37 Completed build in 13m 08s on Sun, 19 May, 09:37 AM Test Summary: 1 of 46190 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-33925

  22. Helmut Hummel commented on patch set 13 CR -1 05/19/19, 09:48

    Thanks for working on improving the restrictions API Before I can go into a more depth review, I would like to know very concrete use cases. Otherwise it is hard to make alternative suggestions. My first impression of this change is, that it is rather very impactful with not too much benefit. I think we can achieve the same goal without such big impact.

    QueryRestrictionContainerInterface.php:25

    The intention of QueryRestrictionContainerInterface extending QueryRestrictionInterface was making it possible to add restriction containers as restrictions. This is very useful and is used in FAL SearchQuery extensively. Removing this inheritance is not only a breaking change, it removes the possibility to conveniently group restrictions.
  23. Helmut Hummel commented on patch set 13 05/20/19, 12:49

    I created an alternative suggestion here: https://review.typo3.org/60781 It adds the possibility to on query level decide which restrictions should be applied to which table aliases. It does not add convenience for restriction implementers to specify tables in a property to which the implemented restriction should be applied to. This convenience could be added, but should not be added by implementing a base abstract class, but rather by a interface/trait combination. The reason for that is, that we don't want to couple all restrictions to a base class even if they don't need the behavior and it might be useful for restrictions to select from a set of behaviors, which would not be possible with a single inheritance structure. I opted against implementing the interface/trait, because the implementation of this behavior can easily be implemented in each restriction that needs it with adding a single "if" and the reasons *WHY* certain restrictions might want their restrictions only to be applied to certain tables might differ significantly and could be a more complicated check where static definition in a property might not suffice. I'm looking forward to hear what you think about my implementation and my comments.
  24. Anja Leichsenring wrote 09/09/19, 08:42

    Removed reviewer Anja Leichsenring with the following votes: * Verified+1 by Anja Leichsenring <aleichsenring@ab-softlab.de> * Code-Review+1 by Anja Leichsenring <aleichsenring@ab-softlab.de>
  25. Manuel Selbach abandoned the change 03/30/20, 19:47

    We want to go with the implementation introduced with https://review.typo3.org/c/Packages/TYPO3.CMS/+/60781