コード例 #1
0
 /**
  * @Route("/crud/tree/details",name="comun_tree_crud_details")
  * @return Response
  */
 public function detailsAction()
 {
     $tableModel = $this->get($this->treeModelService);
     $id = $this->getParameter('id');
     if (!is_numeric($id)) {
         $array = explode("_", $id);
         $id = $array[count($array) - 1];
     }
     $entity = $this->getEm()->getRepository($tableModel->getEntity())->find($id);
     $fields = UtilRepository2::getFields($this->getEm(), $tableModel->getEntity());
     $r = array();
     foreach ($fields as $field) {
         if (!is_array($entity->{"get" . ucfirst($field)}())) {
             $r[] = array('key' => $field, 'value' => $entity->{"get" . ucfirst($field)}());
         }
     }
     return $this->render($this->detailsView, array('obj' => $r));
 }