Mysql_insert_id 与 Doctrine
我有几个表(mySQL),我想在 Doctrine 的帮助下更新它们。产品表 id 是自动递增的,这里是我想要做的事情的简要描述:
$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 usinglush?使用常规保存是一种替代方法,但这样做时会出现多个事务。 我试图找到一个 Mysql_insert_id 版本的学说,但没有任何运气。
谢谢!
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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以在这里找到一些信息: http://www.doctrine-project.org/documentation/manual/2_0/en/basic-mapping#identifiers-/-primary-keys
Here you can find some information: http://www.doctrine-project.org/documentation/manual/2_0/en/basic-mapping#identifiers-/-primary-keys