dongpankao6133 2014-11-28 09:34
浏览 26
已采纳

Symfony方法返回null

There is a method that takes data from the base value, and outputs it. If you go through some issues app.php - give NULL, and when entering through app_dev.php - gives the correct boolen value.

P.S function name: isBlocked()

public function indexAction($slug)
{
    $product = $this->get('manager.shop.product')->getBySlug($slug);
    if (!$product) {
        throw $this->createNotFoundException();
    }
    $this
        ->get('util.breadcrumbs')
        ->add('Catalog', $this->generateUrl('categoryIndex'))
        ->add(
            $product->getShop()->getName(),
            $this->generateUrl('shopIndex', ['slug' => $product->getShop()->getSlug()])
        )->add(
            $product->getName(),
            $this->generateUrl('productIndex', ['slug' => $product->getSlug()])
        );

    $this->get('manager.shop.product')->hit($product, $this->getRequest());

    foreach ($product->getImages() as $image) {
        $this->get('service.image')
            ->create($image)
            ->thumbnailize('525x500-800');
    }


    $shop = $this->get('manager.shop')->getBySlug($product->getShop()->getSlug());
    print_r(var_dump($shop->isBlocked()));

    return $this->render('MashApplicationBundle:Product:index.html.twig', [
        'anotherProducts' => $product->getAnotherShopProducts()->slice(0, 3),
        'product' => $product,
        'shop' => $shop,
     //   'isBlocked' => $shop->isBlocked(),
        'addToCartForm' => $this->createForm('checkout', null, ['data' => ['products' => [$product->getId()]]])->createView()
    ]);
}
  • 写回答

1条回答 默认 最新

  • dongyingming8970 2014-11-28 09:53
    关注

    Solve:

    service memcached restart
    

    in SSH

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 高德地图点聚合中Marker的位置无法实时更新
  • ¥15 DIFY API Endpoint 问题。
  • ¥20 sub地址DHCP问题
  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办