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

Resolved - Symfony Flex with composer require admin-bundle fails on fresh install #4910

Closed FabienPapet closed 6 years ago

FabienPapet commented 6 years ago

Environment

Windows 10 - Fresh install

Sonata packages

Irelevant

Symfony packages

symfony/asset                v4.0.3             Symfony Asset Component
symfony/browser-kit          v4.0.3             Symfony BrowserKit Component
symfony/cache                v4.0.3             Symfony Cache component wi...
symfony/class-loader         v3.4.3             Symfony ClassLoader Component
symfony/config               v4.0.3             Symfony Config Component
symfony/console              v4.0.3             Symfony Console Component
symfony/css-selector         v4.0.3             Symfony CssSelector Component
symfony/debug                v4.0.3             Symfony Debug Component
symfony/debug-bundle         v4.0.3             Symfony DebugBundle
symfony/debug-pack           v1.0.4             A debug pack for Symfony p...
symfony/dependency-injection v4.0.3             Symfony DependencyInjectio...
symfony/doctrine-bridge      v4.0.3             Symfony Doctrine Bridge
symfony/dom-crawler          v4.0.3             Symfony DomCrawler Component
symfony/dotenv               v4.0.3             Registers environment vari...
symfony/event-dispatcher     v4.0.3             Symfony EventDispatcher Co...
symfony/expression-language  v4.0.3             Symfony ExpressionLanguage...
symfony/filesystem           v4.0.3             Symfony Filesystem Component
symfony/finder               v4.0.3             Symfony Finder Component
symfony/flex                 v1.0.67
symfony/form                 v4.0.3             Symfony Form Component
symfony/framework-bundle     v4.0.3             Symfony FrameworkBundle
symfony/http-foundation      v4.0.3             Symfony HttpFoundation Com...
symfony/http-kernel          v4.0.3             Symfony HttpKernel Component
symfony/inflector            v4.0.3             Symfony Inflector Component
symfony/intl                 v4.0.3             A PHP replacement layer fo...
symfony/lts                  dev-master 396c5fc Enforces Long Term Support...
symfony/maker-bundle         v1.0.2
symfony/monolog-bridge       v4.0.3             Symfony Monolog Bridge
symfony/monolog-bundle       v3.1.2             Symfony MonologBundle
symfony/options-resolver     v4.0.3             Symfony OptionsResolver Co...
symfony/orm-pack             v1.0.5             A pack for the Doctrine ORM
symfony/phpunit-bridge       v4.0.3             Symfony PHPUnit Bridge
symfony/polyfill-intl-icu    v1.6.0             Symfony polyfill for intl'...
symfony/polyfill-mbstring    v1.6.0             Symfony polyfill for the M...
symfony/polyfill-php72       v1.6.0             Symfony polyfill backporti...
symfony/process              v4.0.3             Symfony Process Component
symfony/profiler-pack        v1.0.3             A pack for the Symfony web...
symfony/property-access      v4.0.3             Symfony PropertyAccess Com...
symfony/property-info        v4.0.3             Symfony Property Info Comp...
symfony/routing              v4.0.3             Symfony Routing Component
symfony/security             v4.0.3             Symfony Security Component
symfony/security-acl         v3.0.1             Symfony Security Component...
symfony/security-bundle      v4.0.3             Symfony SecurityBundle
symfony/serializer           v4.0.3             Symfony Serializer Component
symfony/serializer-pack      v1.0.1             A pack for the Symfony ser...
symfony/stopwatch            v4.0.3             Symfony Stopwatch Component
symfony/swiftmailer-bundle   v3.1.6             Symfony SwiftmailerBundle
symfony/templating           v4.0.3             Symfony Templating Component
symfony/translation          v4.0.3             Symfony Translation Component
symfony/twig-bridge          v4.0.3             Symfony Twig Bridge
symfony/twig-bundle          v4.0.3             Symfony TwigBundle
symfony/validator            v4.0.3             Symfony Validator Component
symfony/var-dumper           v4.0.3             Symfony mechanism for expl...
symfony/web-link             v4.0.3             Symfony WebLink Component
symfony/web-profiler-bundle  v4.0.3             Symfony WebProfilerBundle
symfony/webpack-encore-pack  v1.0.2             A pack for Symfony Encore
symfony/yaml                 v4.0.3             Symfony Yaml Component

