在Normalizer中最大功能嵌套级别注入主义知识库

时间:2019-03-20 10:49:33

标签: php symfony doctrine-orm doctrine symfony-3.4

当我尝试在自定义规范化器中注入Doctrine存储库(作为ServiceEntityRepository)时,出现此错误Maximum function nesting level of '256' reached, aborting!

我的客户标准化器:

class GroupNormalizer implements NormalizerInterface
{
/**
 * @var GroupRepository
 */
private $groupRepository;

public function __construct(GroupRepository $groupRepository)
{
    $this->groupRepository = $groupRepository;
}

public function normalize($object, $format = null, array $context = [])
...

还有存储库:

class GroupRepository extends ServiceEntityRepository
{

public function __construct(RegistryInterface $registry)
{
    parent::__construct($registry, Group::class);
}

我正在使用Symfony 3.4。

您是否有避免这种错误的想法?

修改

我的堆栈跟踪 enter image description here

1 个答案:

答案 0 :(得分:0)

“达到最大功能嵌套级别'256',正在中止!”错误来自Xdebug mod。您可以增加php.ini文件中的限制

xdebug.max_nesting_level = 512

或在代码中

ini_set('xdebug.max_nesting_level', 512);

通常在生产环境中不会发生

相关问题