Skip to content

Commit 8a105e1

Browse files
Resolving other type errors
1 parent 8acf0eb commit 8a105e1

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/Model/Behavior/UploadBehavior.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,14 +113,14 @@ public function beforeSave(EventInterface $event, EntityInterface $entity, Array
113113
continue;
114114
}
115115

116-
$data = $entity->get($field);
116+
$data = $entity->get((string)$field);
117117
if (!$data instanceof UploadedFileInterface) {
118118
continue;
119119
}
120120

121-
if ($entity->get($field)->getError() !== UPLOAD_ERR_OK) {
121+
if ($entity->get((string)$field)->getError() !== UPLOAD_ERR_OK) {
122122
if (Hash::get($settings, 'restoreValueOnFailure', true)) {
123-
$entity->set($field, $entity->getOriginal($field));
123+
$entity->set($field, $entity->getOriginal((string)$field));
124124
$entity->setDirty($field, false);
125125
}
126126
continue;
@@ -175,14 +175,14 @@ public function afterDelete(EventInterface $event, EntityInterface $entity, Arra
175175
if ($entity->has($dirField)) {
176176
$path = $entity->get($dirField);
177177
} else {
178-
$path = $this->getPathProcessor($entity, $entity->get($field), $field, $settings)->basepath();
178+
$path = $this->getPathProcessor($entity, $entity->get((string)$field), $field, $settings)->basepath();
179179
}
180180

181181
$callback = Hash::get($settings, 'deleteCallback');
182182
if ($callback && is_callable($callback)) {
183183
$files = $callback($path, $entity, $field, $settings);
184184
} else {
185-
$files = [$path . $entity->get($field)];
185+
$files = [$path . $entity->get((string)$field)];
186186
}
187187

188188
$writer = $this->getWriter($entity, null, $field, $settings);

0 commit comments

Comments
 (0)