2016-12-27 52 views
0

我有一個symfony 3項目,可以在我的本地機器上正常工作,但是在docker上部署並清除緩存後,將777賦予var文件夾項目工作但數據錯誤。 這是爲例的CONTROLER方法:Symfony3從數據庫中提取錯誤的數據

/** 
* @Route("/post/index",name="postindex") 
*/ 
public function indexAction() 
{ 
    $Posts = $this->getDoctrine()->getRepository('AppBundle\Entity\Post')->findAll(); 
    return $this->render('AppBundle:Post:index.html.twig', array('posts' => $Posts)); 
} 

這是樹枝模板

> {% extends "::base.html.twig" %} {% block title %}List Post{% endblock 
> %} {% block body %} 
>  <section class="firstsection"> 
>   <div class="container"> 
>    <h2>Posts</h2> 
>    <table class="table table-bordered"> 
>     <tr class="active"> 
>      <td class="text-bold">Title</td> 
>      <td class="text-bold">Body</td> 
>      <td class="text-bold">created At</td> 
>      <td class="text-bold">update dAt</td> 
>      <td class="text-bold">Action</td> 
>     </tr> 
>     {% for post in posts %} 
>      <tr> 
>       <td>{{ post.title }}</td> 
>       <td>{{ post.body }}</td> 
>       <td>{{ post.createdAt|date("m/d/Y") }}</td> 
>       <td>{{ post.updatedAt|date("m/d/Y") }}</td> 
>       <td> 
>        <ul> 
>         <li><a href="{{ path('postshow', {'id': post.id}) }}">View</a></li> 
>         <li><a href="{{ path('postupdate', {'id': post.id}) }}">Edit</a></li> 
>         <li><a href="{{ path('postdelete', {'id': post.id}) }}">Delete</a></li> 
>        </ul> 
>       </td> 
>      </tr> 
>     {% endfor %} 
>    </table> 
>   </div> 
>  </section> {% endblock %} 

這就是結果: enter image description here

,這是我在郵寄表

enter image description here

請幫忙嗎? 對不起英語。

+0

你的意思是「標題」和「身體」顯示錯誤的價值觀?也許順序是上升的? –

+0

我真的不明白你的問題。兩幅圖像中顯示的數據完全不同!?實際存儲在您的數據庫中的已部署應用的內容是什麼?你是否想按ID排列元素,使其在第二個屏幕截圖中具有給定值的升序? – baris1892

+0

@Alvinbunk沒有我的所有數據都列在圖片上我的管理員。 –

回答

0

您使用的是不同的數據庫部署版本

+0

當我從碼頭終端中選擇數據時,找不到相同的數據庫,我找到相同的數據。 –