sonata-project / SonataAdminBundle

The missing Symfony Admin Generator
https://docs.sonata-project.org/projects/SonataAdminBundle
MIT License
2.11k stars 1.26k forks source link

Command `sonata:admin:explain` is broken #8056

Closed core23 closed 1 year ago

core23 commented 1 year ago

Environment

Sonata packages

show

``` sonata-project/admin-bundle 4.23.0 4.23.0 The missing Symfony Admin Generator sonata-project/block-bundle 4.20.0 4.20.0 Symfony SonataBlockBundle sonata-project/doctrine-extensions 2.2.0 2.2.0 Doctrine2 behavioral extensions sonata-project/doctrine-orm-admin-bundle 4.12.0 4.12.0 Integrate Doctrine ORM into the SonataAdminBundle sonata-project/exporter 2.14.0 3.1.1 Lightweight Exporter library sonata-project/form-extensions 1.19.0 1.19.0 Symfony form extensions sonata-project/intl-bundle 3.1.0 3.1.0 Symfony SonataIntlBundle sonata-project/media-bundle 4.8.1 4.8.1 Symfony SonataMediaBundle sonata-project/twig-extensions 2.1.0 2.1.0 Sonata twig extensions ```

Symfony packages

show

``` symfony/browser-kit v5.4.21 v6.2.7 Simulates the behavior of a web browser, allowing you to make requests, click on links and submit forms programmatically symfony/config v6.2.7 v6.2.7 Helps you find, load, combine, autofill and validate configuration values of any kind symfony/console v6.2.10 v6.2.10 Eases the creation of beautiful and testable command line interfaces symfony/css-selector v5.2.12 v6.2.7 Converts CSS selectors to XPath expressions symfony/debug-bundle v5.4.21 v6.2.7 Provides a tight integration of the Symfony VarDumper component and the ServerLogCommand from MonologBridge into the Symfon... symfony/dependency-injection v6.2.10 v6.2.10 Allows you to standardize and centralize the way objects are constructed in your application symfony/doctrine-bridge v5.4.23 v6.2.9 Provides integration for Doctrine with various Symfony components symfony/dotenv v5.4.22 v6.2.8 Registers environment variables from a .env file symfony/event-dispatcher v6.2.8 v6.2.8 Provides tools that allow your application components to communicate with each other by dispatching events and listening to... symfony/event-dispatcher-contracts v3.2.1 v3.2.1 Generic abstractions related to dispatching event symfony/expression-language v6.2.7 v6.2.7 Provides an engine that can compile and evaluate expressions symfony/filesystem v6.2.10 v6.2.10 Provides basic utilities for the filesystem symfony/flex v2.2.5 v2.2.5 Composer plugin for Symfony symfony/form v6.2.10 v6.2.10 Allows to easily create, process and reuse HTML forms symfony/framework-bundle v6.2.10 v6.2.10 Provides a tight integration between Symfony components and the Symfony full-stack framework symfony/http-client v5.4.23 v6.2.10 Provides powerful methods to fetch HTTP resources synchronously or asynchronously symfony/http-foundation v6.2.10 v6.2.10 Defines an object-oriented layer for the HTTP specification symfony/http-kernel v6.2.10 v6.2.10 Provides a structured process for converting a Request into a Response symfony/intl v6.2.10 v6.2.10 Provides access to the localization data of the ICU library symfony/mailer v6.2.8 v6.2.8 Helps sending emails symfony/maker-bundle v1.48.0 v1.48.0 Symfony Maker helps you create empty commands, controllers, form classes, tests and more so you can forget about writing bo... symfony/mime v6.2.10 v6.2.10 Allows manipulating MIME messages symfony/monolog-bundle v3.8.0 v3.8.0 Symfony MonologBundle symfony/options-resolver v6.2.7 v6.2.7 Provides an improved replacement for the array_replace PHP function symfony/phpunit-bridge v6.2.10 v6.2.10 Provides utilities for PHPUnit, especially user deprecation notices management symfony/property-access v6.2.8 v6.2.8 Provides functions to read and write from/to an object or array using a simple string notation symfony/routing v6.2.8 v6.2.8 Maps an HTTP request to a set of configuration variables symfony/runtime v5.4.22 v6.2.8 Enables decoupling PHP applications from global state symfony/security-core v6.2.8 v6.2.8 Symfony Security Component - Core Library symfony/security-csrf v6.2.7 v6.2.7 Symfony Security Component - CSRF Library symfony/serializer v6.2.10 v6.2.10 Handles serializing and deserializing data structures, including object graphs, into array structures or other formats like... symfony/service-contracts v3.2.1 v3.2.1 Generic abstractions related to writing services symfony/string v6.2.8 v6.2.8 Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way symfony/translation v6.2.8 v6.2.8 Provides tools to internationalize your application symfony/translation-contracts v3.2.1 v3.2.1 Generic abstractions related to translation symfony/twig-bridge v6.2.8 v6.2.8 Provides integration for Twig with various Symfony components symfony/twig-bundle v6.2.7 v6.2.7 Provides a tight integration of Twig into the Symfony full-stack framework symfony/uid v5.4.21 v6.2.7 Provides an object-oriented API to generate and represent UIDs symfony/ux-cropperjs v2.7.1 v2.7.1 Cropper.js integration for Symfony symfony/ux-dropzone v2.7.1 v2.7.1 File input dropzones for Symfony Forms symfony/validator v6.2.10 v6.2.10 Provides tools to validate values symfony/web-profiler-bundle v5.4.21 v6.2.10 Provides a development tool that gives detailed information about the execution of any request symfony/webpack-encore-bundle v1.16.1 v1.16.1 Integration with your Symfony app & Webpack Encore! ```

