sonata-project / SonataMediaBundle

Symfony SonataMediaBundle
https://docs.sonata-project.org/projects/SonataMediaBundle
MIT License
449 stars 496 forks source link

Bad documentation #2206

Closed houssemz closed 2 years ago

houssemz commented 2 years ago

Environment

Sonata packages

show

``` $ composer show --latest 'sonata-project/*' sonata-project/admin-bundle 3.105.1 4.2.1 The missing Symfony Admin Generator sonata-project/article-bundle 1.5.0 1.6.1 Advanced article management Package sonata-project/article-bundle is abandoned, you should avoid using it. No replacement was suggested. sonata-project/block-bundle 3.21.0 4.8.0 Symfony SonataBlockBundle sonata-project/cache 1.1.1 2.2.0 Cache library sonata-project/cache-bundle 2.4.2 3.3.0 This bundle provides caching services sonata-project/classification-bundle 3.13.2 3.18.0 Symfony SonataClassificationBundle sonata-project/datagrid-bundle 2.5.0 3.4.2 Symfony SonataDatagridBundle sonata-project/doctrine-extensions 1.14.0 1.15.0 Doctrine2 behavioral extensions sonata-project/doctrine-orm-admin-bundle 3.35.0 4.1.0 Integrate Doctrine ORM into the SonataAdminBundle sonata-project/easy-extends-bundle 2.5.0 2.5.0 Symfony SonataEasyExtendsBundle Package sonata-project/easy-extends-bundle is abandoned, you should avoid using it. No replacement was suggested. sonata-project/entity-audit-bundle 1.3.2 1.6.0 Audit for Doctrine Entities sonata-project/exporter 2.7.0 2.9.0 Lightweight Exporter library sonata-project/form-extensions 1.12.1 1.12.1 Symfony form extensions sonata-project/formatter-bundle 4.6.1 4.6.1 Symfony SonataFormatterBundle sonata-project/intl-bundle 2.10.2 2.11.1 Symfony SonataIntlBundle sonata-project/media-bundle 3.36.0 3.36.0 Symfony SonataMediaBundle sonata-project/notification-bundle 3.9.0 3.13.0 Symfony SonataNotificationBundle sonata-project/page-bundle 3.22.3 3.24.0 This bundle provides a Site and Page management through container and block services sonata-project/seo-bundle 2.12.0 2.15.0 Symfony SonataSeoBundle sonata-project/translation-bundle 2.8.1 2.9.1 SonataTranslationBundle sonata-project/twig-extensions 1.9.0 1.9.0 Sonata twig extensions sonata-project/user-bundle 4.8.0 4.13.0 Symfony SonataUserBundle ```

Symfony packages

show

``` $ composer show --latest 'symfony/*' symfony/amazon-sqs-messenger v5.3.4 v5.3.4 Symfony Amazon SQS extension Messenger Bridge symfony/contracts v1.1.10 v2.4.0 A set of abstractions extracted out of the Symfony components symfony/deprecation-contracts v2.4.0 v2.4.0 A generic function and convention to trigger deprecation notices symfony/monolog-bundle v3.7.0 v3.7.1 Symfony MonologBundle symfony/phpunit-bridge v5.3.7 v5.3.10 Provides utilities for PHPUnit, especially user deprecation notices management symfony/polyfill-ctype v1.23.0 v1.23.0 Symfony polyfill for ctype functions symfony/polyfill-iconv v1.23.0 v1.23.0 Symfony polyfill for the Iconv extension symfony/polyfill-intl-grapheme v1.23.1 v1.23.1 Symfony polyfill for intl's grapheme_* functions symfony/polyfill-intl-icu v1.23.0 v1.23.0 Symfony polyfill for intl's ICU-related data and classes symfony/polyfill-intl-idn v1.23.0 v1.23.0 Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions symfony/polyfill-intl-normalizer v1.23.0 v1.23.0 Symfony polyfill for intl's Normalizer class and related functions symfony/polyfill-mbstring v1.23.1 v1.23.1 Symfony polyfill for the Mbstring extension symfony/polyfill-php72 v1.23.0 v1.23.0 Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions symfony/polyfill-php73 v1.23.0 v1.23.0 Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions symfony/polyfill-php80 v1.23.1 v1.23.1 Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions symfony/polyfill-php81 v1.23.0 v1.23.0 Symfony polyfill backporting some PHP 8.1+ features to lower PHP versions symfony/security-acl v3.2.0 v3.2.0 Symfony Security Component - ACL (Access Control List) symfony/string v5.3.7 v5.3.10 Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way symfony/swiftmailer-bundle v3.5.2 v3.5.2 Symfony SwiftmailerBundle symfony/symfony v4.4.30 v5.3.10 The Symfony PHP framework ```

PHP version

$ php -v
PHP 7.4.25 (cli) (built: Oct 22 2021 18:03:01) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.25, Copyright (c), by Zend Technologies

Subject

When I try to add a new gallery, I have this error:

image

In fact, the class Sonata\MediaBundle\Validator\Constraints\ValidMediaFormat is not well annotated and it causes errors

The annotation should be like below:

image

Insteaf of (see from line 18 to line 23):

image

Minimal repository with the bug

Since sonata-project/media-bundle:3.27 (not sure)

Steps to reproduce

Add a new gallery

Expected results

image

Actual results

image

core23 commented 2 years ago

Feel free to provide a PR with a fix @houssemz