sonata-project/sonata-doctrine-extensions

The annotation "@extends" in class Sonata\Doctrine\Entity\BaseEntityManager was never imported

IwfY opened this issue ยท 11 comments

IwfY commented

Environment

Symfony 4.4 application on Apache on Linux and Windows.

Sonata packages

sonata-project/admin-bundle              3.62.1 3.63.0 The missing Symfony Admin Generator
sonata-project/block-bundle              3.18.4 3.18.4 Symfony SonataBlockBundle
sonata-project/cache                     2.0.1  2.0.1  Cache library
sonata-project/core-bundle               3.18.0 3.18.0 Symfony SonataCoreBundle (abandoned)
sonata-project/datagrid-bundle           2.5.0  3.1.1  Symfony SonataDatagridBundle
sonata-project/doctrine-extensions       1.6.0  1.6.0  Doctrine2 behavioral extensions
sonata-project/doctrine-orm-admin-bundle 3.15.0 3.15.0 Symfony Sonata / Integrate Doctrine ORM into the SonataAdminBundle
sonata-project/easy-extends-bundle       2.5.0  2.5.0  Symfony SonataEasyExtendsBundle
sonata-project/exporter                  2.2.0  2.2.0  Lightweight Exporter library
sonata-project/media-bundle              3.24.0 3.24.0 Symfony SonataMediaBundle
sonata-project/user-bundle               4.5.2  4.5.2  Symfony SonataUserBundle

Symfony packages

symfony/contracts             v1.1.8  v2.0.1  A set of abstractions extracted out of the Symfony components
symfony/monolog-bundle        v3.5.0  v3.5.0  Symfony MonologBundle
symfony/phpunit-bridge        v4.4.5  v5.0.5  Symfony PHPUnit Bridge
symfony/polyfill-apcu         v1.14.0 v1.14.0 Symfony polyfill backporting apcu_* functions to lower PHP versions
symfony/polyfill-ctype        v1.14.0 v1.14.0 Symfony polyfill for ctype functions
symfony/polyfill-iconv        v1.14.0 v1.14.0 Symfony polyfill for the Iconv extension
symfony/polyfill-intl-icu     v1.14.0 v1.14.0 Symfony polyfill for intl's ICU-related data and classes
symfony/polyfill-intl-idn     v1.14.0 v1.14.0 Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions
symfony/polyfill-mbstring     v1.14.0 v1.14.0 Symfony polyfill for the Mbstring extension
symfony/polyfill-php56        v1.14.0 v1.14.0 Symfony polyfill backporting some PHP 5.6+ features to lower PHP versions
symfony/polyfill-php72        v1.14.0 v1.14.0 Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions
symfony/polyfill-php73        v1.14.0 v1.14.0 Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions
symfony/polyfill-util         v1.14.0 v1.14.0 Symfony utilities for portability of PHP codes
symfony/security-acl          v3.0.4  v3.0.4  Symfony Security Component - ACL (Access Control List)
symfony/swiftmailer-bundle    v3.4.0  v3.4.0  Symfony SwiftmailerBundle
symfony/symfony               v4.4.5  v5.0.5  The Symfony PHP framework
symfony/webpack-encore-bundle v1.7.3  v1.7.3  Integration with your Symfony app & Webpack Encore!

Doctrine packages

