Ich möchte ein Element aus der Datenbank löschen und aus der Tabelle entfernen Entity Produkt Ich möchte alle Produkte auswählen und nach einem Klick auf Schaltfläche XI möchte es Name aktualisieren und entfernen es von der Tabelle Irgendwelche Hilfe ?? mein Zweig:aktualisieren Sie meine Datenbank und verwerfen ein Element aus Tabelle
<script>
$("document").ready(function() {
$(".btn-group-vertical").click(function() {
$.ajax({
type:'get',
url:'http://localhost/symfony/nouveau%20dossier/web/app_dev.php/'+$(this).val(),
beforeSend: function() {
},
success: function(data){
var x = $("produit").val(data.approuver);
console.log(x);
$("tt").find('td').fadeOut(1000,function(){
$("tt").remove();
});
}
});
});
});
</script>
{% endblock script %}
{% block body %}
<section class="content">
<div class="row">
<div class="col-xs-12">
<div class="box">
<div class="box-header">
<h3 class="box-title">Produit en attente</h3>
</div>
<!-- /.box-header -->
<div class="box-body">
<table id="example2" class="table table-bordered table-hover">
<thead>
<tr>
<th>Produit de</th>
<th>Libelle Produit</th>
<th>Quantite stock</th>
<th>etat</th>
</tr>
</thead>
<tbody>
{% for product in products %}
<tr class="tt">
<td align="center">{{ product.seller }}</td>
<td align="center">{{ product.libelle }}</td>
<td align="center">{{ product.quantiteStock }}</td>
<td><button
type="button"
class="btn btn-group-vertical btn-danger btn-xs"
id=1>Decliner</button>
<button type="button"
class="btn btn-group-vertical btn-sucess btn-xs"
id=2>Approuver</button>
</td>
</tr>
{% endfor %}
<tfoot>
<tr>
<th>Produit de</th>
<th>Libelle Produit</th>
<th>Quantite stock</th>
<th>etat</th>
</tr>
</tfoot>
</table>
</div>
<!-- /.box-body -->
</div>
<!-- /.box -->
</div>
</div>
<!-- ./wrapper -->
mein Controller:
public function approuverAction($id)
{
$em = $this->getDoctrine()->getEntityManager();
$produit = $em->getRepository('ProductBundle:Product')
->findOneBy(array('id'=>$id));
$produit->setApprouver('Approuver');
$respones = new JsonResponse();
return $em->merge($produit);
$em->flush();
}
Jede Hilfe bitte
Warum möchten Sie etwas umbenennen, das Sie löschen? – goto