本文整理汇总了PHP中xPDOQuery::leftJoin方法的典型用法代码示例。如果您正苦于以下问题:PHP xPDOQuery::leftJoin方法的具体用法?PHP xPDOQuery::leftJoin怎么用?PHP xPDOQuery::leftJoin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xPDOQuery
的用法示例。
在下文中一共展示了xPDOQuery::leftJoin方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: prepareQueryBeforeCount
/** {@inheritDoc} */
public function prepareQueryBeforeCount(xPDOQuery $c)
{
$c->where(array('class_key' => 'msProduct'));
$c->leftJoin('msProductData', 'Data', 'msProduct.id = Data.id');
$c->leftJoin('msCategoryMember', 'Member', 'msProduct.id = Member.product_id');
$c->leftJoin('msVendor', 'Vendor', 'Data.vendor = Vendor.id');
$c->leftJoin('msCategory', 'Category', 'Category.id = msProduct.parent');
if ($this->getProperty('combo')) {
$c->select('msProduct.id,msProduct.pagetitle,msProduct.context_key');
} else {
$c->select($this->modx->getSelectColumns('msProduct', 'msProduct'));
$c->select($this->modx->getSelectColumns('msProductData', 'Data', '', array('id'), true));
$c->select($this->modx->getSelectColumns('msVendor', 'Vendor', 'vendor_', array('name')));
$c->select($this->modx->getSelectColumns('msCategory', 'Category', 'category_', array('pagetitle')));
}
if ($query = $this->getProperty('query', null)) {
$queryWhere = array('msProduct.id' => $query, 'OR:msProduct.pagetitle:LIKE' => '%' . $query . '%', 'OR:description:LIKE' => '%' . $query . '%', 'OR:introtext:LIKE' => '%' . $query . '%', 'OR:Data.article:LIKE' => '%' . $query . '%', 'OR:Data.vendor:LIKE' => '%' . $query . '%', 'OR:Data.made_in:LIKE' => '%' . $query . '%', 'OR:Vendor.name:LIKE' => '%' . $query . '%', 'OR:Category.pagetitle:LIKE' => '%' . $query . '%');
$c->where($queryWhere);
}
$parent = $this->getProperty('parent');
if (!empty($parent)) {
$category = $this->modx->getObject('modResource', $this->getProperty('parent'));
$this->parent = $parent;
$parents = array($parent);
if ($this->modx->getOption('ms2_category_show_nested_products', null, true)) {
$tmp = $this->modx->getChildIds($parent, 10, array('context' => $category->get('context_key')));
foreach ($tmp as $v) {
$parents[] = $v;
}
}
$c->orCondition(array('parent:IN' => $parents, 'Member.category_id:IN' => $parents), '', 1);
}
return $c;
}
示例2: prepareQueryBeforeCount
/**
* @param xPDOQuery $c
*
* @return xPDOQuery
*/
public function prepareQueryBeforeCount(xPDOQuery $c)
{
$c->leftJoin('modMediaSource', 'Source');
$c->leftJoin($this->classKey, 'Thumb', "`{$this->classKey}`.`id` = `Thumb`.`parent`");
$c->groupby($this->classKey . '.id');
$c->select('`Source`.`name` as `source_name`');
$c->select('`Thumb`.`url` as `thumbnail`');
$c->where(array('resource_id' => $this->getProperty('resource_id')));
$parent = $this->getProperty('parent');
if ($parent !== false) {
$c->where(array('parent' => $parent));
}
$query = trim($this->getProperty('query'));
if (!empty($query)) {
$c->where(array('file:LIKE' => "%{$query}%", 'OR:name:LIKE' => "%{$query}%", 'OR:alt:LIKE' => "%{$query}%", 'OR:description:LIKE' => "%{$query}%", 'OR:add:LIKE' => "%{$query}%"));
}
$tags = array_map('trim', explode(',', $this->getProperty('tags')));
if (!empty($tags[0])) {
$tags = implode("','", $tags);
$c->innerJoin('msResourceFileTag', 'Tag', "`{$this->classKey}`.`id` = `Tag`.`file_id` AND `Tag`.`tag` IN ('" . $tags . "')");
$c->groupby($this->classKey . '.id');
$c->prepare();
$this->modx->log(1, $c->toSQL());
}
return $c;
}
示例3: prepareQueryBeforeCount
/**
* @param xPDOQuery $c
*
* @return xPDOQuery
*/
public function prepareQueryBeforeCount(xPDOQuery $c)
{
$c->leftJoin("glData", "glData", "glData.identifier = {$this->classKey}.id");
$c->select($this->modx->getSelectColumns("glData", "glData"));
$c->select($this->modx->getSelectColumns($this->classKey, $this->classKey));
switch ($this->classKey) {
case 'glCountry':
break;
case 'glRegion':
$c->leftJoin("glCountry", "glCountry", "glCountry.iso = {$this->classKey}.country");
$c->select($this->modx->getSelectColumns("glCountry", "glCountry", 'country_', array('id'), true));
break;
case 'glCity':
$c->leftJoin("glRegion", "glRegion", "glRegion.id = {$this->classKey}.region_id");
$c->select($this->modx->getSelectColumns("glRegion", "glRegion", 'region_', array('id'), true));
$c->leftJoin("glCountry", "glCountry", "glCountry.iso = glRegion.country");
$c->select($this->modx->getSelectColumns("glCountry", "glCountry", 'country_', array('id'), true));
break;
}
$active = $this->getProperty('active');
if ($active != '') {
$c->where(array("{$this->objectType}.active" => $active));
}
$default = $this->getProperty('default');
if ($default != '') {
$c->where(array("{$this->objectType}.default" => $default));
}
$query = trim($this->getProperty('query'));
if ($query) {
$c->where(array("{$this->objectType}.name_ru:LIKE" => "%{$query}%", "OR:{$this->objectType}.name_en:LIKE" => "%{$query}%"));
}
return $c;
}
示例4: prepareQueryBeforeCount
public function prepareQueryBeforeCount(xPDOQuery $c)
{
$c->leftJoin('modSnippet', 'Snippet');
$c->leftJoin('modCronjobLog', 'Log');
$c->select(array($this->modx->getSelectColumns($this->classKey, $this->classKey), $this->modx->getSelectColumns('modSnippet', 'Snippet', 'snippet_', array('id', 'name', 'description')), 'logs' => 'COUNT(Log.id)'));
return $c;
}
示例5: prepareQueryBeforeCount
/**
* @param xPDOQuery $c
*
* @return xPDOQuery
*/
public function prepareQueryBeforeCount(xPDOQuery $c)
{
$c->leftJoin('modResource', 'modResource', 'modResource.id = scContent.resource');
$c->leftJoin('modContentType', 'modContentType', 'modContentType.id = scContent.content_type');
$c->leftJoin('modTemplate', 'modTemplate', 'modTemplate.id = scContent.template');
$c->select($this->modx->getSelectColumns('scContent', 'scContent'));
$c->select(array('resource_name' => 'modResource.pagetitle', 'content_type_name' => 'modContentType.name', 'template_name' => 'modTemplate.templatename'));
/* if ($this->getProperty('combo')) {
$c->select('id,name');
$c->where(array('active' => 1));
if ($requestId = $this->getProperty('request_id')) {
if ($request = $this->modx->getObject('psRequest', $requestId)) {
$status = $request->getOne('Status');
if ($status->get('final') == 1) {
$c->where(array('id' => $status->get('id')));
} else if ($status->get('fixed') == 1) {
$c->where(array('rank:>=' => $status->get('rank')));
}
}
}
}*/
$query = trim($this->getProperty('query'));
if ($query) {
$c->where(array('uri:LIKE' => "%{$query}%", 'OR:pagetitle:LIKE' => "%{$query}%", 'OR:longtitle:LIKE' => "%{$query}%", 'OR:description:LIKE' => "%{$query}%", 'OR:introtext:LIKE' => "%{$query}%", 'OR:content:LIKE' => "%{$query}%"));
}
return $c;
}
示例6: prepareQueryBeforeCount
/**
* @return mixed
*/
public function prepareQueryBeforeCount(xPDOQuery $c)
{
$c->select($this->modx->getSelectColumns('modManagerLog', 'modManagerLog', '', array('action'), true));
// $c->select($this->modx->getSelectColumns('modManagerLog','modManagerLog'));
$c->select(array('User.username', 'Template.templatename', 'Chunk.name as chunkname', 'Snippet.name as snippetname', 'Plugin.name as pluginname', 'TV.name as tvname'));
$c->innerJoin('modUser', 'User');
$c->leftJoin('modTemplate', 'Template', '`modManagerLog`.item = `Template`.`id` AND `modManagerLog`.`classKey` = "modTemplate"');
$c->leftJoin('modChunk', 'Chunk', '`modManagerLog`.item = `Chunk`.`id` AND `modManagerLog`.`classKey` = "modChunk"');
$c->leftJoin('modSnippet', 'Snippet', '`modManagerLog`.item = `Snippet`.`id` AND `modManagerLog`.`classKey` = "modSnippet"');
$c->leftJoin('modPlugin', 'Plugin', '`modManagerLog`.item = `Plugin`.`id` AND `modManagerLog`.`classKey` = "modPlugin"');
$c->leftJoin('modTemplateVar', 'TV', '`modManagerLog`.item = `TV`.`id` AND `modManagerLog`.`classKey` = "modTemplateVar"');
$query = trim($this->getProperty('query'));
if ($query) {
$c->where('(Template.templatename LIKE "%' . $query . '%" OR Chunk.name LIKE "%' . $query . '%" OR Snippet.name LIKE "%' . $query . '%" OR Plugin.name LIKE "%' . $query . '%" OR TV.name LIKE "%' . $query . '%")');
} else {
$c->where('(modManagerLog.action LIKE "template_%" OR modManagerLog.action LIKE "chunk_%" OR modManagerLog.action LIKE "snippet_%" OR modManagerLog.action LIKE "plugin_%" OR modManagerLog.action LIKE "tv_%")');
}
$user = intval($this->getProperty('user'));
if ($user) {
$c->andCondition(array('modManagerLog.user' => $user));
}
$dateStart = trim($this->getProperty('datestart'));
if ($dateStart) {
$dateStart = date('Y-m-d', strtotime($dateStart));
$c->andCondition(array('modManagerLog.occurred:>=' => $dateStart));
}
$dateEnd = trim($this->getProperty('dateend'));
if ($dateEnd) {
$dateEnd = date('Y-m-d 23:59:59', strtotime($dateEnd));
$c->andCondition(array('modManagerLog.occurred:<=' => $dateEnd));
}
return $c;
}
示例7: prepareQueryAfterCount
public function prepareQueryAfterCount(xPDOQuery $c)
{
$c->leftJoin('modUserGroupRole', 'Role', array('Role.authority = modAccessContext.authority'));
$c->leftJoin('modAccessPolicy', 'Policy');
$c->select($this->modx->getSelectColumns('modAccessContext', 'modAccessContext'));
$c->select(array('role_name' => 'Role.name', 'policy_name' => 'Policy.name', 'policy_data' => 'Policy.data'));
return $c;
}
示例8: prepareQueryBeforeCount
/**
* @param xPDOQuery $c
*
* @return xPDOQuery
*/
public function prepareQueryBeforeCount(xPDOQuery $c)
{
$c->where(array('newsletter_id' => $this->getProperty('newsletter_id')));
$c->leftJoin('modUser', 'modUser', 'sxSubscriber.user_id = modUser.id');
$c->leftJoin('modUserProfile', 'modUserProfile', 'sxSubscriber.user_id = modUserProfile.internalKey');
$c->select($this->modx->getSelectColumns($this->classKey, $this->classKey));
$c->select('modUser.username, modUserProfile.fullname');
return $c;
}
示例9: prepareQueryBeforeCount
public function prepareQueryBeforeCount(xPDOQuery $c)
{
$c->leftJoin('msOrderStatus', 'msOrderStatus', '`msOrderLog`.`entry` = `msOrderStatus`.`id`');
$c->leftJoin('msOrder', 'msOrder', '`msOrder`.`id` = `msOrderLog`.`order_id`');
$c->where(array('order_id' => $this->getProperty('order_id'), 'msOrder.user_id' => $this->modx->user->id, 'action' => 'status'));
$c->select($this->modx->getSelectColumns('msOrderLog', 'msOrderLog', '', array('timestamp', 'action', 'entry')));
$c->select('`msOrderStatus`.`name` as `entry`, `msOrderStatus`.`color`');
return $c;
}
示例10: prepareQueryBeforeCount
/**
* @param xPDOQuery $c
*
* @return xPDOQuery
*/
public function prepareQueryBeforeCount(xPDOQuery $c)
{
$c->leftJoin($this->linkedKey, $this->linkedKey, $this->classKey . '.id = ' . $this->linkedKey . '.id');
$c->leftJoin('msdSaleMember', 'msdSaleMember', array($this->classKey . '.id = msdSaleMember.group_id', 'msdSaleMember.type' => $this->getProperty('type'), 'msdSaleMember.sale_id' => $this->getProperty('sale_id')));
$c->select($this->modx->getSelectColumns($this->linkedKey, $this->linkedKey));
$c->select($this->modx->getSelectColumns($this->classKey, $this->classKey));
$c->where(array('msdSaleMember.sale_id' => null));
return $c;
}
示例11: prepareQueryBeforeCount
/**
* @param xPDOQuery $c
*
* @return xPDOQuery
*/
public function prepareQueryBeforeCount(xPDOQuery $c)
{
$c->where(array('type' => $this->getProperty('type'), 'sale_id' => $this->getProperty('sale_id')));
$c->leftJoin($this->linkedKey1, $this->linkedKey1, $this->classKey . '.group_id = ' . $this->linkedKey1 . '.id');
$c->leftJoin($this->linkedKey2, $this->linkedKey2, $this->classKey . '.group_id = ' . $this->linkedKey2 . '.id');
$c->select($this->modx->getSelectColumns($this->classKey, $this->classKey));
$c->select($this->modx->getSelectColumns($this->linkedKey1, $this->linkedKey1));
$c->select($this->modx->getSelectColumns($this->linkedKey2, $this->linkedKey2));
return $c;
}
示例12: prepareQueryBeforeCount
public function prepareQueryBeforeCount(xPDOQuery $c)
{
$c->innerJoin('msOrder', 'msOrder', '`msOrderProduct`.`order_id` = `msOrder`.`id`');
$c->leftJoin('msProduct', 'msProduct', '`msOrderProduct`.`product_id` = `msProduct`.`id`');
$c->leftJoin('msProductData', 'msProductData', '`msOrderProduct`.`product_id` = `msProductData`.`id`');
$c->where(array('order_id' => $this->getProperty('order_id'), 'msOrder.user_id' => $this->modx->user->id));
$c->select($this->modx->getSelectColumns('msOrderProduct', 'msOrderProduct'));
$c->select($this->modx->getSelectColumns('msProduct', 'msProduct', 'product_'));
$c->select($this->modx->getSelectColumns('msProductData', 'msProductData', 'product_', array('id'), true));
return $c;
}
示例13: prepareQueryBeforeCount
/**
* @param xPDOQuery $c
*
* @return xPDOQuery
*/
public function prepareQueryBeforeCount(xPDOQuery $c)
{
$c->leftJoin('modUser', 'modUser', 'modalWindow.user = modUser.id');
$c->leftJoin('modUserGroup', 'modUserGroup', 'modalWindow.group = modUserGroup.id');
$c->select($this->modx->getSelectColumns($this->classKey, $this->classKey));
$c->select(array('user_description' => 'modUser.username', 'group_description' => 'modUserGroup.name'));
$query = trim($this->getProperty('query'));
if ($query) {
$c->where(array('name:LIKE' => "%{$query}%", 'OR:description:LIKE' => "%{$query}%"));
}
return $c;
}
示例14: prepareQueryBeforeCount
/**
* @param xPDOQuery $c
* @return xPDOQuery
*/
public function prepareQueryBeforeCount(xPDOQuery $c)
{
$q = trim($this->getProperty('query'));
$c->leftJoin('modUserProfile', 'modUserProfile', 'createdby = modUserProfile.internalKey');
$c->leftJoin('modResource', 'modResource', 'res_id = modResource.id');
$c->select($this->modx->getSelectColumns('idfxUserLikes', 'idfxUserLikes'));
$c->select('modUserProfile.fullname as user_name, modResource.pagetitle as title');
if ($q) {
$c->where(array('modUserProfile.fullname:LIKE' => "%{$q}%", 'OR:modResource.pagetitle:LIKE' => "%{$q}%"));
}
return $c;
}
示例15: prepareQueryBeforeCount
/**
* @param xPDOQuery $c
*
* @return xPDOQuery
*/
public function prepareQueryBeforeCount(xPDOQuery $c)
{
$c->leftJoin('modUser', 'modUser', '`Company`.`user` = `modUser`.`id`');
$c->leftJoin('modUserProfile', 'modUserProfile', '`Company`.`user` = `modUserProfile`.`internalKey`');
$companyColumns = $this->modx->getSelectColumns('Company', 'Company', '', array('user'), true);
$c->select($companyColumns . ', `Company`.`user` as `user_id`, `modUserProfile`.`fullname` as `customer`, `modUser`.`username` as `customer_username`');
$query = trim($this->getProperty('query'));
if ($query) {
$c->where(array('name:LIKE' => "%{$query}%", 'OR:description:LIKE' => "%{$query}%"));
}
return $c;
}