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


PHP EEM_Base::get_all方法代码示例

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


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

示例1: get_all_deleted

 /**
  * For 'soft deletable' models, gets all which ARE deleted, according to conditions specified in $query_params.
  * @param array $query_params like EEM_Base::get_all
  * @return EE_Soft_Delete_Base_Class[]
  */
 public function get_all_deleted($query_params = array())
 {
     $query_params = $this->_alter_query_params_so_only_trashed_items_included($query_params);
     return parent::get_all($query_params);
 }
开发者ID:antares-ff,项目名称:ANTARES-Test,代码行数:10,代码来源:EEM_Soft_Delete_Base.model.php

示例2: _update_from_data_array

 /**
  * Given the model object data, finds the row to update and updates it
  * @param string|int $id_in_csv
  * @param array $model_object_data
  * @param EEM_Base $model
  * @param array $old_db_to_new_db_mapping
  * @return array updated $old_db_to_new_db_mapping
  */
 protected function _update_from_data_array($id_in_csv, $model_object_data, $model, $old_db_to_new_db_mapping)
 {
     try {
         //let's keep two copies of the model object data:
         //one for performing an update, one for everthing else
         $model_object_data_for_update = $model_object_data;
         if ($model->has_primary_key_field()) {
             $conditions = array($model->primary_key_name() => $model_object_data[$model->primary_key_name()]);
             //remove the primary key because we shouldn't use it for updating
             unset($model_object_data_for_update[$model->primary_key_name()]);
         } elseif ($model->get_combined_primary_key_fields() > 1) {
             $conditions = array();
             foreach ($model->get_combined_primary_key_fields() as $key_field) {
                 $conditions[$key_field->get_name()] = $model_object_data[$key_field->get_name()];
             }
         } else {
             $model->primary_key_name();
             //this shoudl just throw an exception, explaining that we dont have a primary key (or a combine dkey)
         }
         $success = $model->update($model_object_data_for_update, array($conditions));
         if ($success) {
             $this->_total_updates++;
             EE_Error::add_success(sprintf(__("Successfully updated %s with csv data %s", "event_espresso"), $model->get_this_model_name(), implode(",", $model_object_data_for_update)));
             //we should still record the mapping even though it was an update
             //because if we were going to insert somethign but it was going to conflict
             //we would have last-minute decided to update. So we'd like to know what we updated
             //and so we record what record ended up being updated using the mapping
             if ($model->has_primary_key_field()) {
                 $new_key_for_mapping = $model_object_data[$model->primary_key_name()];
             } else {
                 //no primary key just a combined key
                 $new_key_for_mapping = $model->get_index_primary_key_string($model_object_data);
             }
             $old_db_to_new_db_mapping[$model->get_this_model_name()][$id_in_csv] = $new_key_for_mapping;
         } else {
             $matched_items = $model->get_all(array($conditions));
             if (!$matched_items) {
                 //no items were matched (so we shouldn't have updated)... but then we should have inserted? what the heck?
                 $this->_total_update_errors++;
                 EE_Error::add_error(sprintf(__("Could not update %s with the csv data: '%s' for an unknown reason (using WHERE conditions %s)", "event_espresso"), $model->get_this_model_name(), http_build_query($model_object_data), http_build_query($conditions)), __FILE__, __FUNCTION__, __LINE__);
             } else {
                 $this->_total_updates++;
                 EE_Error::add_success(sprintf(__("%s with csv data '%s' was found in the database and didn't need updating because all the data is identical.", "event_espresso"), $model->get_this_model_name(), implode(",", $model_object_data)));
             }
         }
     } catch (EE_Error $e) {
         $this->_total_update_errors++;
         $basic_message = sprintf(__("Could not update %s with the csv data: %s because %s", "event_espresso"), $model->get_this_model_name(), implode(",", $model_object_data), $e->getMessage());
         $debug_message = $basic_message . ' Stack trace: ' . $e->getTraceAsString();
         EE_Error::add_error("{$basic_message} | {$debug_message}", __FILE__, __FUNCTION__, __LINE__);
     }
     return $old_db_to_new_db_mapping;
 }
开发者ID:DavidSteinbauer,项目名称:event-espresso-core,代码行数:61,代码来源:EE_Import.class.php


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