Author: jablko
Date: Mon Sep 14 18:43:27 2009
New Revision: 3298

Log:
Cosmetic changes like revision 2955

Modified:
   trunk/apps/qubit/modules/actor/actions/deleteAction.class.php
   trunk/apps/qubit/modules/repository/actions/deleteAction.class.php

Modified: trunk/apps/qubit/modules/actor/actions/deleteAction.class.php
==============================================================================
--- trunk/apps/qubit/modules/actor/actions/deleteAction.class.php       Mon Sep 
14 18:32:10 2009        (r3297)
+++ trunk/apps/qubit/modules/actor/actions/deleteAction.class.php       Mon Sep 
14 18:43:27 2009        (r3298)
@@ -21,34 +21,29 @@
 {
   public function execute($request)
   {
-    $actor = QubitActor::getById($this->getRequestParameter('id'));
+    $actor = QubitActor::getById($request->id);
 
-    $this->forward404Unless($actor);
+    if (!isset($actor))
+    {
+      $this->forward404();
+    }
 
-    foreach ($actor->getEvents() as $event)
+    foreach ($actor->events as $event)
     {
-      if (is_null($event->getInformationObjectId()))
+      if (isset($event->informationObject) && isset($event->type))
       {
-        $event->delete();
+        unset($event->actor);
+
+        $event->save();
       }
       else
       {
-        if (is_null($event->getTypeId()))
-        {
-          //Event is only relevant in relation to Actor object, therefore it 
can be deleted
-          $event->delete();
-        }
-        else
-        {
-          //Event is relevant even without Actor object (e.g. creation date 
range), therefore it cannot be deleted
-          $event->setActorId(null);
-          $event->save();
-        }
+        $event->delete();
       }
     }
 
     $actor->delete();
 
-    return $this->redirect('actor/list');
+    return $this->redirect(array('module' => 'actor', 'action' => 'list'));
   }
 }

Modified: trunk/apps/qubit/modules/repository/actions/deleteAction.class.php
==============================================================================
--- trunk/apps/qubit/modules/repository/actions/deleteAction.class.php  Mon Sep 
14 18:32:10 2009        (r3297)
+++ trunk/apps/qubit/modules/repository/actions/deleteAction.class.php  Mon Sep 
14 18:43:27 2009        (r3298)
@@ -21,20 +21,17 @@
 {
   public function execute($request)
   {
-   $repository = QubitRepository::getById($this->getRequestParameter('id'));
+    $repository = QubitRepository::getById($request->id);
 
-   $this->forward404Unless($repository);
-
-    // keep track of informationObjects that require a foreign key reset and
-    // search index update due to the deletion of related repository
-    $informationObjects = array();
-    $criteria = new Criteria;
-    $criteria->add(QubitInformationObject::REPOSITORY_ID, 
$repository->getId());
-    $informationObjects = QubitInformationObject::get($criteria);
+    if (!isset($repository))
+    {
+      $this->forward404();
+    }
 
-    foreach ($informationObjects as $informationObject)
+    foreach ($repository->informationObjects as $informationObject)
     {
-      $informationObject->setRepositoryId(null);
+      unset($informationObject->repository);
+
       $informationObject->save();
     }
 

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Qubit Toolkit Commits" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.ca/group/qubit-commits?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to