PHP version

$ php -v
# 7.1.11

Subject

First, i'm not sure about where this to report this, if it symfony flex related or sonata related , sorry if it is not the right place.

I'm trying to install Sonata admin using Symfony4.0.3 and flex

Steps to reproduce

Following the official Symfony documentation :

composer create-project symfony/website-skeleton my-project
composer require sonata-project/admin-bundle

Expected results

Sonata installed O:)

Actual results


$ composer require sonata-project/admin-bundle
Using version ^3.31 for sonata-project/admin-bundle
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 13 installs, 0 updates, 0 removals
- Installing twig/extensions (v1.5.1): Loading from cache
- Installing symfony/templating (v4.0.3): Loading from cache
- Installing symfony/security-acl (v3.0.1): Loading from cache
- Installing symfony/class-loader (v3.4.3): Loading from cache
- Installing sonata-project/exporter (1.8.0): Loading from cache
- Installing sonata-project/datagrid-bundle (2.3.1): Loading from cache
- Installing cocur/slugify (v3.1): Downloading (100%)
- Installing sonata-project/core-bundle (3.9.0): Loading from cache
- Installing sonata-project/cache (2.0.1): Loading from cache
- Installing sonata-project/block-bundle (3.11.0): Loading from cache
- Installing knplabs/knp-menu (2.3.0): Loading from cache
- Installing knplabs/knp-menu-bundle (v2.2.1): Loading from cache
- Installing sonata-project/admin-bundle (3.31.0): Loading from cache
Writing lock file
Generating autoload files
ocramius/package-versions:  Generating version class...
ocramius/package-versions: ...done generating version class
Symfony operations: 6 recipes (89fc0ac9074c34f190e534013d452b9c)
- Configuring twig/extensions (>=1.0): From github.com/symfony/recipes:master
- Configuring sonata-project/datagrid-bundle (>=2.3.1): From auto-generated re                                                                                                                                                                                               cipe
-  WARNING  sonata-project/core-bundle (>=3.9): From github.com/symfony/recipe                                                                                                                                                                                               s-contrib:master
The recipe for this package comes from the "contrib" repository, which is op                                                                                                                                                                                               en to community contributions.
Do you want to execute this recipe?
[y] Yes
[n] No
[a] Yes for all packages, only for the current installation session
[p] Yes permanently, never ask again for this project
(defaults to n): y
- Configuring sonata-project/core-bundle (>=3.9): From github.com/symfony/reci                                                                                                                                                                                               pes-contrib:master
- Configuring sonata-project/block-bundle (>=3.11.0): From auto-generated reci                                                                                                                                                                                               pe
- Configuring knplabs/knp-menu-bundle (>=v2.2.1): From auto-generated recipe
- Configuring sonata-project/admin-bundle (>=3.31.0): From auto-generated reci                                                                                                                                                                                               pe
Executing script cache:clear [KO]
[KO]
Script cache:clear returned with error code 1
!!
!!  In CheckExceptionOnInvalidReferenceBehaviorPass.php line 32:
!!                                                                                                                                                                                                                                                                             
!!    The service "sonata.admin.block.admin_list" has a dependency on a non-exis                                                                                                                                                                                               t
!!    ent service "templating".                                                                                                                                                                                                                                                
!!                                                                                                                                                                                                                                                                             
!!
!!

Installation failed, reverting ./composer.json to its original content.

covex-nn commented 6 years ago

@FabienPapet after composer create-project symfony/website-skeleton my-project do the following:

  1. Run composer require sonata-project/admin-bundle:3.x@dev

  2. Run composer require sonata-project/doctrine-orm-admin-bundle:3.x@dev

  3. Create new file config/packages/sonata_admin.yaml

    sonata_admin:
        title: 'Sonata Admin'
        dashboard:
            blocks:
                - { type: sonata.admin.block.admin_list, position: left }
    
    sonata_block:
        blocks:
            sonata.admin.block.admin_list:
                contexts: [admin]
  4. Create new file config/routes/sonata_admin.yaml

    admin_area:
        resource: "@SonataAdminBundle/Resources/config/routing/sonata_admin.xml"
        prefix: /admin
    
    _sonata_admin:
        resource: .
        type: sonata_admin
        prefix: /admin
  5. Run composer auto-scripts

