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


PHP DataObject::delete方法代码示例

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


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

示例1: delete

 function delete($id = '', &$errors = array())
 {
     if (empty($id)) {
         $errors[] = 'No Party Contact Method identifier';
         return false;
     }
     $this->load($id);
     if (!$this->isLoaded()) {
         $errors[] = 'Cannot find Party Contact Method record';
         return false;
     }
     $db = DB::Instance();
     $flash = Flash::Instance();
     $db->StartTrans();
     if (!parent::delete()) {
         $db->FailTrans();
         $flash->addError($db->ErrorMsg());
     }
     // Delete the Contact Method if it is not used elsewhere
     if (!$this->contactmethod->delete($this->contactmethod->id, $errors)) {
         $db->FailTrans();
         $flash->addError($db->ErrorMsg());
     }
     return $db->CompleteTrans();
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:25,代码来源:PartyContactMethod.php

示例2: delete

 public function delete($id = null, $errors = array(), $archive = FALSE, $archive_table = null, $archive_schema = null)
 {
     if (!$this->isLoaded()) {
         if (empty($id)) {
             return false;
         } else {
             $this->load($id);
         }
     }
     $db = DB::Instance();
     $db->StartTrans();
     // Delete the associated file blob
     $result = $db->BlobDelete($this->file);
     if ($result) {
         // Now delete the file entry
         $result = parent::delete($id, $errors, $archive, $archive_table, $archive_schema);
     } else {
         $errors[] = 'Error deleting file : ' . $db->ErrorMsg();
     }
     if (!$result) {
         $db->FailtTrans();
     }
     $db->CompleteTrans();
     return $result;
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:25,代码来源:File.php

示例3: delete

 function delete()
 {
     foreach ($this->Newsletters() as $newsletter) {
         $newsletter->delete();
     }
     parent::delete();
 }
开发者ID:ramziammar,项目名称:websites,代码行数:7,代码来源:NewsletterType.php

示例4: delete

 public function delete()
 {
     $path = $this->getFullPath();
     if (file_exists($path)) {
         unlink($path);
     }
     parent::delete();
 }
开发者ID:helpfulrobot,项目名称:silverstripe-dms,代码行数:8,代码来源:DMSDocument_versions.php

示例5: deleteRecord

 /**
  * @param DataObject $record
  * @param int $index
  */
 public function deleteRecord($record, $index)
 {
     if ($record->hasExtension('Versioned')) {
         $record->deleteFromStage('Stage');
         $record->deleteFromStage('Live');
     } else {
         $record->delete();
     }
 }
开发者ID:markguinn,项目名称:silverstripe-gridfieldmultiselect,代码行数:13,代码来源:GridFieldMultiDeleteButton.php

示例6: delete

 function delete()
 {
     if ($this->Newsletters()) {
         foreach ($this->Newsletters() as $newsletter) {
             $newsletter->delete();
             $newsletter->destroy();
         }
     }
     parent::delete();
 }
开发者ID:nyeholt,项目名称:silverstripe-newsletter,代码行数:10,代码来源:NewsletterType.php

示例7: delete

 function delete(&$errors = array())
 {
     $db = DB::Instance();
     if (!$this->isUnposted()) {
         $errors[] = 'Only unposted GL Journal Headers can be deleted';
         return FALSE;
     }
     $db->startTrans();
     $this->setTransactionsCollection();
     $sh = new SearchHandler($this->transactions, FALSE);
     $this->setTransactionsConstraints($sh);
     if ($this->transactions->delete($sh) === FALSE || !parent::delete($this->{$this->idField}, $errors)) {
         $db->FailTrans();
     }
     return $db->CompleteTrans();
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:16,代码来源:GLTransactionHeader.php

示例8: delete

 function delete($ids = null, &$errors = array())
 {
     if (!empty($ids)) {
         if (!is_array($ids)) {
             $ids = array($ids);
         }
         $db = DB::Instance();
         $db->startTrans();
         foreach ($ids as $id) {
             if (!parent::delete($id, $errors)) {
                 $db->failTrans();
                 $db->completeTrans();
                 return FALSE;
             }
         }
         $db->completeTrans();
     }
     return TRUE;
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:19,代码来源:CompanyInCategories.php

示例9: delete

 public function delete($id = null, &$errors = array(), $archive = FALSE, $archive_table = null, $archive_schema = null)
 {
     if ($id == null && $this->isLoaded()) {
         $id = $this->{$this->idField};
     }
     if (!$this->isLoaded() && !empty($id) && !is_null($id)) {
         $this->load($id);
     }
     $file = DataObjectFactory::Factory('File');
     $db = DB::Instance();
     $db->StartTrans();
     if (!parent::delete(null, $errors, $archive, $archive_table, $archive_schema) || !$file->delete($this->file_id, $errors, $archive, $archive_table, $archive_schema)) {
         $result = FALSE;
         $db->FailTrans();
     } else {
         $result = TRUE;
     }
     $db->CompleteTrans();
     return $result;
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:20,代码来源:EntityAttachment.php

示例10: delete

 function delete($id = '', &$errors = array())
 {
     if (!$this->isLoaded()) {
         if (empty($id)) {
             $errors[] = 'No Address identifier';
             return false;
         } else {
             $this->load($id);
             if (!$this->isLoaded()) {
                 $errors[] = 'Cannot find Address record';
                 return false;
             }
         }
     }
     $partyaddress = DataObjectFactory::Factory('PartyAddress');
     $cc = new ConstraintChain();
     $cc->add(new Constraint('address_id', '=', $this->id));
     if ($partyaddress->getCount($cc) == 0 && !parent::delete($this->id, $errors)) {
         return false;
     }
     return true;
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:22,代码来源:Address.php

示例11: delete

 /**
  * Deletes the DMSDocument, its underlying file, as well as any tags related to this DMSDocument. Also calls the
  * parent DataObject's delete method.
  */
 function delete()
 {
     //remove tags
     $this->removeAllTags();
     //delete the file (and previous versions of files)
     $filesToDelete = array();
     $storageFolder = DMS::get_dms_path() . DIRECTORY_SEPARATOR . DMS::get_storage_folder($this->ID);
     if (file_exists($storageFolder)) {
         if ($handle = opendir($storageFolder)) {
             //Open directory
             //List files in the directory
             while (false !== ($entry = readdir($handle))) {
                 if (strpos($entry, $this->ID . '~') !== false) {
                     $filesToDelete[] = $entry;
                 }
             }
             closedir($handle);
             //delete all this files that have the id of this document
             foreach ($filesToDelete as $file) {
                 $filePath = $storageFolder . DIRECTORY_SEPARATOR . $file;
                 if (is_file($filePath)) {
                     unlink($filePath);
                 }
             }
         }
     }
     $this->removeAllPages();
     //delete the dataobject
     parent::delete();
 }
开发者ID:nyeholt,项目名称:silverstripe-dms,代码行数:34,代码来源:DMSDocument.php

示例12: actualizar

 function actualizar($id)
 {
     $this->rapyd->load('dataobject');
     $error = '';
     $odirect = new DataObject("odirect");
     $odirect->load($id);
     $status = $odirect->get('status');
     $compra = $odirect->get('compra');
     $pago = $odirect->get('pago');
     //print_r($odirect->get_all());
     //
     //echo "-".$status;
     //exit;
     if ($status == 'T') {
         $ocompra = new DataObject("ocompra");
         $ocompra->rel_one_to_many('odirect', 'odirect', array('numero' => 'compra'));
         $ocompra->load($compra);
         $o_subtotal = $ocompra->get('subtotal');
         $o_ivag = $ocompra->get('ivag');
         $o_ivar = $ocompra->get('ivar');
         $o_ivaa = $ocompra->get('ivaa');
         $o_reten = $ocompra->get('reten');
         $o_reteiva = $ocompra->get('reteiva');
         $o_abonado = $ocompra->get('abonado');
         $o_iva = $o_ivaa + $o_ivag + $o_ivar;
         $o_debe = $o_subtotal + ($o_iva - ($o_reten + $o_reteiva));
         $tot = 0;
         for ($i = 0; $i < $ocompra->count_rel('odirect'); $i++) {
             $r_pago = $ocompra->get_rel('odirect', 'pago', $i);
             $tot += $r_pago;
         }
         $a = $o_debe - ($tot - $pago);
         if ($pago > $a) {
             $error .= "<div class='alert'><p>El monto de la orden de pago({$pago}) es mayor al monto adeudado ({$a})</p></div>";
         }
     } else {
         $error .= "<div class='alert'><p>No se Puede Completar la operacion</p></div>";
     }
     if (empty($error)) {
         $ocompra->set('abonado', $tot);
         $odirect->set('status', 'O');
         if ($tot = $o_debe) {
             $odirect->set('ivag', $ocompra->get('ivag'));
             $odirect->set('ivar', $ocompra->get('ivar'));
             $odirect->set('ivaa', $ocompra->get('ivaa'));
             $odirect->set('reten', $ocompra->get('reten'));
             $odirect->set('creten', $ocompra->get('creten'));
             $odirect->set('reteiva', $ocompra->get('reteiva'));
             $odirect->set('exento', $ocompra->get('exento'));
             $ocompra->rel_one_to_many('itocompra', 'itocompra', array('numero' => 'numero'));
             $ocompra->load($compra);
             $codigoadm = $ocompra->get('estadmin');
             $fondo = $ocompra->get('fondo');
             $presup = new DataObject("presupuesto");
             $pk = array('codigoadm' => $codigoadm, 'tipo' => $fondo);
             $partidaiva = $this->datasis->traevalor("PARTIDAIVA");
             for ($i = 0; $i < $do->count_rel('itocompra'); $i++) {
                 $codigopres = $do->get_rel('itocompra', 'partida', $i);
                 $importe = $do->get_rel('itocompra', 'importe', $i);
                 $iva = $do->get_rel('itocompra', 'iva', $i);
                 $mont = $importe;
                 $pk['codigopres'] = $codigopres;
                 $presup->load($pk);
                 $opago = $presup->get("opago");
                 $opago = $opago + $mont;
                 $presup->set("opago", $opago);
                 $presup->save();
             }
             $pk['codigopres'] = $partidaiva;
             $presup->load($pk);
             $opago = $presup->get("opago");
             $opago += $ivan;
             $presup->set("opago", $opago);
             $presup->save();
         }
         $ocompra->save();
         $odirect->save();
     } else {
         $odirect->delete();
     }
     if (empty($error)) {
         redirect($this->url . "dataedit/show/{$id}");
     } else {
         $data['content'] = $error . anchor($this->url . "/dataedit/show/{$id}", 'Regresar');
         $data['title'] = " " . $this->tits . " ";
         $data["head"] = $this->rapyd->get_head() . script('jquery.js') . script("plugins/jquery.numeric.pack.js");
         $this->load->view('view_ventanas', $data);
     }
 }
开发者ID:enderochoa,项目名称:tortuga,代码行数:89,代码来源:opagonada.php

示例13: removeAuthority

 /**
  * Delete an authority
  *
  * @param DataObject $node 
  *			The node to delete from
  * @param DataObject $authority
  *			The AccessAuthority we're removing
  */
 public function removeAuthority(DataObject $node, DataObject $authority)
 {
     if (!$this->checkPerm($node, 'DeletePermissions')) {
         throw new PermissionDeniedException("You do not have permission to do that");
     }
     if ($authority) {
         $authority->delete();
     }
     return $node;
 }
开发者ID:nyeholt,项目名称:silverstripe-restrictedobjects,代码行数:18,代码来源:PermissionService.php

示例14: delete

 public function delete()
 {
     if ($this->canDelete(Member::currentUser())) {
         parent::delete();
     }
 }
开发者ID:vinstah,项目名称:body,代码行数:6,代码来源:Order.php

示例15: delete

 function delete()
 {
     $this->clearEverything();
     return parent::delete();
 }
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:5,代码来源:ApplicationDataObject.class.php


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