Author: jablko
Date: Thu Sep 24 16:14:35 2009
New Revision: 3522
Log:
Drop calls to ->transient for the time being, fixes issues 890, 891, and 894
Modified:
trunk/lib/model/QubitInformationObject.php
trunk/lib/model/QubitObject.php
Modified: trunk/lib/model/QubitInformationObject.php
==============================================================================
--- trunk/lib/model/QubitInformationObject.php Thu Sep 24 16:02:09 2009
(r3521)
+++ trunk/lib/model/QubitInformationObject.php Thu Sep 24 16:14:35 2009
(r3522)
@@ -137,86 +137,74 @@
// Save updated related event objects (update search index after updating
// all related objects that are included in the index document)
- if (0 < count($this->events->transient))
+ foreach ($this->events as $event)
{
- foreach ($this->events->transient as $event)
- {
- $event->setIndexOnSave(false);
- $event->setInformationObjectId($this->getId());
+ $event->setIndexOnSave(false);
+ $event->informationObject = $this;
- try
- {
- $event->save();
- }
- catch (PropelException $e)
- {
- }
+ try
+ {
+ $event->save();
+ }
+ catch (PropelException $e)
+ {
}
}
// Save updated properties
- if (0 < count($this->propertys->transient))
+ foreach ($this->propertys as $property)
{
- foreach ($this->propertys->transient as $property)
- {
- $property->setIndexOnSave(false);
- $property->setObject($this);
+ $property->setIndexOnSave(false);
+ $property->object = $this;
- try
- {
- $property->save();
- }
- catch (PropelException $e)
- {
- }
+ try
+ {
+ $property->save();
+ }
+ catch (PropelException $e)
+ {
}
}
// Save new digital objects
// TODO: Allow adding additional DOs as derivatives
- if (0 < count($this->digitalObjects->transient))
+ foreach ($this->digitalObjects as $digitalObject)
{
- foreach ($this->digitalObjects->transient as $digitalObject)
- {
- $digitalObject->indexOnSave = false;
- $digitalObject->setInformationObject($this);
-
- try
- {
- $digitalObject->save();
- }
- catch (PropelException $e)
- {
- }
+ $digitalObject->indexOnSave = false;
+ $digitalObject->informationObject = $this;
- break; // only save one digital object per info object
+ try
+ {
+ $digitalObject->save();
+ }
+ catch (PropelException $e)
+ {
}
+
+ break; // only save one digital object per info object
}
// Save updated Status
- if (0 < count($this->statuss->transient))
+ $publicationStatusUpdate = false;
+ foreach ($this->statuss as $status)
{
- $publicationStatusUpdate = false;
- foreach ($this->statuss->transient as $status)
+ $status->setIndexOnSave(false);
+ $status->setObject($this);
+ $status->save();
+ if ($status->typeId == QubitTerm::STATUS_TYPE_PUBLICATION_ID)
{
- $status->setIndexOnSave(false);
- $status->setObject($this);
- $status->save();
- if ($status->typeId == QubitTerm::STATUS_TYPE_PUBLICATION_ID)
- {
- $publicationStatusUpdate = true;
- }
+ $publicationStatusUpdate = true;
}
- if ($publicationStatusUpdate)
+ }
+ if ($publicationStatusUpdate)
+ {
+ // if publication status has changed, set the status of all its
descendants to null
+ // so that they inherit the newly changed status, and update their
search index
+ // document so that the changed status is reflected in search and list
browse results
+ foreach ($this->descendants as $descendant)
{
- // if publication status has changed, set the status of all its
descendants to null
- // so that they inherit the newly changed status, and update their
search index
- // document so that the changed status is reflected in search and list
browse results
- foreach ($this->descendants as $descendant)
- {
- $descendant->setStatus($options = array('typeId' =>
QubitTerm::STATUS_TYPE_PUBLICATION_ID, 'statusId' => null));
- $descendant->save();
- }
+ $descendant->setStatus($options = array('typeId' =>
QubitTerm::STATUS_TYPE_PUBLICATION_ID, 'statusId' => null));
+ $descendant->save();
}
}
Modified: trunk/lib/model/QubitObject.php
==============================================================================
--- trunk/lib/model/QubitObject.php Thu Sep 24 16:02:09 2009 (r3521)
+++ trunk/lib/model/QubitObject.php Thu Sep 24 16:14:35 2009 (r3522)
@@ -24,74 +24,62 @@
parent::save($connection);
// Save updated objectTermRelations
- if (0 < count($this->objectTermRelationsRelatedByobjectId->transient))
+ foreach ($this->objectTermRelationsRelatedByobjectId as $relation)
{
- foreach ($this->objectTermRelationsRelatedByobjectId->transient as
$objectTermRelation)
- {
- $objectTermRelation->setIndexOnSave(false);
- $objectTermRelation->setObject($this);
+ $relation->setIndexOnSave(false);
+ $relation->object = $this;
- try
- {
- $objectTermRelation->save();
- }
- catch (PropelException $e)
- {
- }
+ try
+ {
+ $relation->save();
+ }
+ catch (PropelException $e)
+ {
}
}
// Save updated notes
- if (0 < count($this->notes->transient))
+ foreach ($this->notes as $note)
{
- foreach ($this->notes->transient as $note)
- {
- $note->setIndexOnSave(false);
- $note->setObject($this);
+ $note->setIndexOnSave(false);
+ $note->object = $this;
- try
- {
- $note->save();
- }
- catch (PropelException $e)
- {
- }
+ try
+ {
+ $note->save();
+ }
+ catch (PropelException $e)
+ {
}
}
// Save updated object relations
- if (0 < count($this->relationsRelatedByobjectId->transient))
+ foreach ($this->relationsRelatedByobjectId as $relation)
{
- foreach ($this->relationsRelatedByobjectId->transient as $relation)
- {
- $relation->setIndexOnSave(false);
- $relation->setObject($this);
+ $relation->setIndexOnSave(false);
+ $relation->object = $this;
- try
- {
- $relation->save();
- }
- catch (PropelException $e)
- {
- }
+ try
+ {
+ $relation->save();
+ }
+ catch (PropelException $e)
+ {
}
}
// Save updated subject relations
- if (0 < count($this->relationsRelatedBysubjectId->transient))
+ foreach ($this->relationsRelatedBysubjectId as $relation)
{
- foreach ($this->relationsRelatedBysubjectId->transient as $relation)
- {
- $relation->setIndexOnSave(false);
- $relation->setSubject($this);
+ $relation->setIndexOnSave(false);
+ $relation->subject = $this;
- try
- {
- $relation->save();
- }
- catch (PropelException $e)
- {
- }
+ try
+ {
+ $relation->save();
+ }
+ catch (PropelException $e)
+ {
}
}
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---