开发者

Mysql_insert_id with Doctrine

开发者 https://www.devze.com 2022-12-25 02:20 出处:网络
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:

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开发者_C百科->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!


Here you can find some information: http://www.doctrine-project.org/documentation/manual/2_0/en/basic-mapping#identifiers-/-primary-keys

0

精彩评论

暂无评论...
验证码 换一张
取 消