Ejemplo n.º 1
0
 public function delete($connection = null)
 {
     parent::delete($connection);
     if ($this->getObject() instanceof QubitInformationObject) {
         QubitSearch::updateInformationObject($this->getObject());
     }
 }
Ejemplo n.º 2
0
 public function delete($connection = null)
 {
     parent::delete($connection);
     if (isset($this->informationObject)) {
         QubitSearch::updateInformationObject($this->getInformationObject());
     }
 }
 /**
  * Override base delete method to unlink related digital assets (thumbnail
  * and file)
  *
  * @param  sfConnection  A database connection
  */
 public function delete($connection = null)
 {
     $criteria = new Criteria();
     $criteria->add(QubitDigitalObject::PARENT_ID, $this->id);
     $children = QubitDigitalObject::get($criteria);
     // Delete children
     foreach ($children as $child) {
         foreach (QubitRelation::getBySubjectOrObjectId($this->id) as $item) {
             $item->delete();
         }
         $child->delete();
     }
     // Delete digital asset
     if (file_exists($this->getAbsolutePath())) {
         unlink($this->getAbsolutePath());
     }
     // Prune asset directory, if empty
     self::pruneEmptyDirs(sfConfig::get('sf_web_dir') . $this->path);
     foreach (QubitRelation::getBySubjectOrObjectId($this->id) as $item) {
         $item->delete();
     }
     // Update search index before deleting self
     if (!empty($this->informationObjectId)) {
         QubitSearch::updateInformationObject($this->getInformationObject());
     }
     // Delete self
     parent::delete($connection);
 }
 public function save($connection = null)
 {
     parent::save($connection);
     // Save child information objects
     foreach ($this->informationObjectsRelatedByparentId->transient as $item) {
         // TODO Needed if $this is new, should be transparent
         $item->parent = $this;
         try {
             $item->save($connection);
         } catch (PropelException $e) {
         }
     }
     // Save updated related events (update search index after updating all
     // related objects that are included in the index document)
     foreach ($this->events as $item) {
         $item->setIndexOnSave(false);
         // TODO Needed if $this is new, should be transparent
         $item->informationObject = $this;
         try {
             $item->save($connection);
         } catch (PropelException $e) {
         }
     }
     // Save new digital objects
     // TODO Allow adding additional digital objects as derivatives
     foreach ($this->digitalObjects as $item) {
         $item->indexOnSave = false;
         // TODO Needed if $this is new, should be transparent
         $item->informationObject = $this;
         try {
             $item->save($connection);
         } catch (PropelException $e) {
         }
         break;
         // Save only one digital object per information object
     }
     // Save updated Status
     foreach ($this->statuss as $item) {
         $item->setIndexOnSave(false);
         // TODO Needed if $this is new, should be transparent
         $item->object = $this;
         $item->save($connection);
     }
     QubitSearch::updateInformationObject($this);
     return $this;
 }
Ejemplo n.º 5
0
 protected function updateLinkedInfoObjects()
 {
     foreach ($this->resource->objectTermRelations as $item) {
         if ($item->object instanceof QubitInformationObject) {
             QubitSearch::updateInformationObject($item->object);
         }
     }
     return $this;
 }