2016-06-29 2 views
0

에 선택적 매개 변수를 전달하는 데 실패 :이 완벽하게 작동하고 내 dev에 환경에나뭇 가지 내가 나뭇 가지 템플릿이 라인을 가지고 라이브 환경

public function getOverstock($getQtyOrdering = false) { 
     if ($getQtyOrdering === false) { 
      return $this->overstock; 
     } 

     //sort the collection by the quantity field before returning 
     $iterator = $this->overstock->getIterator(); 
     $iterator->uasort(function ($a, $b) { 
      return ($a->getQty() < $b->getQty()) ? 1 : -1; 
     }); 
     $sortResult = new \Doctrine\Common\Collections\ArrayCollection(iterator_to_array($iterator)); 
     return $sortResult; 

    } 

:이 방법을 말한다

{% for line in order.getItems() %} 
    {% set os = line.option.getOverstock(true)|first %} 

, 살 때 매개 변수가 메서드에 전달되지 않습니다. 나는 live와 dev 복사본을 서로 그리고 저장소에 대해 점검했다. 모든 것이 잘 보였다.

이 상황을 어떻게 디버깅 할 수 있습니까?

답변

2

당신은 출력이 변수를 덤프 기능 http://twig.sensiolabs.org/doc/functions/dump.html을 사용할 수 있습니다 (I는 SILEX 프레임 워크에서 일하고 있어요).

또는 의해 심포니 패키지 symfony/var-dumper을 추가 템플릿에

$app->extend('twig', function ($twig) use ($app, $request) { 
    $twig->addFunction('dump', new \Twig_SimpleFunction('dump', '\dump')); 

    return $twig; 
}); 

및 출력이 변수를 나뭇 가지에

composer require symfony/var-dumper 

추가 덤프 기능

{% for line in order.getItems() %} 
    {{ dump(line.option.getOverstock(true)|first) }} 
    {{ dump(line.option.getOverstock(true)) }} 
    {{ dump(line) }} 
    {% set os = line.option.getOverstock(true)|first %}