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


PHP PodsForm::delete方法代码示例

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


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

示例1: delete_object_from_relationships

 /**
  * Delete an object from tableless fields
  *
  * @param int $id
  * @param string $type
  * @param string $name
  *
  * @return bool
  *
  * @since 2.3
  */
 public function delete_object_from_relationships($id, $object, $name = null)
 {
     /**
      * @var $pods_init \PodsInit
      */
     global $pods_init;
     $pod = false;
     // Run any bidirectional delete operations
     if (is_array($object)) {
         $pod = $object;
     } elseif (is_object($pods_init)) {
         $pod = PodsInit::$meta->get_object($object, $name);
     }
     if (!empty($pod)) {
         $object = $pod['type'];
         $name = $pod['name'];
         foreach ($pod['fields'] as $field) {
             PodsForm::delete($field['type'], $id, $field['name'], array_merge($field, $field['options']), $pod);
         }
     }
     // Lookup related fields (non-bidirectional)
     $params = array('where' => array(array('key' => 'type', 'value' => 'pick'), array('key' => 'pick_object', 'value' => $object)));
     if (!empty($name) && $name != $object) {
         $params['where'][] = array('key' => 'pick_val', 'value' => $name);
     }
     $fields = $this->load_fields($params, false);
     if (!empty($pod) && 'media' == $pod['type']) {
         $params['where'] = array(array('key' => 'type', 'value' => 'file'));
         $fields = array_merge($fields, $this->load_fields($params, false));
     }
     if (is_array($fields) && !empty($fields)) {
         foreach ($fields as $related_field) {
             $related_pod = $this->load_pod(array('id' => $related_field['pod_id'], 'fields' => false), false);
             if (empty($related_pod)) {
                 continue;
             }
             $related_from = $this->lookup_related_items_from($related_field['id'], $related_pod['id'], $id, $related_field, $related_pod);
             $this->delete_relationships($related_from, $id, $related_pod, $related_field);
         }
     }
     if (!empty($pod) && !pods_tableless()) {
         pods_query("\n                DELETE FROM `@wp_podsrel`\n                WHERE\n                (\n                    `pod_id` = %d\n                    AND `item_id` = %d\n                )\n                OR (\n                    `related_pod_id` = %d\n                    AND `related_item_id` = %d\n                )\n            ", array($pod['id'], $id, $pod['id'], $id));
     }
     return true;
 }
开发者ID:satokora,项目名称:IT354Project,代码行数:56,代码来源:PodsAPI.php


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