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


PHP ZurmoRedBean::trash方法代码示例

本文整理汇总了PHP中ZurmoRedBean::trash方法的典型用法代码示例。如果您正苦于以下问题:PHP ZurmoRedBean::trash方法的具体用法?PHP ZurmoRedBean::trash怎么用?PHP ZurmoRedBean::trash使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ZurmoRedBean的用法示例。


在下文中一共展示了ZurmoRedBean::trash方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: delete

 /**
  *Deletes a configuration entry.
  * @param $user id
  * @param $moduleName A non-empty string identifying the module to which
  * the configuration entry belongs.
  * @param $key A non-empty string identifying the configuration entry.
  */
 public static function delete($userId, $moduleName, $key)
 {
     assert('$userId != null && is_int($userId)');
     assert('is_string($moduleName)');
     assert('is_string($key)');
     assert('$moduleName != ""');
     assert('$key        != ""');
     $bean = UserConfiguration::getBean($userId, $moduleName, $key);
     if (isset($bean)) {
         ZurmoRedBean::trash($bean);
         unset($bean);
     }
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:20,代码来源:UserConfiguration.php

示例2: unrestrictedDelete

 protected function unrestrictedDelete()
 {
     $this->forget();
     // RedBeanModel only supports cascaded deletes on associations,
     // not on links. So for now at least they are done the slow way.
     foreach (RuntimeUtil::getClassHierarchy(get_class($this), static::$lastClassInBeanHeirarchy) as $modelClassName) {
         if ($modelClassName::getCanHaveBean()) {
             $this->deleteOwnedRelatedModels($modelClassName);
             $this->deleteForeignRelatedModels($modelClassName);
             $this->deleteManyManyRelations($modelClassName);
         }
     }
     foreach ($this->modelClassNameToBean as $modelClassName => $bean) {
         ZurmoRedBean::trash($bean);
     }
     // The model cannot be used anymore.
     $this->deleted = true;
     return true;
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:19,代码来源:RedBeanModel.php

示例3: save

 public function save($runValidation = true)
 {
     if (!parent::save($runValidation)) {
         return false;
     }
     foreach ($this->deferredRelateBeans as $bean) {
         if ($this->linkType == RedBeanModel::LINK_TYPE_POLYMORPHIC) {
             if ($this->bean->id == null) {
                 ZurmoRedBean::store($this->bean);
             }
             $polyIdFieldName = strtolower($this->linkName) . '_id';
             $polyTypeFieldName = strtolower($this->linkName) . '_type';
             $bean->{$polyTypeFieldName} = $this->bean->getMeta('type');
             $bean->{$polyIdFieldName} = $this->bean->id;
         } else {
             ZurmoRedBeanLinkManager::link($bean, $this->bean, $this->resolveLinkNameForCasing());
         }
         ZurmoRedBean::store($bean);
     }
     $this->deferredRelateBeans = array();
     $relatedModelClassName = $this->relatedModelClassName;
     $tableName = $relatedModelClassName::getTableName();
     foreach ($this->deferredUnrelateBeans as $bean) {
         if (!$this->owns) {
             if ($this->linkType == RedBeanModel::LINK_TYPE_POLYMORPHIC) {
                 throw new NotSupportedException("Polymorphic relations can not be NOT_OWNED");
             }
             ZurmoRedBeanLinkManager::breakLink($bean, $tableName, $this->resolveLinkNameForCasing());
             ZurmoRedBean::store($bean);
         } else {
             ZurmoRedBean::trash($bean);
         }
     }
     $this->deferredUnrelatedBeans = array();
     foreach ($this->deferredUnrelatedModels as $model) {
         $event = new CModelEvent($model);
         $model->onRedBeanOneToManyRelatedModelsChange($event);
     }
     $this->deferredUnrelatedModels = array();
     return true;
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:41,代码来源:RedBeanOneToManyRelatedModels.php

示例4: testCascadedDeleteDoesNotWorkForLinkedBeans

 public function testCascadedDeleteDoesNotWorkForLinkedBeans()
 {
     $member = ZurmoRedBean::dispense('marketinglistmember');
     $member->unsubscribed = true;
     ZurmoRedBean::store($member);
     $list = ZurmoRedBean::dispense('marketinglist');
     $list->name = 'dummy';
     ZurmoRedBean::store($list);
     ZurmoRedBeanLinkManager::link($member, $list);
     ZurmoRedBean::store($member);
     $id = $list->id;
     unset($list);
     ZurmoRedBean::trash($member);
     unset($member);
     $list = ZurmoRedBean::load('marketinglist', $id);
     $this->assertNotNull($list);
     // The list is not deleted.
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:18,代码来源:RedBeanTest.php


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