If I'm not mistaken the id of the latest saved record is $this->model->id   

"Value of the primary key ID of the record that this model is currently 
pointing to. Automatically set after database insertions."
http://api20.cakephp.org/class/model  

There's also the two functions getInsertID ( 
http://api20.cakephp.org/class/model#method-ModelgetInsertID ) and 
getLastInsertID ( 
http://api20.cakephp.org/class/model#method-ModelgetLastInsertID ) though I 
cannot tell you the difference between those two.

Hope that helps :) 

Am Freitag, 27. Juli 2012 11:43:52 UTC+2 schrieb bigjimmi:
>
> Is it possible within a Add() function to find the ID of a post just as 
> its written to the DB?
>
> Basically I'm trying to create a ACO for the post when its saved by doing 
> something like this:
>
> $aco = $this->Acl->Aco->create(Array('model'=>Post, foreign_key=>'XXXX'));
>
> Where XXXX is the ID of the post that's just been saved within the same 
> function.
>
> Thanks in advance
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to