本文整理汇总了PHP中BaseObject::isDeleted方法的典型用法代码示例。如果您正苦于以下问题:PHP BaseObject::isDeleted方法的具体用法?PHP BaseObject::isDeleted怎么用?PHP BaseObject::isDeleted使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BaseObject
的用法示例。
在下文中一共展示了BaseObject::isDeleted方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: retrieveOrCreateByObject
public static function retrieveOrCreateByObject(BaseObject $object)
{
if ($object->isNew() === true || $object->isModified() === true || $object->isDeleted() === true) {
throw new Exception('You can only approve an object which has already been saved');
}
$columnName = sfConfig::get('propel_behavior_sfPropelApprovableBehavior_' . get_class($object) . '_column', 'is_approved');
$approvedValue = sfConfig::get('propel_behavior_sfPropelApprovableBehavior_' . get_class($object) . '_approved_value', true);
$disabledApplications = sfConfig::get('propel_behavior_sfPropelApprovableBehavior_' . get_class($object) . '_disabled_applications');
// Test if we should crated an approval - is the column value different to out required value?
// If our object is already approved then we can delete other
$columnGetter = 'get' . sfInflector::camelize($columnName);
if ($approvedValue != $object->{$columnGetter}()) {
$c = new Criteria();
$c->add(sfApprovalPeer::APPROVABLE_ID, $object->getPrimaryKey());
$c->add(sfApprovalPeer::APPROVABLE_MODEL, get_class($object));
$approval = sfApprovalPeer::doSelectOne($c);
if (!$approval) {
$approval = new sfApproval();
$approval->setApprovableModel(get_class($object));
$approval->setApprovableId($object->getPrimaryKey());
$approval->setUuid(sfPropelApprovableToolkit::generateUuid());
$approval->save();
}
return $approval;
} else {
sfApprovalPeer::deleteByObject($object);
return null;
}
return $approval;
}
示例2: getApproval
public function getApproval(BaseObject $object)
{
if ($object->isNew() === true || $object->isModified() === true || $object->isDeleted() === true) {
throw new Exception('You can only approve an object which has already been saved');
}
$columnName = sfConfig::get('propel_behavior_sfPropelApprovableBehavior_' . get_class($object) . '_column', 'is_approved');
$approvedValue = sfConfig::get('propel_behavior_sfPropelApprovableBehavior_' . get_class($object) . '_approved_value', true);
$disabledApplications = sfConfig::get('propel_behavior_sfPropelApprovableBehavior_' . get_class($object) . '_disabled_applications');
// Test if we should crated an approval - is the column value different to out required value?
// If our object is already approved then we can delete other
$columnGetter = 'get' . sfInflector::camelize($columnName);
if ($approvedValue != $object->{$columnGetter}()) {
return sfApprovalPeer::retrieveOrCreateByObject($object);
} else {
sfApprovalPeer::deleteByObject($object);
return null;
}
}