Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [ZendFramework][ZF2] Doctrine2 kasowanie wielu rekordów
netvalue
post
Post #1





Grupa: Zarejestrowani
Postów: 199
Pomógł: 2
Dołączył: 9.06.2008

Ostrzeżenie: (0%)
-----


czy to jest najbardziej optymalna metoda kasowania wielu rekordów.
Bo cos mi sie wydaje ze nie za bardzo wink.gif

  1. // $_POST['id'] = "1,5,6,82,99"
  2.  
  3. public function deleteAllAction() {
  4.  
  5. $array = explode(",", $this->getRequest()->getPost('id'));
  6.  
  7. foreach ($array as $id) {
  8. $feature = $this->getEntityManager()->find('Product\Entity\Feature', $id);
  9. if ($feature) {
  10. $this->getEntityManager()->remove($feature);
  11. $this->getEntityManager()->flush();
  12. }
  13. }
  14.  
  15. return new JsonModel(array("success"));
  16. }
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 22.08.2025 - 04:03