sonata-project / SonataMediaBundle

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

ApiDoc and QueryParam was never imported exception #1080

Closed ksom closed 8 years ago

ksom commented 8 years ago

Environment

Mac OS X 10.11.5

Sonata packages

$ composer show sonata-project/*
sonata-project/admin-bundle              3.4.0           The missing Symfony Admin Generator
sonata-project/block-bundle              3.1.1           Symfony SonataBlockBundle
sonata-project/cache                     1.0.7           Cache library
sonata-project/classification-bundle     3.1.0           Symfony SonataClassificationBundle
sonata-project/core-bundle               3.0.3           Symfony SonataCoreBundle
sonata-project/datagrid-bundle           2.2             Symfony SonataDatagridBundle
sonata-project/doctrine-extensions       1.0.2           Doctrine2 behavioral extensions
sonata-project/doctrine-orm-admin-bundle 3.0.5           Symfony Sonata / Integrate Doctrine ORM into the SonataAdminBundle
sonata-project/easy-extends-bundle       2.1.10          Symfony SonataEasyExtendsBundle
sonata-project/exporter                  1.5.0           Lightweight Exporter library
sonata-project/intl-bundle               2.2.4           Symfony SonataIntlBundle
sonata-project/media-bundle              3.x-dev 79508e2 Symfony SonataMediaBundle
sonata-project/notification-bundle       3.0.0           Symfony SonataNotificationBundle

Symfony packages

$ composer show symfony/*
symfony/monolog-bundle     v2.10.0 Symfony MonologBundle
symfony/phpunit-bridge     v3.0.4  Symfony PHPUnit Bridge
symfony/polyfill-intl-icu  v1.1.1  Symfony polyfill for intl's ICU-related data and classes
symfony/polyfill-mbstring  v1.1.1  Symfony polyfill for the Mbstring extension
symfony/polyfill-php56     v1.1.1  Symfony polyfill backporting some PHP 5.6+ features to lower PHP versions
symfony/polyfill-php70     v1.1.1  Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions
symfony/polyfill-util      v1.1.1  Symfony utilities for portability of PHP codes
symfony/security-acl       v3.0.0  Symfony Security Component - ACL (Access Control List)
symfony/swiftmailer-bundle v2.3.11 Symfony SwiftmailerBundle
symfony/symfony            v3.0.6  The Symfony PHP framework

FOS Rest Package


friendsofsymfony/rest-bundle 1.7.7 This Bundle provides various tools to rapidly develop RESTful API's with Symfony

Nelmio Api package


nelmio/api-doc-bundle 2.13.0 Generates documentation for your REST API from annotations

PHP version

$ php -v
PHP 5.6.22 (cli) (built: May 27 2016 12:20:55)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies

Subject

Hi,

An error is thrown during composer install caused by the @ApiDoc annotation on Sonata\MediaBundle\Controller\Api\GalleryController's actions although it was not used. It's also the case for @QueryParam.

I found that @QueryParam and @ApiDoc were used in the past but has been removed by "Support for FOSRestBundle" (committed by @core23). I wanted to open a PR to fix that but I don't know whether it was intended to remove them or not. The options would be to add the uses back or remove the annotations.

Steps to reproduce

Run composer install with sonata-media 3.x-dev last version.

Expected results

Finishing composer install normally.

Actual results

[Semantical Error] The annotation "@ApiDoc" in method Sonata\MediaBundle\Controller\Api\GalleryController::getGalleriesAction() was never imported. Did you maybe forget to add a "use" statement for this annotation?

Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installAssets handling the post-install-cmd event terminated with an exception

  [RuntimeException]
  An error occurred when executing the "'assets:install --symlink --relative '\''htdocs'\'''" command:

  m
    [Doctrine\Common\Annotations\AnnotationException]
  m
    [Semantical Error] The annotation "@ApiDoc" in method Sonata\MediaBundle\Controller\Api\GalleryController::getGalleriesAction() was never imported. Did you maybe forget to add a "use" statement for this annotation?
  m

  m
  .

Exception trace:
 () at /Users/virgilevivier/Sites/catalogue/vendor/sensio/distribution-bundle/Composer/ScriptHandler.php:307
 Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::executeCommand() at /Users/virgilevivier/Sites/catalogue/vendor/sensio/distribution-bundle/Composer/ScriptHandler.php:175
 Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installAssets() at phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php:255
 Composer\EventDispatcher\EventDispatcher->executeEventPhpScript() at phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php:209
 Composer\EventDispatcher\EventDispatcher->doDispatch() at phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php:95
 Composer\EventDispatcher\EventDispatcher->dispatchScript() at phar:///usr/local/bin/composer/src/Composer/Installer.php:297
 Composer\Installer->run() at phar:///usr/local/bin/composer/src/Composer/Command/InstallCommand.php:135
 Composer\Command\InstallCommand->execute() at phar:///usr/local/bin/composer/vendor/symfony/console/Command/Command.php:259
 Symfony\Component\Console\Command\Command->run() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:844
 Symfony\Component\Console\Application->doRunCommand() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:192
 Symfony\Component\Console\Application->doRun() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:231
 Composer\Console\Application->doRun() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:123
 Symfony\Component\Console\Application->run() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:104
 Composer\Console\Application->run() at phar:///usr/local/bin/composer/bin/composer:43
 require() at /usr/local/bin/composer:24
greg0ire commented 8 years ago

Assigning you @core23 , I think you're the best person to handle this.

core23 commented 8 years ago

Sorry, I didn't use the API functionality

ksom commented 8 years ago

@core23 Yes you didn't use it but you removed the use statement and the annotation is already in use in the controller.

core23 commented 8 years ago

Have you tried to readd these imports? Can you provide a PR?

ksom commented 8 years ago

I'm doing a PR.