Soon, it won't be necessary. It will be just create-project + require sonata-project/doctrine-orm-admin-bundle

covex-nn commented 6 years ago

@FabienPapet i've updated a comment, i forgot about AdminBundle configuration. Sorry =)

covex-nn commented 6 years ago

Updated again

fmanicone commented 6 years ago

i use these steps

but now i have this error

There are no registered paths for namespace "SonataCore" in @SonataAdmin/standard_layout.html.twig at line 329.

OskarStark commented 6 years ago

In which file?

fmanicone commented 6 years ago

admin/dashboard

Uncaught PHP Exception Twig_Error_Loader: "There are no registered paths for namespace "SonataCore" in "@SonataAdmin/standard_layout.html.twig" at line 329." at /shared/httpd/focunior/vendor/twig/twig/lib/Twig/Loader/Filesystem.php line 203

scotchjohn commented 6 years ago

I have the same error as @filippomanicone - I think it may relate to the ignoring of sonata-project/core-bundle the below output from composer require sonata-project/admin-bundle ...

Generating autoload files
Symfony operations: 8 recipes (6c8157f2f55bc9a122932d37ee4ee084)
  - Configuring twig/extensions (>=1.0): From github.com/symfony/recipes:master
  - Configuring symfony/translation (>=3.3): From github.com/symfony/recipes:master
  - Configuring symfony/security-bundle (>=3.3): From github.com/symfony/recipes:master
  - Configuring sonata-project/datagrid-bundle (>=2.3.1): From auto-generated recipe
  -  IGNORING  sonata-project/core-bundle (>=3.9): From github.com/symfony/recipes-contrib:master
  - Configuring sonata-project/block-bundle (>=3.12.0): From auto-generated recipe
  - Configuring knplabs/knp-menu-bundle (>=v2.2.1): From auto-generated recipe
  - Configuring sonata-project/admin-bundle (>=3.31.1): From auto-generated recipe
Executing script cache:clear
covex-nn commented 6 years ago

@scotchjohn you are right! There is There are no registered paths for namespace "SonataCore" in @SonataAdmin\standard_layout.html.twig at line 329. error message if i answer 'n' on Flex's question:

WARNING sonata-project/core-bundle (>=3.9): From github.com/symfony/recipes-contrib:master The recipe for this package comes from the "contrib" repository, which is open to community contributions. Do you want to execute this recipe? [y] Yes [n] No [a] Yes for all packages, only for the current installation session [p] Yes permanently, never ask again for this project (defaults to n): n

This is a bug in Flex and there is an issue about it https://github.com/symfony/flex/issues/291

After a recipe for sonata-project/admin-bundle will be created, there will be more errors after refusing to install packages from recipes-contrib =)

jordisala1991 commented 6 years ago

This can be finally closed since https://github.com/symfony/recipes-contrib/pull/264 is merged.

You can now do:

composer create-project symfony/website-skeleton my-project
cd my-project
composer require sonata-project/admin-bundle

and it will work as expected 🎉

Closing!

amoncif commented 5 years ago

hello, i have the same issue. There are no registered paths for namespace "SonataCore" in SonataAdminBundle::standard_layout.html.twig at line 327.

Thanks for help !

OskarStark commented 5 years ago

Please open a new issue ticket and follow the issue template. Thank you

rsuyambu commented 4 years ago

hello, I have the same issue. There are no registered paths for namespace "SonataCore" in @SonataAdmin/standard_layout.html.twig at line 327.

Thanks for help !

phansys commented 4 years ago

hello, I have the same issue. There are no registered paths for namespace "SonataCore" in @SonataAdmin/standard_layout.html.twig at line 327.

Thanks for help !

Please, see the previous comment: https://github.com/sonata-project/SonataAdminBundle/issues/4910#issuecomment-443403303.

Jihell commented 4 years ago

hello, I have the same issue. There are no registered paths for namespace "SonataCore" in @SonataAdmin/standard_layout.html.twig at line 327.

Thanks for help !

If there is a new ticket about this issue I couldn't find it. But in my case it was an error in my standard_layout.html.twig override. Just had to stick to the lastest version with my tweaks and it worked.