Project

General

Profile

Actions

Feature #97754

closed

Refactoring: Add repository and data mapper for WorkspaceRecord/AbstractRecord

Added by Oliver Klee over 2 years ago. Updated 15 days ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Workspaces
Start date:
2022-06-09
Due date:
% Done:

0%

Estimated time:
PHP Version:
Tags:
Complexity:
Sprint Focus:

Description

In \TYPO3\CMS\Workspaces\Domain\Record\WorkspaceRecord::get(), there are two patterns hidden that want to be emerge:

public static function get($uid, array $record = null)
{
if (empty($uid)) {
$record = [];
} elseif (empty($record)) {
$record = static::fetch('sys_workspace', $uid);
}
return new self($record);
}

We should refactor this to the following structures:

- (Abstract)DataMapper: has a method to convert an array (which can also be empty) of data to an AbstractRecord instance
- WorkpaceRecordMapper: extends DataMapper
- AbstractRecordRepository::getByUid: retrieves a record from the DB an creates a record model instance; uses the data mapper
- WorkspaceRecordRepository extends AbstractRecordRepository

We also should deprecate WorkspaceRecord::get() and adapt all callers to use the repository or data mapper.


Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Bug #97423: WorkspaceRecord cannot be XCLASSedClosed2022-04-18

Actions
Actions #1

Updated by Oliver Klee over 2 years ago

  • Related to Bug #97423: WorkspaceRecord cannot be XCLASSed added
Actions #2

Updated by Benni Mack over 1 year ago

  • Target version changed from 12 LTS to Candidate for Major Version
Actions #3

Updated by Oliver Bartsch 15 days ago

  • Status changed from New to Closed

Hi Oliver,

I think we should not implement such solution, since it is targeting workspaces only. We've worked in this area recently by implementing the RecordInterface with the RawRecord and Record DTOs - together with corresponding RecordFactory. We should rely on this functionality instead. I'll therefore close this for now. Please feel free to contact me if you think that this is the wrong decision.

Best, Oli

Actions

Also available in: Atom PDF