Problem with #template annotation after composer update - symfony

I updated Doctrine to newest version in my Sylius project. After update i am receiving following error.
[Semantical Error] The annotation "#template" in class Doctrine\Common\Collections\ArrayCollection was never imported. Did you maybe forget to add a "use" statement for this annotation?
Can anybody help me?
Update Log:
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 3 installs, 5 updates, 0 removals
- Updating doctrine/collections (v1.3.0 => v1.6.0): Loading from cache
- Installing doctrine/reflection (v1.0.0): Loading from cache
- Installing doctrine/event-manager (v1.0.0): Loading from cache
- Installing doctrine/persistence (v1.1.0): Loading from cache
- Updating doctrine/common (v2.8.1 => v2.10.0): Loading from cache
- Updating doctrine/dbal (v2.6.3 => v2.9.2): Loading from cache
- Updating doctrine/orm (v2.5.14 => v2.6.3): Loading from cache
- Updating symfony/doctrine-bridge (v4.1.11 => v4.2.4): Loading from cache
Package phpunit/phpunit-mock-objects is abandoned, you should avoid using it. No replacement was suggested.
Package symplify/token-runner is abandoned, you should avoid using it. Use https://github.com/symplify/codingstandard instead.
Writing lock file
Generating autoload files
muglug/package-versions-56: Generating version class...
muglug/package-versions-56: ...done generating version class
ocramius/package-versions: Generating version class...
ocramius/package-versions: ...done generating version class
What about running composer thanks now?
This will spread some 💖 by sending a ★ to 271 GitHub repositories of your fellow package maintainers.
Executing script cache:clear [OK]
Executing script assets:install public [OK]

I has the same error when auto updating doctrine/collections (v1.5.0 => v1.6.0).
Try to use v1.5.0 version.

Same problem, this seem like one of your dependency in require or require-dev have a broken dependency. Try upgrading only the dependency you need. If you upgrade one and that it fail with this error, report the bug to the maintainer.

so yes - if you will perform a downgrade of package doctrine/collection, to version 1.5, everything works well.
Here is some info:
https://github.com/doctrine/collections/issues/180

This issue was fixed in 1.6.1 release. Just run a composer update and it should be solved. See the release details here for more info.

Related

Cant install sonata admin with symfony 5

$ composer require sonata-project/admin-bundle
Using version ^3.87 for sonata-project/admin-bundle
./composer.json has been updated
Running composer update sonata-project/admin-bundle
Loading composer repositories with package information
Restricting packages listed in "symfony/symfony" to "5.2.*"
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- sonata-project/admin-bundle[3.87.0, ..., 3.x-dev] require symfony/console ^4.4 -> found symfony/console[v4.4.0-BETA1, ..., 4.4.x-dev] but it conflicts with your root composer.json require (5.2.*).
- Root composer.json requires sonata-project/admin-bundle ^3.87 -> satisfiable by sonata-project/admin-bundle[3.87.0, 3.x-dev].
Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.
Installation failed, reverting ./composer.json and ./composer.lock to their original content.
My suggestion is to use EasyAdmin bundle which is compatible with Symfony 5.3. It has only one bug which is related to viewing images thumbnail in easyadmin panel. For now the only solution is to use TextareaField instead of ImageField in DasboardCrudController.
According to an issue from their tracker and packagist.org, the most recent version of that package (which is 3.87.0) is not fully compatible with Symfony 5. You either need to wait until this is resolved, or downgrade Symfony in your application to v4.4

Deprecated debug package:

