Getting an error when trying to install the orm
Here is the output when running composer require.
composer require "doctrine/orm:^2.6-dev"
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Generating autoload files
Executing script cache:clear [KO]
[KO]
Script cache:clear returned with error code 255
!!
!! Fatal error: Uncaught Symfony\Component\Debug\Exception\UndefinedMethodException: Attempted to call an undefined method named "setContainer" of class "Doctrine\Bundle\DoctrineBundle\Registry". in C:\Users\rpark\Desktop\symfony-template\vendor\doctrine\doctrine-bundle\Registry.php:41
!! Stack trace:
!! #0 C:\Users\rpark\Desktop\symfony-template\var\cache\dev\ContainerNxmGNek\getDoctrineService.php(8): Doctrine\Bundle\DoctrineBundle\Registry->__construct(Object(ContainerNxmGNek), Array, Array, 'default', 'default')
!! #1 C:\Users\rpark\Desktop\symfony-template\var\cache\dev\ContainerNxmGNek\Container.php(94): require('C:\\Users\\rpark\\...')
!! #2 C:\Users\rpark\Desktop\symfony-template\var\cache\dev\ContainerNxmGNek\getCacheWarmerService.php(13): ContainerNxmGNek->load('C:\\Users\\rpark\\...')
!! #3 C:\Users\rpark\Desktop\symfony-template\vendor\symfony\http-kernel\CacheWarmer\CacheWarmerAggregate.php(43): ContainerNxmGNek->{closure}()
!! #4 C:\Users\rpark\Desktop\symfony-template\vendor\symfony\http-kernel\Kernel.php(511): Symfony\Componen in C:\Users\rpark\Desktop\symfony-template\vendor\doctrine\doctrine-bundle\Registry.php on line 41
!!
!! PHP Fatal error: Uncaught Symfony\Component\Debug\Exception\UndefinedMethodException: Attempted to call an undefined method named "setContainer" of class "Doctrine\Bundle\DoctrineBundle\Registry". in C:\Users\rpark\Desktop\symfony-template\vendor\doctrine\doctrine-bundle\Registry.php:41
!! Stack trace:
!! #0 C:\Users\rpark\Desktop\symfony-template\var\cache\dev\ContainerNxmGNek\getDoctrineService.php(8): Doctrine\Bundle\DoctrineBundle\Registry->__construct(Object(ContainerNxmGNek), Array, Array, 'default', 'default')
!! #1 C:\Users\rpark\Desktop\symfony-template\var\cache\dev\ContainerNxmGNek\Container.php(94): require('C:\\Users\\rpark\\...')
!! #2 C:\Users\rpark\Desktop\symfony-template\var\cache\dev\ContainerNxmGNek\getCacheWarmerService.php(13): ContainerNxmGNek->load('C:\\Users\\rpark\\...')
!! #3 C:\Users\rpark\Desktop\symfony-template\vendor\symfony\http-kernel\CacheWarmer\CacheWarmerAggregate.php(43): ContainerNxmGNek->{closure}()
!! #4 C:\Users\rpark\Desktop\symfony-template\vendor\symfony\http-kernel\Kernel.php(511): Symfony\Componen in C:\Users\rpark\Desktop\symfony-template\vendor\doctrine\doctrine-bundle\Registry.php on line 41
!!
!!
Installation failed, reverting ./composer.json to its original content.
Here is my composer.json file
{
"type": "project",
"license": "proprietary",
"minimum-stability": "beta",
"require": {
"php": "^7.0.8",
"sensio/framework-extra-bundle": "^5.0",
"symfony/console": "^4.0",
"symfony/flex": "^1.0",
"symfony/framework-bundle": "^4.0",
"symfony/lts": "^4@dev",
"symfony/twig-bundle": "^4.0@beta",
"symfony/web-profiler-bundle": "^4.0@beta",
"symfony/webpack-encore-pack": "^1.0",
"symfony/yaml": "^4.0"
},
"require-dev": {
"symfony/dotenv": "^4.0",
"symfony/web-server-bundle": "^4@dev"
},
"config": {
"preferred-install": {
"*": "dist"
},
"sort-packages": true
},
"autoload": {
"psr-4": {
"App\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"App\\Tests\\": "tests/"
}
},
"scripts": {
"auto-scripts": {
"cache:clear": "symfony-cmd",
"assets:install --symlink --relative %PUBLIC_DIR%": "symfony-cmd"
},
"post-install-cmd": [
"@auto-scripts"
],
"post-update-cmd": [
"@auto-scripts"
]
},
"conflict": {
"symfony/symfony": "*"
},
"extra": {
"symfony": {
"id": "01BWYDEM7TY26M6PSQCVJE2DN3",
"allow-contrib": false
}
}
}
The same problem occurs with Symfony 3.4-beta1 and flex :
php composer.phar update -n --no-progress --no-suggest --ansi
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 7 installs, 41 updates, 3 removals
- Updating symfony/debug (v3.3.10 => v3.4.0-BETA1): Downloading (100%)
- Updating symfony/yaml (v3.3.10 => v3.4.0-BETA1): Downloading (100%)
- Updating symfony/finder (v3.3.10 => v3.4.0-BETA1): Downloading (100%)
- Updating symfony/routing (v3.3.10 => v3.4.0-BETA1): Downloading (100%)
- Updating symfony/translation (v3.3.10 => v3.4.0-BETA1): Downloading (100%)
- Updating symfony/validator (v3.3.10 => v3.4.0-BETA1): Downloading (100%)
- Updating symfony/inflector (v3.3.10 => v4.0.0-BETA1): Downloading (100%)
- Updating symfony/property-access (v3.3.10 => v4.0.0-BETA1): Downloading (100%)
- Updating symfony/options-resolver (v3.3.10 => v4.0.0-BETA1): Downloading (100%)
- Updating symfony/intl (v3.3.10 => v4.0.0-BETA1): Downloading (100%)
- Updating symfony/event-dispatcher (v3.3.10 => v3.4.0-BETA1): Downloading (100%)
- Updating symfony/form (v3.3.10 => v3.4.0-BETA1): Downloading (100%)
- Updating symfony/console (v3.3.10 => v3.4.0-BETA1): Downloading (100%)
- Updating symfony/http-foundation (v3.3.10 => v3.4.0-BETA1): Downloading (100%)
- Updating symfony/http-kernel (v3.3.10 => v3.4.0-BETA1): Downloading (100%)
- Updating symfony/security (v3.3.10 => v3.4.0-BETA1): Downloading (100%)
- Updating symfony/dependency-injection (v3.3.10 => v3.4.0-BETA1): Downloading (100%)
- Updating symfony/security-bundle (v3.3.10 => v3.4.0-BETA1): Downloading (100%)
- Updating symfony/filesystem (v3.3.10 => v4.0.0-BETA1): Downloading (100%)
- Updating symfony/config (v3.3.10 => v3.4.0-BETA1): Downloading (100%)
- Updating symfony/class-loader (v3.3.10 => v3.4.0-BETA1): Downloading (100%)
- Updating symfony/cache (v3.3.10 => v4.0.0-BETA1): Downloading (100%)
- Updating symfony/framework-bundle (v3.3.10 => v3.4.0-BETA1): Downloading (100%)
- Updating symfony/templating (v3.3.10 => v3.4.0-BETA1): Downloading (100%)
- Updating symfony/twig-bridge (v3.3.10 => v4.0.0-BETA1): Downloading (100%)
- Updating symfony/twig-bundle (v3.3.10 => v3.4.0-BETA1): Downloading (100%)
- Updating symfony/asset (v3.3.10 => v3.4.0-BETA1): Downloading (100%)
- Updating symfony/serializer (v3.3.10 => v3.4.0-BETA1): Downloading (100%)
- Updating symfony/swiftmailer-bundle (v3.1.5 => v2.6.7): Downloading (100%)
- Updating symfony/dom-crawler (v3.3.10 => v4.0.0-BETA1): Downloading (100%)
- Updating symfony/browser-kit (v3.3.10 => v3.4.0-BETA1): Downloading (100%)
- Updating symfony/dotenv (v3.3.10 => v3.4.0-BETA1): Downloading (100%)
- Updating symfony/phpunit-bridge (v3.3.10 => v3.4.0-BETA1): Downloading (100%)
- Updating symfony/process (v3.3.10 => v4.0.0-BETA1): Downloading (100%)
- Updating symfony/web-server-bundle (v3.3.10 => v3.4.0-BETA1): Downloading (100%)
- Updating symfony/monolog-bridge (v3.3.10 => v4.0.0-BETA1): Downloading (100%)
- Updating myclabs/deep-copy (1.6.1 => 1.7.0): Downloading (100%)
- Updating symfony/doctrine-bridge (v3.3.10 => v4.0.0-BETA1): Downloading (100%)
Writing lock file
Generating autoload files
Executing script cache:warmup [KO]
[KO]
Script cache:warmup returned with error code 255
!!
!! Fatal error: Uncaught Symfony\Component\Debug\Exception\UndefinedMethodException: Attempted to call an undefined method named "setContainer" of class "Doctrine\Bundle\DoctrineBundle\Registry". in /builds/foobar/vendor/doctrine/doctrine-bundle/Registry.php:41
!! Stack trace:
!! #0 /builds/foobar/var/cache/dev/ContainerMaxtxgm/getDoctrineService.php(8): Doctrine\Bundle\DoctrineBundle\Registry->__construct(Object(ContainerMaxtxgm), Array, Array, 'default', 'default')
!! #1 /builds/foobar/var/cache/dev/ContainerMaxtxgm/Container.php(756): require('/builds/foobar...')
!! #2 /builds/foobar/var/cache/dev/ContainerMaxtxgm/getValidator_BuilderService.php(30): ContainerMaxtxgm->load('/builds/foobar...')
!! #3 /builds/foobar/var/cache/dev/ContainerMaxtxgm/Container.php(756): require('/builds/foobar...')
!! #4 /builds/foobar/var/cache/dev/ContainerMaxtxgm/getCacheWarmerService.php(9): ContainerMaxtxgm->load('/builds/foobar. in /builds/foobar/vendor/doctrine/doctrine-bundle/Registry.php on line 41
!!
!!
ERROR: Job failed: exit code 1
Dependencies:
"minimum-stability": "beta",
"require": {
"php": "^7.1.0",
"doctrine/doctrine-bundle": "^1.7",
"doctrine/orm": "^2.5",
"sensio/framework-extra-bundle": "^5.0",
"symfony/asset": "^3.3",
"symfony/flex": "^1.0",
"symfony/framework-bundle": "^3.3",
"symfony/monolog-bundle": "^3.1",
"symfony/orm-pack": "^1.0",
"symfony/serializer": "^3.3",
"symfony/swiftmailer-bundle": "~2.6",
"symfony/translation": "^3.3",
"symfony/twig-bundle": "^3.3",
"symfony/validator": "^3.3",
"symfony/yaml": "^3.3"
},
which version of DoctrineBundle are you using ?
I've updated my previous post with dependencies.
Output of composer show
beberlei/assert v2.7.8 Thin assertion library for input validation in business models.
doctrine/annotations v1.5.0 Docblock Annotations Parser
doctrine/cache v1.7.1 Caching library offering an object-oriented API for many cache ...
doctrine/collections v1.5.0 Collections Abstraction library
doctrine/common v2.8.1 Common Library for Doctrine projects
doctrine/data-fixtures v1.2.2 Data Fixtures for all Doctrine Object Managers
doctrine/dbal v2.6.2 Database Abstraction Layer
doctrine/doctrine-bundle 1.7.1 Symfony DoctrineBundle
doctrine/doctrine-cache-bundle 1.3.2 Symfony Bundle for Doctrine Cache
doctrine/doctrine-fixtures-bundle v2.4.0 Symfony DoctrineFixturesBundle
doctrine/inflector v1.2.0 Common String Manipulations with regard to casing and singular/...
doctrine/instantiator 1.1.0 A small, lightweight utility to instantiate objects in PHP with...
doctrine/lexer v1.0.1 Base library for a lexer that can be used in Top-Down, Recursiv...
doctrine/orm v2.5.11 Object-Relational-Mapper for PHP
friendsofsymfony/rest-bundle 2.2.0 This Bundle provides various tools to rapidly develop RESTful A...
friendsofsymfony/user-bundle v2.0.1 Symfony FOSUserBundle
guzzlehttp/guzzle 6.3.0 Guzzle is a PHP HTTP client library
guzzlehttp/promises v1.3.1 Guzzle promises library
guzzlehttp/psr7 1.4.2 PSR-7 message implementation that also provides common utility ...
jdorn/sql-formatter v1.2.17 a PHP SQL highlighting library
lexik/jwt-authentication-bundle v2.4.2 This bundle provides JWT authentication for your Symfony REST API
mailjet/mailjet-apiv3-php v1.2.0 PHP wrapper for the Mailjet API
mailjet/mailjet-bundle 1.0.3 Symfony bundle for Mailjet API V3
mailjet/mailjet-swiftmailer 1.0.5 A SwiftMailer transport implementation for Mailjet
monolog/monolog 1.23.0 Sends your logs to files, sockets, inboxes, databases and vario...
myclabs/deep-copy 1.7.0 Create deep copies (clones) of your objects
namshi/jose 7.2.3 JSON Object Signing and Encryption library for PHP.
nelmio/cors-bundle 1.5.3 Adds CORS (Cross-Origin Resource Sharing) headers support in yo...
paragonie/random_compat v2.0.11 PHP 5.x polyfill for random_bytes() and random_int() from PHP 7
phar-io/manifest 1.0.1 Component for reading phar.io manifest information from a PHP A...
phar-io/version 1.0.1 Library for handling version information and constraints
phpdocumentor/reflection-common 1.0.1 Common reflection classes used by phpdocumentor to reflect the ...
phpdocumentor/reflection-docblock 4.1.1 With this component, a library can provide support for annotati...
phpdocumentor/type-resolver 0.4.0
phpspec/prophecy v1.7.2 Highly opinionated mocking framework for PHP 5.3+
phpunit/php-code-coverage 5.2.2 Library that provides collection, processing, and rendering fun...
phpunit/php-file-iterator 1.4.2 FilterIterator implementation that filters files based on a lis...
phpunit/php-text-template 1.2.1 Simple template engine.
phpunit/php-timer 1.0.9 Utility class for timing
phpunit/php-token-stream 2.0.1 Wrapper around PHP's tokenizer extension.
phpunit/phpunit 6.4.3 The PHP Unit Testing framework.
phpunit/phpunit-mock-objects 4.0.4 Mock Object library for PHPUnit
psr/cache 1.0.1 Common interface for caching libraries
psr/container 1.0.0 Common Container Interface (PHP FIG PSR-11)
psr/http-message 1.0.1 Common interface for HTTP messages
psr/log 1.0.2 Common interface for logging libraries
psr/simple-cache 1.0.0 Common interfaces for simple caching
sebastian/code-unit-reverse-lookup 1.0.1 Looks up which function or method a line of code belongs to
sebastian/comparator 2.0.2 Provides the functionality to compare PHP values for equality
sebastian/diff 2.0.1 Diff implementation
sebastian/environment 3.1.0 Provides functionality to handle HHVM/PHP environments
sebastian/exporter 3.1.0 Provides the functionality to export PHP variables for visualiz...
sebastian/global-state 2.0.0 Snapshotting of global state
sebastian/object-enumerator 3.0.3 Traverses array structures and object graphs to enumerate all r...
sebastian/object-reflector 1.1.1 Allows reflection of object attributes, including inherited and...
sebastian/recursion-context 3.0.0 Provides functionality to recursively process PHP variables
sebastian/resource-operations 1.0.0 Provides a list of PHP built-in functions that operate on resou...
sebastian/version 2.0.1 Library that helps with managing the version number of Git-host...
sensio/framework-extra-bundle v5.0.1 This bundle provides a way to configure your controllers with a...
simple-bus/doctrine-orm-bridge v5.0.0 Doctrine ORM bridge for using command and event buses
simple-bus/message-bus v3.0.0 Generic classes and interfaces for messages and message buses
simple-bus/symfony-bridge v5.0.0 Bridge for using command buses and event buses in Symfony projects
swiftmailer/swiftmailer v5.4.8 Swiftmailer, free feature-rich PHP mailer
symfony/asset v3.4.0-BETA1 Symfony Asset Component
symfony/browser-kit v3.4.0-BETA1 Symfony BrowserKit Component
symfony/cache v4.0.0-BETA1 Symfony Cache component with PSR-6, PSR-16, and tags
symfony/class-loader v3.4.0-BETA1 Symfony ClassLoader Component
symfony/config v3.4.0-BETA1 Symfony Config Component
symfony/console v3.4.0-BETA1 Symfony Console Component
symfony/debug v3.4.0-BETA1 Symfony Debug Component
symfony/dependency-injection v3.4.0-BETA1 Symfony DependencyInjection Component
symfony/doctrine-bridge v4.0.0-BETA1 Symfony Doctrine Bridge
symfony/dom-crawler v4.0.0-BETA1 Symfony DomCrawler Component
symfony/dotenv v3.4.0-BETA1 Registers environment variables from a .env file
symfony/event-dispatcher v3.4.0-BETA1 Symfony EventDispatcher Component
symfony/filesystem v4.0.0-BETA1 Symfony Filesystem Component
symfony/finder v3.4.0-BETA1 Symfony Finder Component
symfony/flex v1.0.32
symfony/form v3.4.0-BETA1 Symfony Form Component
symfony/framework-bundle v3.4.0-BETA1 Symfony FrameworkBundle
symfony/http-foundation v3.4.0-BETA1 Symfony HttpFoundation Component
symfony/http-kernel v3.4.0-BETA1 Symfony HttpKernel Component
symfony/inflector v4.0.0-BETA1 Symfony Inflector Component
symfony/intl v4.0.0-BETA1 A PHP replacement layer for the C intl extension that includes ...
symfony/monolog-bridge v4.0.0-BETA1 Symfony Monolog Bridge
symfony/monolog-bundle v3.1.1 Symfony MonologBundle
symfony/options-resolver v4.0.0-BETA1 Symfony OptionsResolver Component
symfony/orm-pack v1.0.3 A pack for the Doctrine ORM
symfony/phpunit-bridge v3.4.0-BETA1 Symfony PHPUnit Bridge
symfony/polyfill-intl-icu v1.6.0 Symfony polyfill for intl's ICU-related data and classes
symfony/polyfill-mbstring v1.6.0 Symfony polyfill for the Mbstring extension
symfony/polyfill-php56 v1.6.0 Symfony polyfill backporting some PHP 5.6+ features to lower PH...
symfony/polyfill-php70 v1.6.0 Symfony polyfill backporting some PHP 7.0+ features to lower PH...
symfony/polyfill-util v1.6.0 Symfony utilities for portability of PHP codes
symfony/process v4.0.0-BETA1 Symfony Process Component
symfony/property-access v4.0.0-BETA1 Symfony PropertyAccess Component
symfony/routing v3.4.0-BETA1 Symfony Routing Component
symfony/security v3.4.0-BETA1 Symfony Security Component
symfony/security-bundle v3.4.0-BETA1 Symfony SecurityBundle
symfony/serializer v3.4.0-BETA1 Symfony Serializer Component
symfony/swiftmailer-bundle v2.6.7 Symfony SwiftmailerBundle
symfony/templating v3.4.0-BETA1 Symfony Templating Component
symfony/translation v3.4.0-BETA1 Symfony Translation Component
symfony/twig-bridge v4.0.0-BETA1 Symfony Twig Bridge
symfony/twig-bundle v3.4.0-BETA1 Symfony TwigBundle
symfony/validator v3.4.0-BETA1 Symfony Validator Component
symfony/web-server-bundle v3.4.0-BETA1 Symfony WebServerBundle
symfony/yaml v3.4.0-BETA1 Symfony Yaml Component
theseer/tokenizer 1.1.0 A small library for converting tokenized PHP source code into X...
twig/twig v2.4.4 Twig, the flexible, fast, and secure template language for PHP
webmozart/assert 1.2.0 Assertions to validate method input/output with nice error mess...
willdurand/jsonp-callback-validator v1.1.0 JSONP callback validator.
willdurand/negotiation v2.3.1 Content Negotiation tools for PHP provided as a standalone libr...
hmm, we need a new 1.7.x release with the latest bug fixes in them. The 1.6.x branch has been released, but not 1.7.x.
Doctrine 2.5.12 is now tagged and is now compatible with Symfony 4. I can confirm that I get the error with 1.7.1, but by locking to 1.6.13 it works fine:
"doctrine/doctrine-bundle": "1.6.13",
As @stof said, I think it it is just missing the 3.4-> updates from https://github.com/doctrine/DoctrineBundle/commit/1977fd5416f467be0c6b9996fe2a46eed67c4915
The error goes aways with 1.7.x-dev.
for me 1.6.13 and 1.7.x-dev now work but 1.7.0 and 1.7.1 do not but since dev has the fix I am closing this.
Most helpful comment
Doctrine 2.5.12 is now tagged and is now compatible with Symfony 4. I can confirm that I get the error with 1.7.1, but by locking to 1.6.13 it works fine:
As @stof said, I think it it is just missing the 3.4-> updates from https://github.com/doctrine/DoctrineBundle/commit/1977fd5416f467be0c6b9996fe2a46eed67c4915