本文整理匯總了PHP中BaseObject::isModified方法的典型用法代碼示例。如果您正苦於以下問題:PHP BaseObject::isModified方法的具體用法?PHP BaseObject::isModified怎麽用?PHP BaseObject::isModified使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類BaseObject
的用法示例。
在下文中一共展示了BaseObject::isModified方法的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;
}
}