To reproduce:
Add a content element containing a image and add two images, save, set one image to hidden, save again, set second image to hidden and save -> the exception "There is something broken with the File References. Consider updating the Reference Index." will be thrown.
Cause:
The reference(s) are not found, because of there hidden states, which constraint is not removed inside the Fab\Vidi\Service\DataService::getRecord method.
Possible Solution:
Add a third parameter "withHidden = false" to the Fab\Vidi\Service\DataService::getRecord method, and add a remove to this restriction if set:
Additional add true as third parameter to the call inside the findFileByFileReference method:
/**
* Retrieve the File identifier.
*
* @param $fileReferenceIdentifier
* @return int
* @throws \Exception
*/
protected function findFileByFileReference($fileReferenceIdentifier)
{
$record = $this->getDataService()->getRecord(
'sys_file_reference',
[
'uid' => $fileReferenceIdentifier
],
true
);
if (empty($record)) {
throw new \Exception('There is something broken with the File References. Consider updating the Reference Index.', 1408619796);
}
$fileIdentifier = $record['uid_local'];
return $fileIdentifier;
}
Maybe also other places using getRecord should set the third parameter to true, but I can't assess it. In the end its also good to remove the hidden restriction in all cases, because EXT:media operates only in the backend.
[EDIT]
I just realized that the getRecord method is part of EXT:vidi and not EXT:media, which is also used by EXT:vidi_frontend. So removing the hidden restriction at all is maybe not the best solution.
To reproduce: Add a content element containing a image and add two images, save, set one image to hidden, save again, set second image to hidden and save -> the exception "There is something broken with the File References. Consider updating the Reference Index." will be thrown.
Cause: The reference(s) are not found, because of there hidden states, which constraint is not removed inside the Fab\Vidi\Service\DataService::getRecord method.
Possible Solution: Add a third parameter "withHidden = false" to the Fab\Vidi\Service\DataService::getRecord method, and add a remove to this restriction if set:
Additional add true as third parameter to the call inside the findFileByFileReference method:
Maybe also other places using getRecord should set the third parameter to true, but I can't assess it. In the end its also good to remove the hidden restriction in all cases, because EXT:media operates only in the backend.
[EDIT] I just realized that the getRecord method is part of EXT:vidi and not EXT:media, which is also used by EXT:vidi_frontend. So removing the hidden restriction at all is maybe not the best solution.