public function addJournalEntryImage($iDocumentId) { if ($this->iJournalEntryId === null) { $this->aUnsavedDocuments[] = $iDocumentId; return; } if (JournalEntryImagePeer::retrieveByPK($this->iJournalEntryId, $iDocumentId)) { return; } $oJournalEntryImage = new JournalEntryImage(); $oJournalEntryImage->setJournalEntryId($this->iJournalEntryId); $oJournalEntryImage->setDocumentId($iDocumentId); return $oJournalEntryImage->save(); }