I have found a PHP Notice in the logs:
[info] User Deprecated: The "Symfony\Component\Debug\ErrorHandler" class is deprecated since Symfony 4.4, use "Symfony\Component\ErrorHandler\ErrorHandler" instead.
This code is invoked from Vendor folder, so I have been checking what package is using this package. I have found that the package symfony/monolog-bundle is the problem.
I am using:
https://packagist.org/packages/symfony/monolog-bundle#v3.6.0
It requires: https://packagist.org/packages/symfony/http-kernel#v4.3.11
It requires the problematic package: https://packagist.org/packages/symfony/debug
I have been trying to upgrade the package http-kernel to a newest version which not using symfony debug, it means from http-kernel>v5.0
I am executing this code and receiving this error:
MacBook-Pro-de-Pablo-Garces:cp-igw pgarces$ composer require "symfony/error-handler:5.0.*"
./composer.json has been updated
Running composer update symfony/error-handler
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- symfony/http-kernel[v4.4.0, ..., v4.4.18] require symfony/error-handler ^4.4 -> found symfony/error-handler[v4.4.0, ..., v4.4.18] but it conflicts with your root composer.json require (5.0.*).
- Root composer.json requires symfony/http-kernel ^4.4 -> satisfiable by symfony/http-kernel[v4.4.0, ..., v4.4.18].
How can I solve it?

Symfony 4 site, after composer update, now stuck in update loop of PHP Fatal Errors?

