简体   繁体   中英

Mysql_insert_id with Doctrine

I have a couple of tables (mySQL) that i would like to update with the help of Doctrine. The products table id is auto-incrementing, and here's a brief description on what I would like to do:

    $prod = new Products();
    $prod->type = '0';

    $categ = new CategoriesToProducts();
    $categ->cat = '111';
    $categ->product = $prod->id;

    $conn = Doctrine_Manager::connection();
    $conn->flush();

How can I do this while using flush? Using a regular save is an alternative, but there will be multiple transactions while doing such. I have tried to find a Mysql_insert_id version for doctrine, but without any luck.

Thanks!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM