当前位置: 首页>>代码示例>>PHP>>正文


PHP BaseObject::isModified方法代码示例

本文整理汇总了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;
 }
开发者ID:sgrove,项目名称:cothinker,代码行数:30,代码来源:PluginsfApprovalPeer.php

示例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;
     }
 }
开发者ID:sgrove,项目名称:cothinker,代码行数:18,代码来源:sfPropelApprovableBehavior.class.php


注:本文中的BaseObject::isModified方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。