本文整理汇总了PHP中EEM_Base::set_model_query_blog_id方法的典型用法代码示例。如果您正苦于以下问题:PHP EEM_Base::set_model_query_blog_id方法的具体用法?PHP EEM_Base::set_model_query_blog_id怎么用?PHP EEM_Base::set_model_query_blog_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EEM_Base
的用法示例。
在下文中一共展示了EEM_Base::set_model_query_blog_id方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* About all child constructors:
* they should define the _tables, _fields and _model_relations arrays.
* Should ALWAYS be called after child constructor.
* In order to make the child constructors to be as simple as possible, this parent constructor
* finalizes constructing all the object's attributes.
* Generally, rather than requiring a child to code
* $this->_tables = array(
* 'Event_Post_Table' => new EE_Table('Event_Post_Table','wp_posts')
* ...);
* (thus repeating itself in the array key and in the constructor of the new EE_Table,)
* each EE_Table has a function to set the table's alias after the constructor, using
* the array key ('Event_Post_Table'), instead of repeating it. The model fields and model relations
* do something similar.
*
* @param null $timezone
* @throws \EE_Error
*/
protected function __construct($timezone = NULL)
{
// check that the model has not been loaded too soon
if (!did_action('AHEE__EE_System__load_espresso_addons')) {
throw new EE_Error(sprintf(__('The %1$s model can not be loaded before the "AHEE__EE_System__load_espresso_addons" hook has been called. This gives other addons a chance to extend this model.', 'event_espresso'), get_class($this)));
}
/**
* Set blogid for models to current blog. However we ONLY do this if $_model_query_blog_id is not already set.
*/
if (empty(EEM_Base::$_model_query_blog_id)) {
EEM_Base::set_model_query_blog_id();
}
/**
* Filters the list of tables on a model. It is best to NOT use this directly and instead
* just use EE_Register_Model_Extension
* @var EE_Table_Base[] $_tables
*/
$this->_tables = apply_filters('FHEE__' . get_class($this) . '__construct__tables', $this->_tables);
foreach ($this->_tables as $table_alias => $table_obj) {
/** @var $table_obj EE_Table_Base */
$table_obj->_construct_finalize_with_alias($table_alias);
if ($table_obj instanceof EE_Secondary_Table) {
/** @var $table_obj EE_Secondary_Table */
$table_obj->_construct_finalize_set_table_to_join_with($this->_get_main_table());
}
}
/**
* Filters the list of fields on a model. It is best to NOT use this directly and instead just use
* EE_Register_Model_Extension
* @param EE_Model_Field_Base[] $_fields
*/
$this->_fields = apply_filters('FHEE__' . get_class($this) . '__construct__fields', $this->_fields);
$this->_invalidate_field_caches();
foreach ($this->_fields as $table_alias => $fields_for_table) {
if (!array_key_exists($table_alias, $this->_tables)) {
throw new EE_Error(sprintf(__("Table alias %s does not exist in EEM_Base child's _tables array. Only tables defined are %s", 'event_espresso'), $table_alias, implode(",", $this->_fields)));
}
foreach ($fields_for_table as $field_name => $field_obj) {
/** @var $field_obj EE_Model_Field_Base | EE_Primary_Key_Field_Base */
//primary key field base has a slightly different _construct_finalize
/** @var $field_obj EE_Model_Field_Base */
$field_obj->_construct_finalize($table_alias, $field_name, $this->get_this_model_name());
}
}
// everything is related to Extra_Meta
if (get_class($this) !== 'EEM_Extra_Meta') {
//make extra meta related to everything, but don't block deleting things just
//because they have related extra meta info. For now just orphan those extra meta
//in the future we should automatically delete them
$this->_model_relations['Extra_Meta'] = new EE_Has_Many_Any_Relation(FALSE);
}
//and change logs
if (get_class($this) !== 'EEM_Change_Log') {
$this->_model_relations['Change_Log'] = new EE_Has_Many_Any_Relation(FALSE);
}
/**
* Filters the list of relations on a model. It is best to NOT use this directly and instead just use
* EE_Register_Model_Extension
* @param EE_Model_Relation_Base[] $_model_relations
*/
$this->_model_relations = apply_filters('FHEE__' . get_class($this) . '__construct__model_relations', $this->_model_relations);
foreach ($this->_model_relations as $model_name => $relation_obj) {
/** @var $relation_obj EE_Model_Relation_Base */
$relation_obj->_construct_finalize_set_models($this->get_this_model_name(), $model_name);
}
foreach ($this->_indexes as $index_name => $index_obj) {
/** @var $index_obj EE_Index */
$index_obj->_construct_finalize($index_name, $this->get_this_model_name());
}
$this->set_timezone($timezone);
//finalize default where condition strategy, or set default
if (!$this->_default_where_conditions_strategy) {
//nothing was set during child constructor, so set default
$this->_default_where_conditions_strategy = new EE_Default_Where_Conditions();
}
$this->_default_where_conditions_strategy->_finalize_construct($this);
if (!$this->_minimum_where_conditions_strategy) {
//nothing was set during child constructor, so set default
$this->_minimum_where_conditions_strategy = new EE_Default_Where_Conditions();
}
$this->_minimum_where_conditions_strategy->_finalize_construct($this);
//if the cap slug hasn't been set, and we haven't set it to false on purpose
//.........这里部分代码省略.........