Author: sevein
Date: Tue Oct 13 16:55:47 2009
New Revision: 3735
Log:
Update the way child information objects are added to it parent.
updateChildLevels() don't need to be called after
$this->informationObject->save(). Thanks to David and Jack for deep advices,
:-).
Modified:
trunk/apps/qubit/modules/informationobject/actions/editAction.class.php
trunk/lib/model/QubitInformationObject.php
Modified:
trunk/apps/qubit/modules/informationobject/actions/editAction.class.php
==============================================================================
--- trunk/apps/qubit/modules/informationobject/actions/editAction.class.php
Tue Oct 13 16:48:56 2009 (r3734)
+++ trunk/apps/qubit/modules/informationobject/actions/editAction.class.php
Tue Oct 13 16:55:47 2009 (r3735)
@@ -357,12 +357,11 @@
$this->updateNotes();
$this->updateEvents();
$this->updateStatus();
+ $this->updateChildLevels();
// save informationObject after setting all of its attributes...
$this->informationObject->save();
- $this->updateChildLevels();
-
// delete related objects marked for deletion
$this->deleteNotes();
$this->deleteEvents();
@@ -443,7 +442,11 @@
$this->publicationNotes =
$this->informationObject->getNotesByType($options = array ('noteTypeId' =>
QubitTerm::PUBLICATION_NOTE_ID));
// Get child levels
- $this->childLevels = $this->informationObject->getChildren();
+ $this->childLevels = null;
+ if ($this->informationObject->id)
+ {
+ $this->childLevels = $this->informationObject->getChildren();
+ }
if ($request->isMethod('post'))
{
@@ -683,7 +686,6 @@
else
{
$childLevel = new QubitInformationObject;
- $childLevel->setParentId($this->informationObject->id);
}
$childLevel->setIdentifier($childLevelFormData['identifier']);
@@ -699,7 +701,7 @@
0 < strlen($childLevelFormData['title'])
)
{
- $childLevel->save();
+ $this->informationObject->informationObjectsRelatedByparentId[] =
$childLevel;
}
}
}
Modified: trunk/lib/model/QubitInformationObject.php
==============================================================================
--- trunk/lib/model/QubitInformationObject.php Tue Oct 13 16:48:56 2009
(r3734)
+++ trunk/lib/model/QubitInformationObject.php Tue Oct 13 16:55:47 2009
(r3735)
@@ -135,6 +135,21 @@
{
parent::save($connection);
+ // Save related information objects
+ foreach ($this->informationObjectsRelatedByparentId as $child)
+ {
+ $child->setIndexOnSave(false);
+ $child->setParentId($this->id);
+
+ try
+ {
+ $child->save();
+ }
+ catch (PropelExceptino $e)
+ {
+ }
+ }
+
// Save updated related event objects (update search index after updating
// all related objects that are included in the index document)
foreach ($this->events as $event)
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---