Symfony方法返回null

时间:2014-11-28 09:34:10

标签: php symfony doctrine-orm

有一种方法从基值中获取数据并输出。 如果您遇到一些问题app.php - 请NULL,并在通过app_dev.php输入时 - 提供正确的 boolen 值。

P.S功能名称: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 个答案:

答案 0 :(得分:0)

解:

service memcached restart
在SSH中

相关问题