doctrine/annotations                v1.8.0  v1.8.0  Docblock Annotations Parser
doctrine/cache                      1.10.0  1.10.0  PHP Doctrine Cache library is a popular cache implementation that supports many different drivers such as redis, memcache, apc, mongodb and others.
doctrine/collections                1.6.4   1.6.4   PHP Doctrine Collections library that adds additional functionality on top of PHP arrays.
doctrine/common                     2.12.0  2.12.0  PHP Doctrine Common project is a library that provides additional functionality that other Doctrine projects depend on such as better reflection support, persistence interfaces, proxies, event system and much more.
doctrine/data-fixtures              1.4.2   1.4.2   Data Fixtures for all Doctrine Object Managers
doctrine/dbal                       v2.10.1 v2.10.1 Powerful PHP database abstraction layer (DBAL) with many features for database schema introspection and management.
doctrine/doctrine-bundle            1.12.7  2.0.7   Symfony DoctrineBundle
doctrine/doctrine-cache-bundle      1.4.0   1.4.0   Symfony Bundle for Doctrine Cache
doctrine/doctrine-fixtures-bundle   3.3.0   3.3.0   Symfony DoctrineFixturesBundle
doctrine/doctrine-migrations-bundle 2.1.2   2.1.2   Symfony DoctrineMigrationsBundle
doctrine/event-manager              1.1.0   1.1.0   The Doctrine Event Manager is a simple PHP event system that was built to be used with the various Doctrine projects.
doctrine/inflector                  1.3.1   1.3.1   Common String Manipulations with regard to casing and singular/plural rules.
doctrine/instantiator               1.3.0   1.3.0   A small, lightweight utility to instantiate objects in PHP without invoking their constructors
doctrine/lexer                      1.2.0   1.2.0   PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.
doctrine/migrations                 2.2.1   2.2.1   PHP Doctrine Migrations project offer additional functionality on top of the database abstraction layer (DBAL) for versioning your database schema and easily deploying changes to it. It is a very easy to use and a powerful tool.
doctrine/orm                        v2.7.2  v2.7.2  Object-Relational-Mapper for PHP
doctrine/persistence                1.3.7   1.3.7   The Doctrine Persistence project is a set of shared interfaces and functionality that the different Doctrine object mappers share.
doctrine/reflection                 1.2.0   1.2.0   The Doctrine Reflection project is a simple library used by the various Doctrine projects[...]

PHP version

PHP v7.2 and v7.4.3

Subject

Since updating this library from 1.5.1 to 1.6.0 I get the following error when clearing the Symfony cache:

 $ php bin/console cache:clear -e dev

In AnnotationException.php line 54:
                                                                                                                                                                                         
  [Semantical Error] The annotation "@extends" in class Sonata\Doctrine\Entity\BaseEntityManager was never imported. Did you maybe forget to add a "use" statement for this annotation?

Maybe we should use phpstan-extends here? I thought there was just a clash with the @template annotation.

I have exactly the same issue, what can we do?

I have exactly the same issue, what can we do?

Either wait for a new annotations release or provide a PR with a fix.

Since the pr doctrine/annotations#298 is merged you could require the updated dev version of doctrine/annotations

composer require doctrine/annotations:1.9.x-dev

Happening to me on a Symfony 3.4 project

"sonata-project/admin-bundle" : "^3.4",
"sonata-project/cache-bundle" : "^3.2",
"sonata-project/doctrine-orm-admin-bundle" : "^3.6",
"sonata-project/user-bundle" : "^4.0",

Had to lock it down to 1.5.1 by adding

"sonata-project/doctrine-extensions" : "1.5.1",

Doctrine annotations released the fix, so this issue is fixed right? closing. Please reopen again if the issue is still there

it's still happen with me

after I run composer req sonata-project/doctrine-extensions:^1.9 --update-with-dependencies

Executing script cache:clear [KO]
 [KO]
Script cache:clear returned with error code 1
!!  
!!  In AnnotationException.php line 54:
!!                                                                                 
!!    [Semantical Error] The annotation "@extends" in class Sonata\Doctrine\Entit  
!!    y\BaseEntityManager was never imported. Did you maybe forget to add a "use"  
!!     statement for this annotation?          

Can you provide a fix @eerison ?

@VincentLanglet could you close this issue again, because I can't test with the last version of sonata-project/doctrine-extensions

if you see in the comment I used the version 1.9 but the project has the release 1.12

But I'm with problem with other dependencies to update doctrine/doctrine-bundle

then i'll fix this in my side first and after that, I'll test with the last version, if I keep getting the same issue I reopen the issue ๐Ÿ˜ƒ

just to help other people with this problem

after I update the doctrine/annotations using composer update doctrine/annotations --with-dependencies

it works well ๐Ÿ˜ƒ