Skip to content

Argument #2 ($metadata) must be of type Contao\CoreBundle\Filesystem\ExtraMetadata, array given #370

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
franklytom opened this issue Oct 30, 2024 · 8 comments · Fixed by #374

Comments

@franklytom
Copy link

franklytom commented Oct 30, 2024

Folgenden Fehler erhalte ich:

Contao\CoreBundle\Filesystem\VirtualFilesystem::setExtraMetadata():
Argument #2 ($metadata) must be of type Contao\CoreBundle\Filesystem\ExtraMetadata, array given, called in …/vendor/terminal42/notification_center/src/BulkyItem/BulkyItemStorage.php on line 35

Der Aufruf kommt aus folgendem Abschnitt:

$fileItem = FileItem::fromPath($filePath, $fileName, $mimeType, $fileSize);  
$voucher = $this->notificationCenter->getBulkyItemStorage()->store($fileItem);

store() wiederum enthält in der entscheidenden Passage:

$meta = [  
   'item' => $item->getMeta(),  
   'class' => $item::class,  
];         
$this->filesystem->setExtraMetadata($voucher, ['storage_meta' => $meta]);

setExtraMetadata erwartet jedoch tatsächlich als zweiten Parameter keinen Array:

public function setExtraMetadata(Uuid|string $location, ExtraMetadata $metadata): void

Ich bin gerade ein bisschen ratlos wo ich ansetzen könnte. Aktuell bin ich dabei meine Erweiterung von Contao 4.13 auf 5.4 umzustellen und bin bei diesem Upgrade auf das Verhalten gestoßen.

Versionen: PHP 8.3
Contao 5.4.4
Notification Center Pro: 1.0.3

@fritzmg
Copy link
Collaborator

fritzmg commented Oct 30, 2024

Ich bin gerade ein bisschen ratlos wo ich ansetzen könnte.

This is a breaking change in the recent Contao version (note: the VFS is marked as experimental thus breaking changes are ok here). NC hasn't been updated yet to adjust its own implementation accordingly.

@franklytom
Copy link
Author

I have the same problem at Contao 5.3.
Which is the lastet known version?
Or do you already know when you will adjust the NC?

@christianbarkowsky
Copy link

I can also confirm this under Contao 5.3

@Toflar
Copy link
Member

Toflar commented Nov 4, 2024

I was on vacation. I will tackle this issue as soon as there is a possibility for me to tackle it. Currently, there is no Contao 4.13 release with the adjusted VFS interface so there's no way for me to be compatible with both, 4.13 and the latest changes in 5.3 and 5.4. This has to be fixed in 4.13 first (and a relase has to be published). Until then, I'm afraid but you'll have to downgrade to 5.4.3 or 5.3.15.

@Toflar
Copy link
Member

Toflar commented Nov 6, 2024

I've found a solution anyway and released 2.1.1. I have adjusted the requirements in the composer.json so that only users of the latest 5.3 and 5.4 (which are affected) will get the bugfix release. The 4.13 requirement is adjusted to a release that is not published yet but will include the backport of the adjustments. So 2.1.1 is not available for 4.13 users but will be as soon as there is 4.13.50 which will contain the backport and then everybody should be good again.

@franklytom
Copy link
Author

franklytom commented Nov 15, 2024

First of all: Thank you so much for the fix :)

@Toflar is the problem also fixed for the pro version? As fat as I can see for the Pro-Version NC is fixed to "terminal42/notification_center": "^2.0" so would not get the 2.1.1. Is that right?

@Toflar
Copy link
Member

Toflar commented Nov 15, 2024

^2.0 means anything >= 2.0 && < 3.0. But you can just test it and then you know? 😄

@franklytom
Copy link
Author

Thanks Toflar!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants