gpt4 book ai didi

php - 迁移时无法再使用 ocramius/proxy-manager 在 Symfony 中进行迁移吗?

转载 作者:行者123 更新时间:2023-12-05 08:07:14 25 4
gpt4 key购买 nike

我现在在进行迁移时遇到问题,似乎是一些问题。在它工作之前,但后来我在我的流浪机器上做了更新,也许 php.ini 文件或其他依赖项中缺少某些东西?

我的 php 版本是:PHP 7.2.17-1+ubuntu18.04.1+deb.sury.org+3

WARNING! You are about to execute a database migration that could result in schema changes and data loss. Are you sure you wish to continue? (y/n)y
Migrating up to 20190419065327 from 20190416183458
Migration 20190419065327 failed during Pre-Checks. Error Call to undefined method ProxyManager\ProxyGenerator\LazyLoadingValueHolder\MethodGenerator\LazyLoadingMethodInterceptor::fromReflectionWithoutBodyAndDocBlock()

In LazyLoadingMethodInterceptor.php line 29:

Attempted to call an undefined method named "fromReflectionWithoutBodyAndDocBlock" of
class "ProxyManager\ProxyGenerator\LazyLoadingValueHolder\MethodGenerator\LazyLoadin
gMethodInterceptor".

实际上这个文件和方法static::fromReflectionWithoutBodyAndDocBlock($originalMethod);:

<?php

declare(strict_types=1);

namespace ProxyManager\ProxyGenerator\LazyLoadingValueHolder\MethodGenerator;

use ProxyManager\Generator\MethodGenerator;
use ProxyManager\Generator\Util\ProxiedMethodReturnExpression;
use Zend\Code\Generator\PropertyGenerator;
use Zend\Code\Reflection\MethodReflection;

/**
* Method decorator for lazy loading value holder objects
*
* @author Marco Pivetta <ocramius@gmail.com>
* @license MIT
*/
class LazyLoadingMethodInterceptor extends MethodGenerator
{
/**
* @throws \Zend\Code\Generator\Exception\InvalidArgumentException
*/
public static function generateMethod(
MethodReflection $originalMethod,
PropertyGenerator $initializerProperty,
PropertyGenerator $valueHolderProperty
) : self {
/* @var $method self */
$method = static::fromReflectionWithoutBodyAndDocBlock($originalMethod);
$initializerName = $initializerProperty->getName();
$valueHolderName = $valueHolderProperty->getName();
$parameters = $originalMethod->getParameters();
$methodName = $originalMethod->getName();
$initializerParams = [];
$forwardedParams = [];

foreach ($parameters as $parameter) {
$parameterName = $parameter->getName();
$variadicPrefix = $parameter->isVariadic() ? '...' : '';
$initializerParams[] = var_export($parameterName, true) . ' => $' . $parameterName;
$forwardedParams[] = $variadicPrefix . '$' . $parameterName;
}

$method->setBody(
'$this->' . $initializerName
. ' && $this->' . $initializerName
. '->__invoke($this->' . $valueHolderName . ', $this, ' . var_export($methodName, true)
. ', array(' . implode(', ', $initializerParams) . '), $this->' . $initializerName . ");\n\n"
. ProxiedMethodReturnExpression::generate(
'$this->' . $valueHolderName . '->' . $methodName . '(' . implode(', ', $forwardedParams) . ')',
$originalMethod
)
);

return $method;
}
}

我的 composer.json:

