Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Classes/Command/LinkMigrationCommandController.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ protected function gatherRecordsToMigrate($table, $listOfFields)
// The last string is optional. If it exists, it is already a 4-part record reference,
// i.e. a reference using the new syntax and which does not need to be migrated.
preg_match_all('/record:(\w+):(\w+)(:\w+)?/', $record[$field], $matches);
foreach ($matches as $index => $match) {
foreach ($matches[0] as $index => $match) {
// Consider only matches that have 3 parts (i.e. 4th part is empty)
// NOTE: although not captured, the first part is "record:"
if ($matches[3][$index] === '') {
Expand Down
11 changes: 5 additions & 6 deletions Classes/Domain/Model/RecordLink.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,11 @@ public function setRecordReference($recordReference)
if (empty($recordReference)) {
throw new \InvalidArgumentException('Record reference cannot be empty', 1457367830);
}
$referenceParts = explode(':', $recordReference);
if (count($referenceParts) === 4) {
$this->recordReference = $recordReference;
$this->configurationKey = $referenceParts[1];
$this->table = $referenceParts[2];
$this->id = (int)$referenceParts[3];
if (preg_match('/^record:(\w+):(\w+):(\d+)/', $recordReference, $matches)) {
$this->recordReference = $matches[0];
$this->configurationKey = $matches[1];
$this->table = $matches[2];
$this->id = (int)$matches[3];
} else {
throw new \InvalidArgumentException(
'Expected record reference structure is "record:key:table:id"',
Expand Down