[FLOW3-general] Repository getting "Last Inserted Id" (Last inserted object with persistence ID)

Karsten Dambekalns karsten at typo3.org
Thu Apr 19 11:06:07 CEST 2012


Hi.

On 18.04.12 21:32, Davide CD wrote:
> public function createAction(\MyPackage\Blog\Domain\Model\Hotel $hotel){
> //at this point, $hotel has no persistence Id$this->repository->add($hotel);

It has. Unless you explicitly assign an Id annotation to your model,
FLOW3 will make sure a UUID is generated when instantiating an entity.
Thus, the UUID exists even if an entity is never persisted.

You can, consequently, always use getIdentifierByObject() on the
PersistenceManager. But, as Sebastian pointed out already, you should
not need this in most cases. Did you look at the JSON view already?

Regards,
Karsten
-- 
Karsten Dambekalns
TYPO3 Core Developer, FLOW3 / Phoenix Team

TYPO3 .... inspiring people to share!
Get involved: typo3.org


More information about the FLOW3-general mailing list