2 namespace TYPO3\CMS\Core\Resource;
81 public function __construct(array $fileReferenceData, $factory = null)
83 $this->propertiesOfFileReference = $fileReferenceData;
84 if (!$fileReferenceData[
'uid_local']) {
85 throw new \InvalidArgumentException(
'Incorrect reference to original file given for FileReference.', 1300098528);
91 $this->originalFile = $factory->getFileObject($fileReferenceData[
'uid_local']);
92 if (!is_object($this->originalFile)) {
93 throw new \RuntimeException(
94 'Original file not found for FileReference. UID given: "' . $fileReferenceData[
'uid_local'] .
'"',
98 $this->name = $fileReferenceData[
'name'] !==
'' ? $fileReferenceData[
'name'] : $this->originalFile->getName();
125 throw new \InvalidArgumentException(
'Property "' . $key .
'" was not found in file reference or original file.', 1314226805);
128 return $properties[$key];
140 if (!array_key_exists($key, $this->propertiesOfFileReference)) {
141 throw new \InvalidArgumentException(
'Property "' . $key .
'" of file reference was not found.', 1360684914);
143 return $this->propertiesOfFileReference[$key];
153 if (empty($this->mergedProperties)) {
155 \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule(
156 $this->mergedProperties,
157 $this->originalFile->getProperties(),
162 array_walk($this->mergedProperties, array($this,
'restoreNonNullValuesCallback'));
176 if (array_key_exists($key, $this->propertiesOfFileReference) && $this->propertiesOfFileReference[$key] !== null) {
177 $value = $this->propertiesOfFileReference[$key];
198 return $this->originalFile->getName();
246 return $this->propertiesOfFileReference[
'link'];
256 return (
int)$this->propertiesOfFileReference[
'uid'];
266 return (
int)$this->originalFile->getSize();
276 return $this->originalFile->getSha1();
286 return $this->originalFile->getExtension();
296 return $this->originalFile->getNameWithoutExtension();
306 return $this->originalFile->getMimeType();
316 return (
int)$this->originalFile->getModificationTime();
326 return (
int)$this->originalFile->getCreationTime();
336 return (
int)$this->originalFile->getType();
346 return (
bool)$this->originalFile->getProperty(
'missing');
359 return $this->originalFile->getContents();
370 return $this->originalFile->setContents($contents);
383 return $this->originalFile->getStorage();
393 return $this->originalFile->getIdentifier();
403 return $this->originalFile->getCombinedIdentifier();
413 public function delete()
417 throw new \BadMethodCallException(
'Function not implemented FileReference::delete().', 1333754461);
432 throw new \BadMethodCallException(
'Function not implemented FileReference::rename().', 1333754473);
450 return $this->originalFile->getPublicUrl($relativeToCurrentScript);
476 return $this->originalFile->getForLocalProcessing($writable);
518 return $this->originalFile->getParentFolder();