sonata-project / SonataCoreBundle

[deprecated] SonataCoreBundle
MIT License
318 stars 138 forks source link

Trying to fix depreciation notice with PR but noticed a problem I don't know how to fix #680

Closed red-smeg closed 5 years ago

red-smeg commented 5 years ago

Hi,

I have the following depreciation Notices in my project.

The Sonata\CoreBundle\Model\BaseEntityManager class is deprecated since version 3.x and will be removed in 4.0. Use Sonata\Doctrine\Entity\BaseEntityManager instead.

The Sonata\CoreBundle\Model\PageableManagerInterface class is deprecated since version 3.x and will be removed in 4.0. Use Sonata\DatagridBundle\Pager\PageableInterface instead.

I started to fix the problem by writing a PR to change the use statement in both the message manager and the message manager interface.

However I went to look at the composer.json inside the notifications bundle as my directory did not have the structure to support the notices

composer.json (inside the notifications bundle) has

"require": {
        "php": "^7.1",
        "sonata-project/core-bundle": "^3.9",
        "sonata-project/datagrid-bundle": "^2.3",
        "sonata-project/doctrine-extensions": "^1.0",
        "sonata-project/easy-extends-bundle": "^2.5",
        "symfony/config": "^2.8 || ^3.2 || ^4.0",
        "symfony/console": "^2.8 || ^3.2 || ^4.0",
        "symfony/dependency-injection": "^2.8 || ^3.2 || ^4.0",
        "symfony/event-dispatcher": "^2.8 || ^3.2 || ^4.0",
        "symfony/form": "^2.8 || ^3.2 || ^4.0",
        "symfony/http-foundation": "^2.8 || ^3.2 || ^4.0",
        "symfony/http-kernel": "^2.8 || ^3.2 || ^4.0",
        "symfony/security-core": "^2.8 || ^3.2 || ^4.0",
        "zendframework/zenddiagnostics": "^1.0"
    },

I was wondering if the doctrine-extensions bundle and the data-grid bundles have been replaced or if the composer.json was somehow out of date as the source trees in the vendor directory do not have these classes in the locations noted in the deprecation notice.

red-smeg commented 5 years ago

Here are the stack traces just in case:


  /var/www/project-indian/vendor/sonata-project/core-bundle/src/CoreBundle/Model/BaseEntityManager.php:20 {▼
    ›     .' Use Sonata\Doctrine\Entity\BaseEntityManager instead.',
    ›     E_USER_DEPRECATED
    › );
  }
  /var/www/project-indian/vendor/symfony/symfony/src/Symfony/Component/Debug/DebugClassLoader.php:152 {▼
    › } elseif (\function_exists('opcache_is_script_cached') && @opcache_is_script_cached($file)) {
    ›     require $file;
    › 
    arguments: {▶}
  }
}

{▼
  /var/www/project-indian/vendor/sonata-project/core-bundle/src/CoreBundle/Model/PageableManagerInterface.php:20 {▼
    ›     .' Use Sonata\DatagridBundle\Pager\PageableInterface instead.',
    ›     E_USER_DEPRECATED
    › );
  }
  /var/www/project-indian/vendor/symfony/symfony/src/Symfony/Component/Debug/DebugClassLoader.php:152 {▼
    › } elseif (\function_exists('opcache_is_script_cached') && @opcache_is_script_cached($file)) {
    ›     require $file;
    › 
    arguments: {▶}
  }
}`
core23 commented 5 years ago

We try to split this bundle and move the classes to different bundles, so you will only load the required dependencies.

According to your bug report, you should use this class https://github.com/sonata-project/SonataDatagridBundle/blob/2.x/src/Pager/PageableInterface.php