本文整理汇总了PHP中EEM_Base::relation_settings方法的典型用法代码示例。如果您正苦于以下问题:PHP EEM_Base::relation_settings方法的具体用法?PHP EEM_Base::relation_settings怎么用?PHP EEM_Base::relation_settings使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EEM_Base
的用法示例。
在下文中一共展示了EEM_Base::relation_settings方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
/**
* After this form has been initialized and is verified to be valid,
* either creates a model object from its data and saves it, or updates
* the model object its data represents
* @throws EE_Error
* @return int, 1 on a successful update, the ID of
* the new entry on insert; 0 on failure
*/
public function save()
{
if (!$this->_model_object) {
throw new EE_Error(sprintf(__("Cannot save the model form's model object (model is '%s') because there is no model object set. You must either set it, or call receive_form_submission where it is set automatically", "event_espresso"), get_class($this->_model)));
}
$success = $this->_model_object->save();
foreach ($this->_model->relation_settings() as $relation_name => $relation_obj) {
if (isset($this->_subsections[$relation_name])) {
$success = $this->_save_related_info($relation_name);
}
}
return $success;
}
示例2: relation_settings
/**
* Gets all the related models for the specified model. It's good to use this
* in case this model didn't exist for this version or something
* @param \EEM_Base $model
* @return \EE_Model_Relation_Base[]
*/
public function relation_settings(\EEM_Base $model)
{
$relations = array();
foreach ($model->relation_settings() as $relation_name => $relation_obj) {
if ($this->is_model_name_in_this_version($relation_name)) {
$relations[$relation_name] = $relation_obj;
}
}
//filter the results, but use the old filter name
return apply_filters('FHEE__Read__create_entity_from_wpdb_result__related_models_to_include', $relations, $model);
}