doctrine2 - how to insert records into a table with Doctrine -


i using zf2 , doctrine project developing, , need create function takes of records select query , inserts or appends them table (or entity). doctrine documentation says querybuilder offers select, delete , update functionality, , remember reading somewhere insert , append not included because doctrine doesn't want lose control of related records might go missing updating 1 table has relationships others.

how can use doctrine add group of records table?

you can create enities records , push them db:

foreach ( $records $record ) {     $someentity = new sometable();      $someentity->setname($record['name']);     $someentity->setfoo($record['bar']);      $em->persist($someentity); }  $em->flush(); 

Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -