本文整理汇总了PHP中Doctrine_Record::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Doctrine_Record::delete方法的具体用法?PHP Doctrine_Record::delete怎么用?PHP Doctrine_Record::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine_Record
的用法示例。
在下文中一共展示了Doctrine_Record::delete方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: limitParentDates
/**
* 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();
}
}
}
示例2: processDelete
private function processDelete(Doctrine_Record $obj, sfWebRequest $request, $type = null)
{
$request->checkCSRFProtection();
$this->setFlashMessageByType($obj->delete(), $type);
$this->redirect('@opCalendarPlugin');
}
示例3: delete
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;
}
}
示例4: delete
public function delete(Doctrine_Connection $conn = null)
{
$configuration = ProjectConfiguration::getApplicationConfiguration('frontend', 'test', true);
sfContext::createInstance($configuration)->getLogger()->err('{I18NTester} delete() called!');
parent::delete($conn);
}