/** * Shift the eff/exp dates of this table so that it fits within its parent(s) (parent_eff <= child_eff < child_exp <= parent_exp) * @param $record Doctrine_Record * @return null */ protected function limitParentDates(Doctrine_Record $child) { // loop through temporal relationships and make sure this date range is inside the parent's range foreach ($this->_options['parents'] as &$parent) { try { $parent_obj = $child->{$parent}; // TODO causes $parent->_oldValues to be erased $child->setDatesWithinParent($parent_obj); } catch (Doctrine_Record_SavingNonsenseException $e) { $child->delete(); } } }
private function processDelete(Doctrine_Record $obj, sfWebRequest $request, $type = null) { $request->checkCSRFProtection(); $this->setFlashMessageByType($obj->delete(), $type); $this->redirect('@opCalendarPlugin'); }
public function delete() { $identifier = $this->identifier(); $identifier = implode(', ', $identifier); // If column aggregation is used on this model we will have $class_type defined. Ensure it's set model is loaded if (isset($this['class_type'])) { kohana::log('debug', 'Initialized model ' . $this['class_type'] . ' for delete operation.'); Doctrine::initializeModels($this->class_type); } if (!self::getBaseTransactionObject()) { self::setBaseSaveObject($this); } try { // Before we run the parrent we need to unlink our number // this is because the parent will lock the record and if we // are proxied then we will not be able to get the necessary fields // populated (ya that was a bitch to figure out) if (get_parent_class($this) == 'Bluebox_Record') { $class_type = get_class($this) . 'Number'; //transform to class name } else { $class_type = get_parent_class($this) . 'Number'; //transform to original parent's class name } $numbers = Doctrine_Query::create()->from('Number n')->where('class_type = ?', $class_type)->andWhere('foreign_id = ?', $identifier)->execute(); foreach ($numbers as $number) { kohana::log('debug', 'Scheduling detach of number ' . $number['number_id'] . ' from ' . get_class($this) . ' ' . $identifier); $number->class_type = NULL; $number->foreign_id = 0; } parent::delete(); // Ok now if we got this far go ahead an unlink the number, we didnt // unlink above because we where not sure if we are in a transaction // and if we are not we want to delete to succeed before we unlink :) if (!empty($numbers)) { foreach ($numbers as $number) { kohana::log('debug', 'Detaching number ' . $number['number_id']); $number->save(); } } // Done with any events that may use this if (self::getBaseTransactionObject() == $this) { self::setBaseSaveObject(NULL); } $identifier = $this->identifier(); $identifier = implode(', ', $identifier); Kohana::log('debug', 'Deleted record ' . get_class($this) . ' ' . $identifier); return TRUE; } catch (Doctrine_Validator_Exception $e) { Kohana::log('error', 'Doctrine_Validator_Exception: ' . $e->getMessage()); self::normalizeErrors($e); return FALSE; } catch (Doctrine_Transaction_Exception $e) { Kohana::log('error', 'Doctrine_Transaction_Exception: ' . $e->getMessage()); self::setBaseSaveObject(NULL); throw new Doctrine_Transaction_Exception($e->getMessage()); return FALSE; } catch (Doctrine_Connection_Exception $e) { Kohana::log('error', 'Doctrine_Connection_Exception (' . get_class($this) . '): ' . $e->getMessage()); self::setBaseSaveObject(NULL); throw new Doctrine_Connection_Exception($e->getMessage()); return FALSE; } catch (Exception $e) { Kohana::log('error', 'Unhandled ' . get_class($e) . ': ' . $e->getMessage()); self::setBaseSaveObject(NULL); throw new Exception($e->getMessage()); return FALSE; } }
public function delete(Doctrine_Connection $conn = null) { $configuration = ProjectConfiguration::getApplicationConfiguration('frontend', 'test', true); sfContext::createInstance($configuration)->getLogger()->err('{I18NTester} delete() called!'); parent::delete($conn); }