升级到 Symfony 4.2 后出现 Symfony "Attempted to load class" 错误
Symfony "Attempted to load class" error after upgrade to Symfony 4.2
升级后出现新错误,应该与升级无关。
我在我的项目中使用 SendInBlue Php Library,在我的作曲家中加载:
"sendinblue/api-v3-sdk": "*@dev",
在我的服务中用于:
use SendinBlue\Client\Api\SMTPApi;
use SendinBlue\Client\Model\SendEmail;
调用方式:
$api_instance = new SMTPApi();
升级后出现新错误:
Attempted to load class "SMTPApi" from namespace "SendinBlue\Client\Api".
Did you forget a "use" statement for another namespace?
我尝试了清除缓存、rm -rf 删除缓存、使我的 phpStorm 缓存无效 + 重新启动、删除两个 USE 语句,然后查看我尝试创建新实例时显示的内容,但它仍然是一样的添加的 USE 语句。
如果我在调用的 class 上命令并单击,它会显示相关的 class (SMTPApi)。
我完全不知道这里可能是什么问题,是否与 symfony 升级有关?是作曲家更新改变了其他东西吗?
有关更多信息,这是我的服务的 header:
namespace App\Services;
use FOS\UserBundle\Mailer\MailerInterface;
use FOS\UserBundle\Model\UserInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Routing\Router;
use SendinBlue\Client\Api\SMTPApi;
use SendinBlue\Client\Model\SendEmail;
这是我的作曲家:
{ [...]
"require": {
"php": "^7.1.3",
"ext-iconv": "*",
"aws/aws-sdk-php": "^3.69",
"beelab/tag-bundle": "^1.4.0",
"friendsofsymfony/user-bundle": "^2.1",
"google/apiclient": "^2.0",
"gumlet/php-image-resize": "^1.9",
"kunalvarma05/dropbox-php-sdk": "^0.2.1",
"lildude/phpsmug": "^4.0",
"sendinblue/api-v3-sdk": "*@dev",
"sensio/framework-extra-bundle": "^5.1",
"sensiolabs/security-checker": "^4.1",
"symfony/apache-pack": "^1.0",
"symfony/asset": "^4.2",
"symfony/console": "^4.2",
"symfony/debug-pack": "^1.0",
"symfony/dependency-injection": "^4.2",
"symfony/dotenv": "^4.2",
"symfony/flex": "^1.0",
"symfony/form": "^4.2",
"symfony/framework-bundle": "^4.2",
"symfony/lock": "^4.2",
"symfony/maker-bundle": "^1.4",
"symfony/monolog-bundle": "^3.3",
"symfony/orm-pack": "^1.0",
"symfony/swiftmailer-bundle": "^3.0",
"symfony/translation": "^4.2",
"symfony/twig-bundle": "4.2",
"symfony/web-server-bundle": "^4.2",
"symfony/yaml": "^4.2"
},
"require-dev": {
"easycorp/easy-log-handler": "^1.0.2",
"symfony/debug-bundle": "^3.3|^4.2",
"symfony/profiler-pack": "^1.0",
"symfony/var-dumper": "^3.3|^4.2"
},
[...]
}
如上文所述,需要还原库。也许现在它已由创建者在 GIT.
修复
升级后出现新错误,应该与升级无关。
我在我的项目中使用 SendInBlue Php Library,在我的作曲家中加载:
"sendinblue/api-v3-sdk": "*@dev",
在我的服务中用于:
use SendinBlue\Client\Api\SMTPApi;
use SendinBlue\Client\Model\SendEmail;
调用方式:
$api_instance = new SMTPApi();
升级后出现新错误:
Attempted to load class "SMTPApi" from namespace "SendinBlue\Client\Api". Did you forget a "use" statement for another namespace?
我尝试了清除缓存、rm -rf 删除缓存、使我的 phpStorm 缓存无效 + 重新启动、删除两个 USE 语句,然后查看我尝试创建新实例时显示的内容,但它仍然是一样的添加的 USE 语句。
如果我在调用的 class 上命令并单击,它会显示相关的 class (SMTPApi)。
我完全不知道这里可能是什么问题,是否与 symfony 升级有关?是作曲家更新改变了其他东西吗?
有关更多信息,这是我的服务的 header:
namespace App\Services;
use FOS\UserBundle\Mailer\MailerInterface;
use FOS\UserBundle\Model\UserInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Routing\Router;
use SendinBlue\Client\Api\SMTPApi;
use SendinBlue\Client\Model\SendEmail;
这是我的作曲家:
{ [...]
"require": {
"php": "^7.1.3",
"ext-iconv": "*",
"aws/aws-sdk-php": "^3.69",
"beelab/tag-bundle": "^1.4.0",
"friendsofsymfony/user-bundle": "^2.1",
"google/apiclient": "^2.0",
"gumlet/php-image-resize": "^1.9",
"kunalvarma05/dropbox-php-sdk": "^0.2.1",
"lildude/phpsmug": "^4.0",
"sendinblue/api-v3-sdk": "*@dev",
"sensio/framework-extra-bundle": "^5.1",
"sensiolabs/security-checker": "^4.1",
"symfony/apache-pack": "^1.0",
"symfony/asset": "^4.2",
"symfony/console": "^4.2",
"symfony/debug-pack": "^1.0",
"symfony/dependency-injection": "^4.2",
"symfony/dotenv": "^4.2",
"symfony/flex": "^1.0",
"symfony/form": "^4.2",
"symfony/framework-bundle": "^4.2",
"symfony/lock": "^4.2",
"symfony/maker-bundle": "^1.4",
"symfony/monolog-bundle": "^3.3",
"symfony/orm-pack": "^1.0",
"symfony/swiftmailer-bundle": "^3.0",
"symfony/translation": "^4.2",
"symfony/twig-bundle": "4.2",
"symfony/web-server-bundle": "^4.2",
"symfony/yaml": "^4.2"
},
"require-dev": {
"easycorp/easy-log-handler": "^1.0.2",
"symfony/debug-bundle": "^3.3|^4.2",
"symfony/profiler-pack": "^1.0",
"symfony/var-dumper": "^3.3|^4.2"
},
[...]
}
如上文所述,需要还原库。也许现在它已由创建者在 GIT.
修复