Exponential 5.x Kernel 7.5.40 Exponential New Stack (Symfony-based) Kernel — PHP Class Reference

Core/FieldType/BinaryBase/Value.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Publish\Core\FieldType\BinaryBase;
8
9 use eZ\Publish\Core\FieldType\Value as BaseValue;
10
17 abstract class Value extends BaseValue
18 {
26 protected $id;
27
33 public $inputUri;
34
40 public $fileName;
41
47 public $fileSize;
48
54 public $mimeType;
55
61 public $uri;
62
68 public function __construct(array $fileData = [])
69 {
70 // BC with 5.0 (EZP-20948)
71 if (isset($fileData['path'])) {
72 $fileData['id'] = $fileData['path'];
73 unset($fileData['path']);
74 }
75
76 // BC with 5.2 (EZP-22808)
77 if (isset($fileData['id']) && file_exists($fileData['id'])) {
78 $fileData['inputUri'] = $fileData['id'];
79 unset($fileData['id']);
80 }
81
82 parent::__construct($fileData);
83 }
84
90 public function __toString()
91 {
92 return (string)$this->uri;
93 }
94
95 public function __get($propertyName)
96 {
97 if ($propertyName === 'path') {
98 return $this->inputUri;
99 }
100
101 return parent::__get($propertyName);
102 }
103
104 public function __set($propertyName, $propertyValue)
105 {
106 // BC with 5.0 (EZP-20948)
107 if ($propertyName === 'path') {
108 $this->inputUri = $propertyValue;
109 } elseif ($propertyName === 'id' && file_exists($propertyValue)) { // BC with 5.2 (EZP-22808)
110 $this->inputUri = $propertyValue;
111 } else {
112 parent::__set($propertyName, $propertyValue);
113 }
114 }
115
116 public function __isset($propertyName)
117 {
118 if ($propertyName === 'path') {
119 return true;
120 }
121
122 return parent::__isset($propertyName);
123 }
124 }
eZ\Publish\Core\FieldType\BinaryBase\Value
Definition: Core/FieldType/BinaryBase/Value.php:18
eZ\Publish\Core\FieldType\BinaryBase\Value\$inputUri
$inputUri
Definition: Core/FieldType/BinaryBase/Value.php:33
eZ\Publish\Core\FieldType\BinaryBase\Value\$mimeType
$mimeType
Definition: Core/FieldType/BinaryBase/Value.php:54
eZ\Publish\Core\FieldType\BinaryBase\Value\__toString
__toString()
Returns a string representation of the field value.
Definition: Core/FieldType/BinaryBase/Value.php:90
eZ\Publish\Core\FieldType\BinaryBase\Value\$id
$id
Definition: Core/FieldType/BinaryBase/Value.php:26
eZ\Publish\Core\FieldType\BinaryBase\Value\$fileSize
$fileSize
Definition: Core/FieldType/BinaryBase/Value.php:47
eZ\Publish\Core\FieldType\BinaryBase\Value\__set
__set($propertyName, $propertyValue)
Magic set function handling writes to non public properties.
Definition: Core/FieldType/BinaryBase/Value.php:104
eZ\Publish\Core\FieldType\BinaryBase\Value\__construct
__construct(array $fileData=[])
Construct a new Value object.
Definition: Core/FieldType/BinaryBase/Value.php:68
eZ\Publish\Core\FieldType\BinaryBase\Value\__isset
__isset($propertyName)
Magic isset function handling isset() to non public properties.
Definition: Core/FieldType/BinaryBase/Value.php:116
eZ\Publish\Core\FieldType\BinaryBase\Value\$uri
$uri
Definition: Core/FieldType/BinaryBase/Value.php:61
eZ\Publish\Core\FieldType\BinaryBase\Value\__get
__get($propertyName)
Magic get function handling read to non public properties.
Definition: Core/FieldType/BinaryBase/Value.php:95
eZ\Publish\Core\FieldType\BinaryBase\Value\$fileName
$fileName
Definition: Core/FieldType/BinaryBase/Value.php:40
eZ\Publish\Core\FieldType\Value
Abstract class for all field value classes.
Definition: Core/FieldType/Value.php:17
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.