74 public function __construct(array $fileReferenceData, $factory =
null)
76 $this->propertiesOfFileReference = $fileReferenceData;
77 if (!$fileReferenceData[
'uid_local']) {
78 throw new \InvalidArgumentException(
'Incorrect reference to original file given for FileReference.', 1300098528);
80 $this->originalFile = $this->
getFileObject((
int)$fileReferenceData[
'uid_local'], $factory);
81 $this->name = $fileReferenceData[
'name'] !==
'' ? $fileReferenceData[
'name'] : $this->originalFile->getName();
93 if ($factory ===
null) {
97 return $factory->getFileObject($uidLocal);
124 throw new \InvalidArgumentException(
'Property "' . $key .
'" was not found in file reference or original file.', 1314226805);
127 return $properties[$key];
139 if (!array_key_exists($key, $this->propertiesOfFileReference)) {
140 throw new \InvalidArgumentException(
'Property "' . $key .
'" of file reference was not found.', 1360684914);
142 return $this->propertiesOfFileReference[$key];
152 if (empty($this->mergedProperties)) {
155 $this->mergedProperties,
156 $this->originalFile->getProperties(),
161 array_walk($this->mergedProperties, [$this,
'restoreNonNullValuesCallback']);
175 if (array_key_exists($key, $this->propertiesOfFileReference) && $this->propertiesOfFileReference[$key] !==
null) {
176 $value = $this->propertiesOfFileReference[$key];
197 return $this->originalFile->getName();
245 return $this->propertiesOfFileReference[
'link'];
255 return (
int)$this->propertiesOfFileReference[
'uid'];
265 return (
int)$this->originalFile->getSize();
275 return $this->originalFile->getSha1();
285 return $this->originalFile->getExtension();
295 return $this->originalFile->getNameWithoutExtension();
305 return $this->originalFile->getMimeType();
315 return (
int)$this->originalFile->getModificationTime();
325 return (
int)$this->originalFile->getCreationTime();
335 return (
int)$this->originalFile->getType();
345 return (
bool)$this->originalFile->getProperty(
'missing');
358 return $this->originalFile->getContents();
382 return $this->originalFile->getStorage();
392 return $this->originalFile->getIdentifier();
402 return $this->originalFile->getCombinedIdentifier();
411 public function delete()
415 throw new \BadMethodCallException(
'Function not implemented FileReference::delete().', 1333754461);
429 throw new \BadMethodCallException(
'Function not implemented FileReference::rename().', 1333754473);
445 public function getPublicUrl($relativeToCurrentScript =
false)
447 return $this->originalFile->getPublicUrl($relativeToCurrentScript);
473 return $this->originalFile->getForLocalProcessing($writable);
484 $array = array_merge($this->originalFile->toArray(), $this->propertiesOfFileReference);
526 $keys = get_object_vars($this);
527 unset($keys[
'originalFile'], $keys[
'mergedProperties']);
528 return array_keys($keys);
533 $factory = GeneralUtility::makeInstance(ResourceFactory::class);
535 (
int)$this->propertiesOfFileReference[
'uid_local'],