I tried to use Sylius Grid system to make my articles management easy.
So, I followed the Sylius doc and I see the grid with my articles displayed. Then I've added action buttons but when I want to use them, I have an error (only for edit and create. Delete works well): Class "form" is not configured for resource "blog.article".
I understand that it can't find any FormClass to render my Article, but there is not this information in the doc, and I think I saw on a doc (I don't remember which) that the form is rendered automatically according to the Entity.
Here is my code :
Declaration of the resource :
sylius_resource:
resources:
blog.article:
driver: doctrine/orm
classes:
model: BlogBundle\Entity\Article
The grid config :
sylius_grid:
grids:
blog_admin_article:
driver:
name: doctrine/orm
options:
class: BlogBundle\Entity\Article
sorting:
date: asc
fields:
titre:
type: string
label: sylius.ui.title
sortable: ~
date:
type: datetime
label: sylius.ui.date
sortable: ~
resume:
type: string
label: sylius.ui.resume
sortable: ~
filters:
search:
type: string
label: sylius.ui.search
options:
fields: [titre, resume ]
actions:
main:
create:
type: create
label: sylius.ui.create
item:
update:
type: update
delete:
type: delete
show:
type: show
The route :
blog_admin_article:
resource: |
alias: blog.article
section: admin
templates: SyliusAdminBundle:Crud
except: ['show']
redirect: update
grid: blog_admin_article
vars:
all:
subheader: blog.ui.articles.subtitle
index:
icon: 'newspaper icon'
type: sylius.resource
Does anyone know what is the problem ?
Thanks for your help !
Since the autogeneration of forms was disabled in the beta1, there are 2 ways to solve your problem:
Create and declare your own form type like here in the docs (ArticleType).
Use
dev-master
branch of Sylius instead of beta1, where the autogeneration is back.