Eva Dias
Eva Dias

Reputation: 1747

Delete doesn't work in backend

I have 3 buttons in my indexSuccess in the backend of my project. The show and edit buttons work fine but the delete goes to show. I think the code is right, here it is:

  <div class="cont2">
        <a href="<?php echo url_for('marcacao/delete?id='.$feasy_marcacao->getId()); ?>">
          <div class="btapagar"/>
            <p class="btapagartxt">
              Apagar
            </p>
          </div>
        </a>

Upvotes: 0

Views: 314

Answers (3)

Matthieu
Matthieu

Reputation: 2289

I don't think re-creating the URLs by hand is the best practice, you should be using url_for() or link_to(). I had the same problem with a project on symfony 1.2 (Propel) using the admin generator : all the links worked fine except for delete, so I added a route in routing.yml like that :

marcacao_delete:
  url:   /marcacao/:id/delete
  param: { module: marcacao, action: delete }

and that solved the problem

Upvotes: 0

Eva Dias
Eva Dias

Reputation: 1747

I found the problem. This <a href="<?php echo url_for('marcacao/delete?id='.$feasy_marcacao->getId()); ?>"> is wrong. It should be: <a href="<?php echo 'marcacao/'.$feasy_marcacao->getId().'/delete' ?>" > Thank you anyway

Upvotes: 1

Manse
Manse

Reputation: 38147

Check your log for the app you are running - you can see what happens which this link is clicked - you need to check the correct route is being followed - then check the controller to see what you are doing for that routes action.

Upvotes: 0

Related Questions