I've a Symfony 4.0.8 site.
A few days ago, all was working. Since that time, I've made NO code or config changes.
I have run a number of both 'composer' and 'yarn' updates.
Currently, I'm unable to update or access the site.
I'm stuck in a "PHP fatal error" composer update loop -- and, iiuc, there's a problem with autoloading.
Here's what I'm seeing
cat composer.json
...
"autoload": {
"psr-4": {
"App\\": "src/"
}
},
...
composer dump-autoload
Generating autoload files
composer clear-cache
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Cache directory does not exist (cache-vcs-dir):
Clearing cache (cache-repo-dir): /root/.composer/cache/repo
Clearing cache (cache-files-dir): /root/.composer/cache/files
Clearing cache (cache-dir): /root/.composer/cache
redis-cli flushall
OK
composer update
1/1: http://packagist.org/p/provider-latest$ab716f1fe302ba4a374535db44b1ad22b3e9b9030c6e62892e9a7afac81b8c74.json
Finished: success: 1, skipped: 0, failure: 0, total: 1
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)
Prefetching 7 packages 🎶
- Downloading (100%)
Package operations: 7 installs, 0 updates, 0 removals
- Installing friendsofsymfony/http-cache-bundle (dev-master 6b75eba): Loading from cache
- Installing snc/redis-bundle (dev-master b133296): Loading from cache
- Installing solarium/solarium (4.0.0-rc.1): Loading from cache
- Installing symfony-cmf/block-bundle (dev-master 952b171): Loading from cache
- Installing symfony-cmf/menu-bundle (dev-master 5c6bd22): Loading from cache
- Installing symfony-cmf/routing-auto-bundle (dev-master ab9fa1d): Loading from cache
- Installing symfony-cmf/tree-browser-bundle (dev-master 14ddf7d): Loading from cache
Writing lock file
Generating autoload files
ocramius/package-versions: Generating version class...
ocramius/package-versions: ...done generating version class
Executing script cache:clear [OK]
Executing script assets:install --symlink --relative public [OK]
Executing script security-checker security:check [OK]
composer update
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: 0 installs, 0 updates, 0 removals
Writing lock file
Generating autoload files
ocramius/package-versions: Generating version class...
ocramius/package-versions: ...done generating version class
Executing script cache:clear [KO]
[KO]
Script cache:clear returned with error code 255
!! PHP Fatal error: Uncaught Symfony\Component\Debug\Exception\ClassNotFoundException: Attempted to load class "CmfMenuBundle" from namespace "Symfony\Cmf\Bundle\MenuBundle".
!! Did you forget a "use" statement for another namespace? in /opt/test/src/Kernel.php:32
!! Stack trace:
!! #0 /opt/test/vendor/symfony/http-kernel/Kernel.php(403): App\Kernel->registerBundles()
!! #1 /opt/test/vendor/symfony/http-kernel/Kernel.php(122): Symfony\Component\HttpKernel\Kernel->initializeBundles()
!! #2 /opt/test/vendor/symfony/framework-bundle/Console/Application.php(64): Symfony\Component\HttpKernel\Kernel->boot()
!! #3 /opt/test/vendor/symfony/console/Application.php(143): Symfony\Bundle\FrameworkBundle\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(S in /opt/test/src/Kernel.php on line 32
!!
Script #auto-scripts was called via post-update-cmd
composer update
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, 0 updates, 0 removals
- Installing friendsofsymfony/http-cache-bundle (dev-master 6b75eba): Loading from cache
- Installing snc/redis-bundle (dev-master b133296): Loading from cache
- Installing solarium/solarium (4.0.0-rc.1): Loading from cache
- Installing symfony-cmf/block-bundle (dev-master 952b171): Loading from cache
- Installing symfony-cmf/menu-bundle (dev-master 5c6bd22): Loading from cache
- Installing symfony-cmf/routing-auto-bundle (dev-master ab9fa1d): Loading from cache
- Installing symfony-cmf/tree-browser-bundle (dev-master 14ddf7d): Loading from cache
Writing lock file
Generating autoload files
ocramius/package-versions: Generating version class...
ocramius/package-versions: ...done generating version class
Executing script cache:clear [OK]
Executing script assets:install --symlink --relative public [OK]
Executing script security-checker security:check [OK]
composer update
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: 0 installs, 0 updates, 0 removals
Writing lock file
Generating autoload files
ocramius/package-versions: Generating version class...
ocramius/package-versions: ...done generating version class
Executing script cache:clear [KO]
[KO]
Script cache:clear returned with error code 255
!! PHP Fatal error: Uncaught Symfony\Component\Debug\Exception\ClassNotFoundException: Attempted to load class "CmfMenuBundle" from namespace "Symfony\Cmf\Bundle\MenuBundle".
!! Did you forget a "use" statement for another namespace? in /opt/test/src/Kernel.php:32
!! Stack trace:
!! #0 /opt/test/vendor/symfony/http-kernel/Kernel.php(403): App\Kernel->registerBundles()
!! #1 /opt/test/vendor/symfony/http-kernel/Kernel.php(122): Symfony\Component\HttpKernel\Kernel->initializeBundles()
!! #2 /opt/test/vendor/symfony/framework-bundle/Console/Application.php(64): Symfony\Component\HttpKernel\Kernel->boot()
!! #3 /opt/test/vendor/symfony/console/Application.php(143): Symfony\Bundle\FrameworkBundle\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(S in /opt/test/src/Kernel.php on line 32
!!
Script #auto-scripts was called via post-update-cmd
Removing/disabling Bundles isn't the solution here -- again, everything was recently working, with all current bundles installed.
'Something' in that number of composer/yarn upgrades is causing this.
The question's what?
Given that the error states "class "CmfMenuBundle" from namespace "Symfony\Cmf\Bundle\MenuBundle"" it seems that there is some type of problem with CmfMenuBundle update.
Modify your composer.json to specify that your project should use the previous version of the cmfMenuBundle, then run the composer install command which should install the specific version specified.
As I mentioned, removing/disabling Bundles isn't the solution here; Bundle versions are, apparently, also irrelevant.
Turns out the problem is current composer release, v1.6.4.
https://github.com/composer/composer/issues/7268
Drop back to composer v1.6.3 cures all.

Problems installing Microsoft.Owin (for SignalR)

