sonata-project / ecommerce

[Abandoned] E-Commerce solution provided by Sonata
https://sonata-project.org
MIT License
164 stars 139 forks source link

does Api method works ? Make sure there is a loader supporting the "rest" type #633

Closed salamichel closed 4 years ago

salamichel commented 4 years ago

Hi does somesone succes using API method ?

i have and issue An exception has been thrown during the rendering of a template ("Class could not be determined for Controller identified by "sonata.product.controller.api.product". Make sure there is a loader supporting the "rest" type.

Environment

Sonata packages

$ composer show --latest 'sonata-project/*'
sonata-project/admin-bundle              3.x-dev 9dc6d53    dev-master 27a5c38 The missing Symfony Admin Generator
sonata-project/block-bundle              3.x-dev 80dc528    3.x-dev 80dc528    Symfony SonataBlockBundle
sonata-project/cache                     2.0.1              2.0.1              Cache library
sonata-project/classification-bundle     3.x-dev b8c8ef0    dev-master 1971f8c Symfony SonataClassificationBundle
sonata-project/comment-bundle            3.1.1              3.1.1              Integrate the FOSCommentBundle in th...
sonata-project/core-bundle               3.x-dev 3b1128b    dev-master 5290847 Symfony SonataCoreBundle (abandoned)
sonata-project/datagrid-bundle           2.5.0              3.0.1              Symfony SonataDatagridBundle
sonata-project/doctrine-extensions       1.5.1              1.5.1              Doctrine2 behavioral extensions
sonata-project/doctrine-orm-admin-bundle 3.x-dev 46d14ed    dev-master 5bb5663 Symfony Sonata / Integrate Doctrine ...
sonata-project/easy-extends-bundle       2.5.0              2.5.0              Symfony SonataEasyExtendsBundle
sonata-project/ecommerce                 3.x-dev 43a2ba4    dev-master 1be2328 E-Commerce solution provided by Sonata
sonata-project/exporter                  2.0.1              2.0.1              Lightweight Exporter library
sonata-project/formatter-bundle          4.1.3              4.1.3              Symfony SonataFormatterBundle
sonata-project/intl-bundle               2.7.0              2.7.0              Symfony SonataIntlBundle
sonata-project/media-bundle              3.x-dev 7c96c71    dev-master e1692b4 Symfony SonataMediaBundle
sonata-project/media-orm-pack            dev-master 931be8a dev-master 931be8a A pack for SonataMediaBundle with OR...
sonata-project/notification-bundle       3.6.2              3.6.2              Symfony SonataNotificationBundle
sonata-project/seo-bundle                2.9.0              2.9.0              Symfony SonataSeoBundle
sonata-project/timeline-bundle           3.4.0              3.4.0              Integrates SpyTimelineBundle into So...
sonata-project/user-bundle               4.x-dev c6b15a5    dev-master eb8cbb2 Symfony SonataUserBundle

Symfony packages

$ composer show --latest 'symfony/*'

symfony/apache-pack                v1.0.1  v1.0.1  A pack for Apache support in Symfony
symfony/asset                      v4.3.9  v4.3.9  Symfony Asset Component
symfony/browser-kit                v4.3.9  v4.3.9  Symfony BrowserKit Component
symfony/cache                      v4.3.9  v4.3.9  Symfony Cache component with PSR-6, PSR-16, and tags
symfony/cache-contracts            v1.1.7  v2.0.1  Generic abstractions related to caching
symfony/config                     v4.3.9  v4.3.9  Symfony Config Component
symfony/console                    v4.3.9  v4.3.9  Symfony Console Component
symfony/css-selector               v4.3.9  v4.3.9  Symfony CssSelector Component
symfony/debug                      v4.3.9  v4.3.9  Symfony Debug Component
symfony/dependency-injection       v4.3.9  v4.3.9  Symfony DependencyInjection Component
symfony/doctrine-bridge            v4.3.9  v4.3.9  Symfony Doctrine Bridge
symfony/dom-crawler                v4.3.9  v4.3.9  Symfony DomCrawler Component
symfony/dotenv                     v4.3.9  v4.3.9  Registers environment variables from a .env file
symfony/event-dispatcher           v4.3.9  v4.3.9  Symfony EventDispatcher Component
symfony/event-dispatcher-contracts v1.1.7  v2.0.1  Generic abstractions related to dispatching event
symfony/expression-language        v4.3.9  v4.3.9  Symfony ExpressionLanguage Component
symfony/filesystem                 v4.3.9  v4.3.9  Symfony Filesystem Component
symfony/finder                     v4.3.9  v4.3.9  Symfony Finder Component
symfony/flex                       v1.6.0  v1.6.0  Composer plugin for Symfony
symfony/form                       v4.3.9  v4.3.9  Symfony Form Component
symfony/framework-bundle           v4.3.9  v4.3.9  Symfony FrameworkBundle
symfony/http-foundation            v4.3.9  v4.3.9  Symfony HttpFoundation Component
symfony/http-kernel                v4.3.9  v4.3.9  Symfony HttpKernel Component
symfony/inflector                  v4.3.9  v4.3.9  Symfony Inflector Component
symfony/intl                       v4.3.9  v4.3.9  A PHP replacement layer for the C intl extension that includes a...
symfony/maker-bundle               v1.14.3 v1.14.3 Symfony Maker helps you create empty commands, controllers, form...
symfony/mime                       v4.3.9  v4.3.9  A library to manipulate MIME messages
symfony/monolog-bridge             v4.3.9  v4.3.9  Symfony Monolog Bridge
symfony/monolog-bundle             v3.5.0  v3.5.0  Symfony MonologBundle
symfony/options-resolver           v4.3.9  v4.3.9  Symfony OptionsResolver Component
symfony/phpunit-bridge             v5.0.2  v5.0.2  Symfony PHPUnit Bridge
symfony/polyfill-intl-icu          v1.13.1 v1.13.1 Symfony polyfill for intl's ICU-related data and classes
symfony/polyfill-intl-idn          v1.13.1 v1.13.1 Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions
symfony/polyfill-mbstring          v1.13.1 v1.13.1 Symfony polyfill for the Mbstring extension
symfony/polyfill-php72             v1.13.1 v1.13.1 Symfony polyfill backporting some PHP 7.2+ features to lower PHP...
symfony/polyfill-php73             v1.13.1 v1.13.1 Symfony polyfill backporting some PHP 7.3+ features to lower PHP...
symfony/process                    v4.3.9  v4.3.9  Symfony Process Component
symfony/profiler-pack              v1.0.4  v1.0.4  A pack for the Symfony web profiler
symfony/property-access            v4.3.9  v4.3.9  Symfony PropertyAccess Component
symfony/property-info              v4.3.9  v4.3.9  Symfony Property Info Component
symfony/routing                    v4.3.9  v4.3.9  Symfony Routing Component
symfony/security-acl               v3.0.4  v3.0.4  Symfony Security Component - ACL (Access Control List)
symfony/security-bundle            v4.3.9  v4.3.9  Symfony SecurityBundle
symfony/security-core              v4.3.9  v4.3.9  Symfony Security Component - Core Library
symfony/security-csrf              v4.3.9  v4.3.9  Symfony Security Component - CSRF Library
symfony/security-guard             v4.3.9  v4.3.9  Symfony Security Component - Guard
symfony/security-http              v4.3.9  v4.3.9  Symfony Security Component - HTTP Integration
symfony/service-contracts          v1.1.8  v2.0.1  Generic abstractions related to writing services
symfony/stopwatch                  v4.3.9  v4.3.9  Symfony Stopwatch Component
symfony/swiftmailer-bundle         v3.4.0  v3.4.0  Symfony SwiftmailerBundle
symfony/templating                 v4.3.9  v4.3.9  Symfony Templating Component
symfony/test-pack                  v1.0.6  v1.0.6  A pack for functional and end-to-end testing within a Symfony app
symfony/translation                v4.3.9  v4.3.9  Symfony Translation Component
symfony/translation-contracts      v1.1.7  v2.0.1  Generic abstractions related to translation
symfony/twig-bridge                v4.3.9  v4.3.9  Symfony Twig Bridge
symfony/twig-bundle                v4.3.9  v4.3.9  Symfony TwigBundle
symfony/validator                  v4.3.9  v4.3.9  Symfony Validator Component
symfony/var-dumper                 v4.3.9  v4.3.9  Symfony mechanism for exploring and dumping PHP variables
symfony/var-exporter               v4.3.9  v4.3.9  A blend of var_export() + serialize() to turn any serializable d...
symfony/web-profiler-bundle        v4.3.9  v4.3.9  Symfony WebProfilerBundle
symfony/web-server-bundle          v4.3.9  v4.3.9  Symfony WebServerBundle
symfony/webpack-encore-bundle      v1.7.2  v1.7.2  Integration with your Symfony app & Webpack Encore!
symfony/yaml                       v4.3.9  v4.3.9  Symfony Yaml Component

PHP version

$ php -v
PHP 7.2.18 (cli) (built: Apr 30 2019 23:32:39) ( ZTS MSVC15 (Visual C++ 2017) x64 )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Xdebug v2.7.2, Copyright (c) 2002-2019, by Derick Rethans

Subject

Steps to reproduce

Expected results

Actual results

An exception has been thrown during the rendering of a template ("Class could not be determined for Controller identified by "sonata.product.controller.api.product" (...) Make sure there is a loader supporting the "rest" type.").

 bin/console debug:container sonata.product.controller.api.product

Information for Service "sonata.product.controller.api.product"
===============================================================

 ---------------- -------------------------------------------------------
  Option           Value
 ---------------- -------------------------------------------------------
  Service ID       sonata.product.controller.api.product
  Class            Sonata\ProductBundle\Controller\Api\ProductController
  Tags             -
  Public           no
  Synthetic        no
  Lazy             no
  Shared           yes
  Abstract         no
  Autowired        no
  Autoconfigured   no
 ---------------- -------------------------------------------------------
jeroendk commented 4 years ago

@salamichel API controller services need to be public for the FOSRest route loader, see: https://github.com/sonata-project/SonataMediaBundle/pull/1654

salamichel commented 4 years ago

@jeroendk Hi thx for reply! now it seems that we we are not ready for nelmio 3x

 [Semantical Error] The annotation "@Nelmio\ApiDocBundle\Annotation\ApiDoc" in method Sonata\ProductBundle\Controller\Api\ProductController::getProductAction()
  does not exist, or could not be auto-loaded 
jeroendk commented 4 years ago

@salamichel Did you install the Nelmio bundle? You need to install it manually: https://sonata-project.org/bundles/ecommerce/develop/doc/reference/architecture/api.html

salamichel commented 4 years ago

Yes i did but i have to downgrade to 2.x, now the documentation page is empty

image

routes are correctly registered and working

image

wbloszyk commented 4 years ago

@salamichel I finish sandbox:3.0. With Symfony 3.4 documentation work correct. Also I start working on sandbox:4.0 with Symfony 4.4 where documentation look like here. I will work on it in next week.

github-actions[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

wbloszyk commented 4 years ago

Close in favor for https://github.com/sonata-project/dev-kit/issues/778