PHP version

$ php -v
# Put the result here.

Subject

Steps to reproduce

Define an admin using the docs. Run sonata:admin:explain command to see information for the admin.

Expected results

No error

Actual results

Stacktrace:

In AbstractAdmin.php line 803:

  [LogicException]
  Admin "App\Admin\FooAdmin" has no subject.

Exception trace:
  at /Users/gripp/Development/Web/project/_dev/vendor/sonata-project/admin-bundle/src/Admin/AbstractAdmin.php:803
 Sonata\AdminBundle\Admin\AbstractAdmin->defineFormBuilder() at /Users/gripp/Development/Web/project/_dev/vendor/sonata-project/admin-bundle/src/Admin/AbstractAdmin.php:791
 Sonata\AdminBundle\Admin\AbstractAdmin->getFormBuilder() at /Users/gripp/Development/Web/project/_dev/vendor/sonata-project/admin-bundle/src/Command/ExplainAdminCommand.php:54
 Sonata\AdminBundle\Command\ExplainAdminCommand->execute() at /Users/gripp/Development/Web/project/_dev/vendor/symfony/console/Command/Command.php:312
 Symfony\Component\Console\Command\Command->run() at /Users/gripp/Development/Web/project/_dev/vendor/symfony/console/Application.php:1040
 Symfony\Component\Console\Application->doRunCommand() at /Users/gripp/Development/Web/project/_dev/vendor/symfony/framework-bundle/Console/Application.php:88
 Symfony\Bundle\FrameworkBundle\Console\Application->doRunCommand() at /Users/gripp/Development/Web/project/_dev/vendor/symfony/console/Application.php:314
 Symfony\Component\Console\Application->doRun() at /Users/gripp/Development/Web/project/_dev/vendor/symfony/framework-bundle/Console/Application.php:77
 Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at /Users/gripp/Development/Web/project/_dev/vendor/symfony/console/Application.php:168
VincentLanglet commented 1 year ago

https://github.com/sonata-project/SonataAdminBundle/pull/8061 should fix it.