duangang4001 2019-05-20 14:10
浏览 68

Symfony CreateForm函数内存不足

I'm working on a 2.8 symfony project and I can't solve a problem I've been dealing with for a few weeks.

Every form I'm trying to create gets me a "Allowed memory size exhausted" error. This should be a configuration problem because my project is working on dev and prod environments, and on other computers. It's just not working on mine.

Error exemple : OutOfMemoryException in BundleEntryReader.php line 134:

Error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 134217736 bytes)

I'm working on Ubuntu. I tried remove and re-install both apache and php (7.1), but no success. I also tried to allow more memory and execution time, but my scripts keep running for dozens of minutes.

$projectForm = $this->createForm(
     new ProjectType($choices, $user->getCompany()),
     $project,
     ['action' => $this->generateUrl('company_project_create',['projectId' => $project->getId() ])]
);

I'd like to be able to generate a form. the problem is in the form generation. In every script I use, evrything is ok until the "$this->createForm()" function. Let's says that this application runs on computers with less ram.

/*****EDIT*****/

I found that the problem came from two types in my ProjectType : user and address :

$builder            
     ->add('user', UserType::class, [
          'label' => 'customer.user.label',
     ])
     ->add('address', ProjectAddressType::class, [
          'label' => 'customer.project.address.label',
     ])

Here is for example where my userType has problem :

public function buildForm(FormBuilderInterface $builder, array $options)
{
     parent::buildForm($builder, $options);
     $builder
          ->add('photo', HiddenType::class, ['required'    => false])
          ->add('isSendDailyMail', CheckboxType::class, [
              'label'    => false,
              'required' => false,
     ]);
}
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 程序不包含适用于入口点的静态Main方法
    • ¥15 素材场景中光线烘焙后灯光失效
    • ¥15 请教一下各位,为什么我这个没有实现模拟点击
    • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
    • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
    • ¥20 有关区间dp的问题求解
    • ¥15 多电路系统共用电源的串扰问题
    • ¥15 slam rangenet++配置
    • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
    • ¥15 ubuntu子系统密码忘记