We launched new forums in March 2019—
join us there
.
In a hurry for help with your website?
Get Help Now!
Back to MODX.com
Forums
Docs
Revo Issues
Blog
My Forums
Products
Developing with xPDO
Search
Get identity of last insert
119 Posts
[email protected]
Reply #1,
15 years, 1 month ago
Not sure if it's even possible with xPDO, but is there a way of retrieving the identity of the last insert following >save command?
Cheers,
Chris
Studio Republic
http://www.studiorepublic.com
0845 226 3205
@christodhunter
☆ A M B ☆
3,141 Posts
Mark Hamstra
Reply #2,
15 years, 1 month ago
$object->get('id'); $object->getPK(); $object->getPrimaryKey();
One of those.
Basically, there's nothing (as far as I know) that acts like a "getLastInsert" function, but the object you ->save()d will be updated with the ID.
Mark Hamstra
• Developer spending his days working on
Premium Extras
and a
MODX Site Dashboard with the ability to remotely upgrade MODX and extras
to make the MODX world a little better.
Tweet me @
mark_hamstra
, check my infrequent blog at
markhamstra.com
, my slightly more frequent ramblings at
MODX.today
or see code at
Github
.
119 Posts
[email protected]
Reply #3,
15 years, 1 month ago
Blimey that was quick! Thanks for your help Mark - I'll give it a go.
Chris
Studio Republic
http://www.studiorepublic.com
0845 226 3205
@christodhunter
☆ A M B ☆
3,141 Posts
Mark Hamstra
Reply #4,
15 years, 1 month ago
That's what ya get for tweeting a link w/ #MODX
(Added bonus for being in my timeline too)
Mark Hamstra
• Developer spending his days working on
Premium Extras
and a
MODX Site Dashboard with the ability to remotely upgrade MODX and extras
to make the MODX world a little better.
Tweet me @
mark_hamstra
, check my infrequent blog at
markhamstra.com
, my slightly more frequent ramblings at
MODX.today
or see code at
Github
.