当我键入此命令时php app/console assetic:dump --env=prod --no-debug
或此php app/console cache:clear --env=prod
我遇到以下错误:
PHP Fatal error: Declaration of DoctrineORMEntityManager_0000000035a1d9b70000558a7db0d6e7da5c7b8013722216782206eefb5b6fe5::initializeProxy() must be compatible with ProxyManager\Proxy\LazyLoadingInterface::initializeProxy(): bool in /var/www/myproject/app/cache/prod/appProdProjectContainer.php on line 4459
FYI
php --version
PHP 7.2.28 (cli) (built: Feb 18 2020 11:07:04) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
它曾经在我使用PHP 5时起作用。
所以我已在评论中说我不再有此错误:我必须手动清空“缓存”目录。所以我做了:rm -rf app/cache/prod/
php72 composer.phar dump-autoload
php72 composer.phar install --optimize-autoloader
而且我得到了一些警告,但到目前为止似乎仍然有效... :) –