2016-11-26 3 views
0

プロダクションサーバでのみ発生する奇妙な問題があります。私のコントローラは、必要なときにルートパラメータを受信して​​います

私は/ 1/configに入ると、nullでなければならない$ post_typeはエンティティを受け取ります。

他のルート/ 1 /設定/ 1作業罰金

/** 
* Config a post entity. 
* 
* @Route("/{id}/config", name="post_config") 
* @Route("/{id}/config/{post_type}", name="post_config_type") 
* @Method({"GET", "POST"}) 
*/ 
public function configAction(Request $request, Post $post, PostType $post_type = null) 
{ 
    $em = $this->getDoctrine()->getManager(); 
    $post_type_list = $em->getRepository('AppBundle:PostType')->findBy(array('enabled' => true)); 

    if (!is_null($post_type)){ 

     // code 
    } 
    // more code 
} 

私は本当に、多分サーバーの構成の問題を問題を見つけることができません。

ありがとうございました。

答えて

0

[OK]を、私はそれは、アクションのパラメータとして受信されているとおりにルートで

パラメータが名前を付ける必要があり、問題を発見しました。

/** 
* Config a post entity. 
* 
* @Route("/{post}/config", name="post_config") 
* @Route("/{post}/config/{post_type}", name="post_config_type") 
* @Method({"GET", "POST"}) 
*/ 
public function configAction(Request $request, Post $post, PostType $post_type = null) 
関連する問題