sylius.repository.product OutOfMemoryException

时间:2018-01-10 15:25:03

标签: php symfony sylius

"require": { 
    "sylius/sylius": "^1.0@beta",
    "bitbag/cms-plugin": "^1.2",
    "symfony/symfony": "3.3.13",
    "egeloen/ckeditor-bundle": "^6.0",
    "sensio/generator-bundle": "^3.1"
},

php版本是:7.2.0

我的Sylius商店只有一种产品

class TestController extends Controller {

    public function indexAction($method, $param = array()) {

        return $this->$method($param);
    }

    private function test($param) {

        $repository = $this->container->get('sylius.repository.product');

        // $products = $repository->findOneByCode('simple_produit');
        $products = $repository->findAll(); // Load all the products!

        var_dump($products);

        $content = $this->renderView('JDFTestBundle::test.html.twig');

        return new Response($content);
    }

} /*End of class*/

var_dump show(extract):

array(1) { [0]=> object(Sylius\Component\Core\Model\Product)#19560 (21) { ["variantSelectionMethod":protected]=> string(6) "choice" ["productTaxons":protected]=> object(Doctrine\ORM\PersistentCollection)#22238 (9) { ["snapshot":"Doctrine\ORM\PersistentCollection":private]=> [...]

提取图片: here

如何在没有>的情况下获得所有产品1024M数据?!我不明白附加什么。

提前感谢

1 个答案:

答案 0 :(得分:1)

导致内存不足的原因可能是var_dump调用。 请尝试使用dump from the VarDumper component代替