I
I
idkiberlord0772016-04-27 00:04:45
symfony
idkiberlord077, 2016-04-27 00:04:45

How to delete an entry via index.html.twig if everything is done in the CRud system?

I tried it like this:
a href="{{ path('category_delete', { 'id': entity.id }) }}"delete>
didn't work.
deleteAction() asks for an id that I don't know where to get it from.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Ivan Cherny, 2016-04-27
@paalomnik

keep an example:
1. yaml routing (you can add validations, etc., the symphony is beautifully written in the off-docs)

route_id:
    path:     /app/delete/{id}
    defaults: { _controller:AcmeBundle:FakeControllerName:delete, id: null }

specify that in the url we will have an id, by default null
2. controller
public function deleteAction($id)
{
//в id будет id из урла, реализуем удаление, используя эти данные, не забываем про валидацию
}

3.template
all the info is given in a short form, you can expand indefinitely

A
Alexey Skobkin, 2016-04-27
@skobkin

1. Wrap the code in a code tag so that it can be read normally.
2. Please provide code deleteAction().
3. Give the error that you have when executing the code.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question