Exemplo n.º 1
0
 /**
  * Deletes the given entry from the database.
  *
  * @param Entry $domEntry The guestbook entry to delete.
  *
  * @author Christian Achatz
  * @version
  * Version 0.1, 21.05.2009<br />
  */
 public function deleteEntry(Entry $domEntry)
 {
     $entry = new GenericDomainObject('Entry');
     $entry->setProperty('EntryID', $domEntry->getId());
     // Delete the attributes of the entry, so that the object
     // itself can be deleted. If we don't do this, the ORM
     // will not be glad, because the entry still has child objects!
     $attributes = $this->orm->loadRelatedObjects($entry, 'Entry2LangDepValues');
     foreach ($attributes as $attribute) {
         $this->orm->deleteObject($attribute);
     }
     // delete associated users, because we don't need them anymore.
     $users = $this->orm->loadRelatedObjects($entry, 'Editor2Entry');
     foreach ($users as $user) {
         $this->orm->deleteObject($user);
     }
     // now delete entry object (associations are deleted automatically)
     $this->orm->deleteObject($entry);
 }
Exemplo n.º 2
0
 /**
  * Deletes the given News.
  *
  * @param News $news
  */
 public function deleteNews(News $news)
 {
     $this->ORM->deleteObject($news);
 }