I'm trying to experiment with SignalR by adding it to an existing (but small) ASP.Net (.Net 4.6.1, VS 2017) web application. However, I'm having real problems getting the Nuget package installed; more specifically the Microsoft.Owin component (which appears to be a dependency).
I've followed the instructions here, but as soon as I try to install Owin - either explicitly, or indirectly by trying to install the main SignalR package, and regardless of whether it's via Package Manager or Package Manager Console - I get the error:
PM> Install-Package Microsoft.Owin
Attempting to gather dependency information for package 'Microsoft.Owin.4.0.0' with respect to project
'SignalRProject', targeting '.NETFramework,Version=v4.6.1'
Gathering dependency information took 43.64 ms Attempting to resolve
dependencies for package 'Microsoft.Owin.4.0.0' with
DependencyBehavior 'Lowest'
Resolving dependency information took 0 ms
Resolving actions to install package 'Microsoft.Owin.4.0.0'
Resolved
actions to install package 'Microsoft.Owin.4.0.0'
Retrieving package
'Microsoft.Owin 4.0.0' from 'nuget.org'.
Retrieving package 'Owin 1.0.0' from 'nuget.org'.
Adding package 'Owin.1.0.0' to folder 'c:\code\SignalRProject\packages'
Install failed. Rolling back...
Package 'Owin.1.0.0' does not exist in project
'SignalRProject'
Removing package 'Owin.1.0.0' from folder
'c:\code\SignalRProject\packages'
Install-Package : TF400024: The
change on c:\code\SignalRProject\packages\Owin.1.0\Owin.1.0.nupkg
cannot be undone because a file already exists at
c:\code\SignalRProject\packages\Owin.1.0\Owin.1.0.nupkg. The file
must be deleted from disk for the undo to succeed.
I've tried the Owin.1.0.nupkg file, and the parent directory itself, but after restarting VS I continue to get the error. I've tried upgrading to .Net 4.7.1, but to no effect. How can I find out what's causing the Owin install error?
You could donwload a running microsoft example and then compare with yours https://code.msdn.microsoft.com/Getting-Started-with-c366b2f3
Install-Package : TF400024: The change on
c:\code\SignalRProject\packages\Owin.1.0\Owin.1.0.nupkg cannot be
undone because a file already exists at
c:\code\SignalRProject\packages\Owin.1.0\Owin.1.0.nupkg. The file must
be deleted from disk for the undo to succeed.
This error is caused by TFVC source control. You should first check-in your changes and then install nuget packages
I've managed to work around my issue, and get Owin (and SignalR) installed by using the 3rd-party Paket Nuget alternative.
>paket.exe add Microsoft.Owin --project SignalRProject
Paket version 5.148.0
Dependencies files saved to c:\code\SignalRProject\paket.dependencies
Adding package Microsoft.Owin to c:\code\SignalRProject\paket.references into group Main
References file saved to c:\code\SignalRProject\paket.references
- Creating model and downloading packages.
- paket.references -> SignalRProject.csproj
Performance:
- Disk IO: 63 milliseconds
- Runtime: 6 seconds

Sonata Easy-Extends bundle won't install

I am trying to set up the Sonata User Bundle. As per the instructions I am also trying to install Sonata Easy-Extends (according to these instructions).
Unfortunately, I can't get Easy-Extends installed via composer (on Win7):
>composer require sonata-project/easy-extends-bundle
Please provide a version constraint for the sonata-project/easy-extends-bundle requirement: dev-master
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- The requested package sonata-project/easy-extends-bundle could not be found in any version, there may be a typo in the package name.
Problem 2
- Installation request for symfony/framework-standard-edition 2.5.x-dev -> satisfiable by symfony/framework-standard-edition[2.5.x-dev].
- symfony/framework-standard-edition 2.5.x-dev requires sonata-project/easy-extends-bundle 2.0 -> no matching package found.
Potential causes:
- A typo in the package name
- The package is not available in a stable-enough version according to your minimum-stability setting
see <https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> for more details.
Read <http://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.
Installation failed, reverting ./composer.json to its original content.
I have tried various version constraints, including 2.0 as suggested in the instructions.
What am I missing?
TIA
Matt
Based on a discussion in the sonata-users Google group, I managed to install the bundle by manually adding the following to my composer.json:
...
"sonata-project/easy-extends-bundle": "dev-master",
...
Related thread in GG can be found here.

Resources