本文整理汇总了PHP中SelectQuery::leftJoin方法的典型用法代码示例。如果您正苦于以下问题:PHP SelectQuery::leftJoin方法的具体用法?PHP SelectQuery::leftJoin怎么用?PHP SelectQuery::leftJoin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SelectQuery
的用法示例。
在下文中一共展示了SelectQuery::leftJoin方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: hook_query_rules_autotag_terms_alter
/**
* Alter the term DB query.
*
* @param SelectQuery $query
* The query object ot alter.
*/
function hook_query_rules_autotag_terms_alter($query)
{
// Join the original term query from rules_autotag with our field table to
// exclude terms that should not be tagged.
$query->leftJoin('field_data_field_dont_autotag', 'fd', "t.tid = fd.entity_id AND fd.entity_type = 'taxonomy_term'");
$query->condition(db_or()->condition('fd.field_dont_autotag_value', NULL)->condition('fd.field_dont_autotag_value', '1', '<>'));
}
示例2: getTags
public static function getTags($table, $table_id = null)
{
if (is_null($table_id)) {
if (!$table instanceof DBObject) {
return false;
}
$table_id = $table->getMeta('id');
$table = $table->getMeta('table');
}
$query = new SelectQuery('Tag');
$query->leftJoin('TagLink', array('`tags`.`id` = `tag_links`.`tag_id`'))->filter('`tags`.`foreign_table` = :table')->filter('`tag_links`.`foreign_id` = :id');
return $query->fetchAll(array(':table' => $table, ':id' => $table_id));
}
示例3: get
public static function get($hook, $type = 'pre')
{
if (!BACKEND_WITH_DATABASE) {
return false;
}
$params = array(':type' => $type, ':hook' => $hook);
$query = new SelectQuery('Hook');
$query->leftJoin('Component', array('`hooks`.`class` = `components`.`name`'))->filter('`hooks`.`hook` = :hook')->filter('`hooks`.`type` = :type')->filter('`hooks`.`active` = 1')->filter('`components`.`active` = 1');
if (Controller::$area) {
$query->filter('`global` = 1 OR `class` = :area');
$params[':area'] = Controller::$area;
}
if (Controller::$view && Controller::$view->mode) {
$query->filter('`mode` IN (:mode, \'*\')');
$params[':mode'] = Controller::$view->mode;
}
$query->order('`sequence`');
return $query->fetchAll($params);
}
示例4: action_roles
public function action_roles($id = false)
{
$toret = new stdClass();
if ($id) {
$toret->role = Role::retrieve($id, 'dbobject');
if ($toret->role) {
$query = new SelectQuery('Permission');
$query->filter('`role` = :role');
$toret->permissions = $query->fetchAll(array(':role' => $toret->role->array['name']));
$query = new SelectQuery('Assignment');
$query->leftJoin('BackendUser', array('`backend_users`.`id` = `assignments`.`access_id`'))->filter("`assignments`.`access_type` = 'users'")->filter('`role_id` = :role OR `role_id` = 0');
$toret->assignments = $query->fetchAll(array(':role' => $toret->role->array['id']));
} else {
$toret->permissions = null;
}
} else {
$toret->roles = Role::retrieve();
}
return $toret;
}
示例5: joinProperties
private function joinProperties(SelectQuery $query, ProtoDAO $parentDao, $parentTable, $parentRequired, $prefix = null)
{
$proto = call_user_func(array($parentDao->getObjectName(), 'proto'));
foreach ($proto->getPropertyList() as $property) {
if ($property instanceof LightMetaProperty && $property->getRelationId() == MetaRelation::ONE_TO_ONE && !$property->isGenericType() && (!$property->getFetchStrategyId() && $this->getFetchStrategy()->getId() == FetchStrategy::JOIN || $property->getFetchStrategyId() == FetchStrategy::JOIN)) {
if (is_subclass_of($property->getClassName(), 'Enumeration')) {
// field already added by makeSelectHead
continue;
} elseif ($property->isInner()) {
$proto = call_user_func(array($property->getClassName(), 'proto'));
foreach ($proto->getPropertyList() as $innerProperty) {
$query->get(new DBField($innerProperty->getColumnName(), $parentTable));
}
continue;
}
$propertyDao = call_user_func(array($property->getClassName(), 'dao'));
// add's custom dao's injection possibility
if (!$propertyDao instanceof ProtoDAO) {
continue;
}
$tableAlias = $propertyDao->getJoinName($property->getColumnName(), $prefix);
$fields = $propertyDao->getFields();
if (!$query->hasJoinedTable($tableAlias)) {
$logic = Expression::eq(DBField::create($property->getColumnName(), $parentTable), DBField::create($propertyDao->getIdName(), $tableAlias));
if ($property->isRequired() && $parentRequired) {
$query->join($propertyDao->getTable(), $logic, $tableAlias);
} else {
$query->leftJoin($propertyDao->getTable(), $logic, $tableAlias);
}
}
foreach ($fields as $field) {
$query->get(new DBField($field, $tableAlias), $propertyDao->getJoinPrefix($property->getColumnName(), $prefix) . $field);
}
$this->joinProperties($query, $propertyDao, $tableAlias, $property->isRequired() && $parentRequired, $propertyDao->getJoinPrefix($property->getColumnName(), $prefix));
}
}
}