{
"type": "project",
"license": "proprietary",
"require": {
"php": "^7.1.3",
"ext-SimpleXML": "*",
"ext-ctype": "*",
"ext-iconv": "*",
"cocur/slugify": "^3.2",
"doctrine/doctrine-fixtures-bundle": "^3.1",
"doctrine/doctrine-migrations-bundle": "^2.0",
"easycorp/easyadmin-bundle": "^2.0",
"ocramius/proxy-manager": "^2.2",
"sensio/framework-extra-bundle": "^5.1",
"symfony/asset": "4.2.*",
"symfony/console": "4.2.*",
"symfony/dotenv": "4.2.*",
"symfony/expression-language": "4.2.*",
"symfony/flex": "^1.1",
"symfony/form": "4.2.*",
"symfony/framework-bundle": "4.2.*",
"symfony/monolog-bundle": "^3.1",
"symfony/orm-pack": "*",
"symfony/process": "4.2.*",
"symfony/security-bundle": "4.2.*",
"symfony/serializer-pack": "*",
"symfony/stopwatch": "4.2.*",
"symfony/swiftmailer-bundle": "^3.1",
"symfony/translation": "4.2.*",
"symfony/twig-bundle": "4.2.*",
"symfony/validator": "4.2.*",
"symfony/web-link": "4.2.*",
"symfony/webpack-encore-bundle": "^1.1",
"symfony/yaml": "4.2.*"
},
"require-dev": {
"symfony/debug-pack": "*",
"symfony/maker-bundle": "^1.0",
"symfony/profiler-pack": "*",
"symfony/test-pack": "*",
"symfony/web-server-bundle": "4.2.*"
},
"config": {
"preferred-install": {
"*": "dist"
},
"sort-packages": true
},
"autoload": {
"psr-4": {
"App\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"App\\Tests\\": "tests/"
}
},
"replace": {
"paragonie/random_compat": "2.*",
"symfony/polyfill-ctype": "*",
"symfony/polyfill-iconv": "*",
"symfony/polyfill-php71": "*",
"symfony/polyfill-php70": "*",
"symfony/polyfill-php56": "*"
},
"scripts": {
"auto-scripts": {
"cache:clear": "symfony-cmd",
"assets:install %PUBLIC_DIR%": "symfony-cmd"
},
"post-install-cmd": [
"@auto-scripts"
],
"post-update-cmd": [
"@auto-scripts"
]
},
"conflict": {
"symfony/symfony": "*"
},
"extra": {
"symfony": {
"allow-contrib": false,
"require": "4.2.*"
}
}
}

最佳答案

我通过删除 ocramius/proxy 和其他依赖项解决了这个问题。恢复到旧的 package.json。

{
"type": "project",
"license": "proprietary",
"require": {
"php": "^7.1.3",
"ext-SimpleXML": "*",
"ext-ctype": "*",
"ext-iconv": "*",
"cocur/slugify": "^3.2",
"doctrine/doctrine-fixtures-bundle": "^3.1",
"easycorp/easyadmin-bundle": "^2.0",
"sensio/framework-extra-bundle": "^5.1",
"symfony/asset": "4.2.*",
"symfony/console": "4.2.*",
"symfony/dotenv": "4.2.*",
"symfony/expression-language": "4.2.*",
"symfony/flex": "^1.1",
"symfony/form": "4.2.*",
"symfony/framework-bundle": "4.2.*",
"symfony/monolog-bundle": "^3.1",
"symfony/orm-pack": "*",
"symfony/process": "4.2.*",
"symfony/security-bundle": "4.2.*",
"symfony/serializer-pack": "*",
"symfony/stopwatch": "4.2.*",
"symfony/swiftmailer-bundle": "^3.1",
"symfony/translation": "4.2.*",
"symfony/twig-bundle": "4.2.*",
"symfony/validator": "4.2.*",
"symfony/web-link": "4.2.*",
"symfony/webpack-encore-bundle": "^1.1",
"symfony/yaml": "4.2.*"
},
"require-dev": {
"symfony/debug-pack": "*",
"symfony/maker-bundle": "^1.0",
"symfony/profiler-pack": "*",
"symfony/test-pack": "*",
"symfony/web-server-bundle": "4.2.*"
},
"config": {
"preferred-install": {
"*": "dist"
},
"sort-packages": true
},
"autoload": {
"psr-4": {
"App\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"App\\Tests\\": "tests/"
}
},
"replace": {
"paragonie/random_compat": "2.*",
"symfony/polyfill-ctype": "*",
"symfony/polyfill-iconv": "*",
"symfony/polyfill-php71": "*",
"symfony/polyfill-php70": "*",
"symfony/polyfill-php56": "*"
},
"scripts": {
"auto-scripts": {
"cache:clear": "symfony-cmd",
"assets:install %PUBLIC_DIR%": "symfony-cmd"
},
"post-install-cmd": [
"@auto-scripts"
],
"post-update-cmd": [
"@auto-scripts"
]
},
"conflict": {
"symfony/symfony": "*"
},
"extra": {
"symfony": {
"allow-contrib": false,
"require": "4.2.*"
}
}
}

关于php - 迁移时无法再使用 ocramius/proxy-manager 在 Symfony 中进行迁移吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55758289/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com