简体   繁体   English

SonataAdmin随机文件上的内存

[英]SonataAdmin memory on random files

I have configured SonataAdmin bundle but and i've got a random memory problem when i intend to load admin/dashboard , 我已经配置了SonataAdmin捆绑包,但是当我打算加载admin / dashboard时,出现了随机内存问题,

Here is my 2 entities which contains Sonata CRUD : 这是我的2个包含Sonata CRUD的实体:

namespace Jade\ReveBundle\Admin;

use Doctrine\Common\Collections\Collection;

use Jade\ReveBundle\Entity\Thematique;

use Sonata\AdminBundle\Admin\Admin;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Validator\ErrorElement;
use Sonata\AdminBundle\Form\FormMapper;

class ProduitAdmin extends Admin
{
    protected function configureFormFields(FormMapper $formMapper)
    {
        $formMapper
            ->add('titre')
            ->add('description')
        ;
    }

    protected function configureDatagridFilters(DatagridMapper $datagridMapper)
    {
        $datagridMapper
            ->add('titre')
            ->add('description')
        ;
    }

    protected function configureListFields(ListMapper $listMapper)
    {
        $listMapper
            ->addIdentifier('id')
            ->add('titre')
            ->add('description')
        ;
    }

    public function validate(ErrorElement $errorElement, $object)
    {
        $errorElement
            ->with('titre')
                ->assertMaxLength(array('limit' => 32))
            ->end()
        ;
    }
}


namespace Jade\ReveBundle\Admin;

use Sonata\AdminBundle\Admin\Admin;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Validator\ErrorElement;
use Sonata\AdminBundle\Form\FormMapper;

class ThematiqueAdmin extends Admin
{
    protected function configureFormFields(FormMapper $formMapper)
    {
        $formMapper
            ->add('titre')
            ->add('description')
        ;
    }

    protected function configureDatagridFilters(DatagridMapper $datagridMapper)
    {
        $datagridMapper
            ->add('titre')
            ->add('description')
        ;
    }

    protected function configureListFields(ListMapper $listMapper)
    {
        $listMapper
            ->addIdentifier('id')
            ->add('titre')
            ->add('description')
        ;
    }

    public function validate(ErrorElement $errorElement, $object)
    {
        $errorElement
            ->with('titre')
                ->assertMaxLength(array('limit' => 32))
            ->end()
        ;
    }
}

Anyone i've got an idea of the problem ? 有人知道这个问题吗? Thx for your answer 谢谢你的回答

If the error is " PHP Fatal Error: Allowed memory size of xxxx bytes exhausted... ", then try to increase PHP memory limit. 如果错误是“ PHP致命错误:允许的xxxx字节内存大小用尽... ”,则尝试增加PHP内存限制。 Sonata is using Doctrine ORM and entities may consume a lot of memory. 奏鸣曲使用的是教义ORM,实体可能会占用大量内存。 A lot of informations are stored in memory in profiler in dev mode, too. 在dev模式下,许多信息也存储在事件探查器的内存中。

File web/app_dev.php and web/app.php: 文件web / app_dev.php和web / app.php:

<?php 
ini_set('memory_limit','128M'); //or some other reasonable value
...

or in php.ini: 或在php.ini中:

memory_limit = 128M

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM