Re: simpleentity insert

Jean-Christophe Michel <jc.michel-/aRvmaKoZxNWk0Htik3J/[email protected]>
Newsgroups gmane.comp.lib.binarycloud.devel
Message-ID <[email protected]>
Hi Bas,

B.Kamer wrote:
>     is it possible to expand the functionality of simpleentity in such a
>     way that after an insert the new pk value is automatically loaded
>     into the object...
> 
> add this after the insert in your entity
> $this->id = $this->_original = $this->getAutogeneratedPk();

Don't write into _original like this, should be _original['id'].
Better:

   $pk = $this->getAutogeneratedPk();
   $pkname = $this->_pk;
   $this->$pkname = $pk;
   $this->_original[$pkname] = $pk;

-- 
Jean-Christophe Michel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.