Skip to content
  • Benni Mack's avatar
    [BUGFIX] Do not check for pid=-1 when evaluating workspace records · a6363e85
    Benni Mack authored and Susanne Moog's avatar Susanne Moog committed
    TYPO3 Core handles the result of database queries in a lot of different
    ways to filter out workspace records.
    
    With "versioning support v1" (= without workspaces), the identifier was
    usually "pid = -1" to filter out records that should not be displayed in
    live results.
    
    With workspaces, there are other, better ways to identify versioned via
    the following fields:
    - t3ver_state (what kind of versioned record is there)
    - t3ver_oid (if the versioned record points to a live record)
    - t3ver_wsid (the workspace ID)
    
    The "pid" field was kept as misuse, but fine for most of the database
    queries. Since we now have Doctrine DBAL, and Restrictions, the Core
    API can now be unified to actually check for "t3ver_oid>0" instead of
    "pid<>-1" to identify a versioned record.
    
    All places in TYPO3 Core now does not check for "pid<>-1" anymore for
    tables that are workspace-aware.
    
    In the future, it is then possible to get rid of the "pid=-1" value when
    writing versioned records, streamlining the API effectively, to find one
    proper way to query and write records.
    
    This change does not modify any other places in TYPO3 Core where
    Workspace Records are written, but only cleans up the API to only
    consider "t3ver_oid" instead of "pid", avoiding the mis-use of "pid".
    
    Most queries can then be handled by simply checking:
    - t3ver_wsid=0 AND deleted=0 for only fetching live records
    - t3ver_wsid IN (0,12) AND t3ver_oid=0 to find all live records,
      and draft placeholders, to do overlays then
    
    Resolves: #89122
    Releases: master
    Change-Id: I781d1ae440fe944e6c8c99d02884a6eb0c1be0a7
    Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/61641
    
    
    Tested-by: default avatarOliver Hader <oliver.hader@typo3.org>
    Tested-by: default avatarTYPO3com <noreply@typo3.com>
    Tested-by: default avatarSusanne Moog <look@susi.dev>
    Reviewed-by: default avatarOliver Hader <oliver.hader@typo3.org>
    Reviewed-by: default avatarSusanne Moog <look@susi.dev>
    a6363e85