I have an application witch has two tables 'album' and 'photo', Where photo has a foreign_key to album.id. I use a transaction for storing the data in the database.
The problem occurs when I save the photo. It fails on:
$photo->albumId = Album::model()->findByAttributes('albumOtherId')->id; because there is no record of the album in the database and the findByAttributes returns NULL.
Is there any way to do this inside the transaction?