How to sort own columns in admin panel with symfony?

前端 未结 3 1360
后悔当初
后悔当初 2021-01-23 23:21

M schema.yml:

News:
  columns:
    title:
      type: string(50)
    category_id:
      type: integer(4)
  relations:
    Category:
      local: category_id
             


        
3条回答
  •  [愿得一人]
    2021-01-23 23:29

    That is because you are trying to view a column named category_name and you don't have a getCategory_Name() method, the solution is very simple. Display the categoryname column not category_name.

    config:
      actions: ~
      fields:  ~
      list:
        display: [news_id, title, categoryname]
        table_method: doSelectJoinCategory
      filter:
        display: [news_id, title, category_id]
      form:    ~
      edit:    ~
      new:     ~
    
    public function getCategoryName()
    {
      return $this->getCategories()->getCategoryName();
    }
    

提交回复
热议问题