Actions
Feature #97754
openRefactoring: Add repository and data mapper for WorkspaceRecord/AbstractRecord
Status:
New
Priority:
Should have
Assignee:
-
Category:
Workspaces
Target version:
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.
Actions