本文整理汇总了PHP中Zend_Db_Select::join方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Db_Select::join方法的具体用法?PHP Zend_Db_Select::join怎么用?PHP Zend_Db_Select::join使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Db_Select
的用法示例。
在下文中一共展示了Zend_Db_Select::join方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _addFilter
/**
* Add attribute to filter
*
* @param int $storeId
* @param string $attributeCode
* @param mixed $value
* @param string $type
* @return Zend_Db_Select
*/
protected function _addFilter($storeId, $attributeCode, $value, $type = '=')
{
if (!isset($this->_attributesCache[$attributeCode])) {
$attribute = Mage::getSingleton('catalog/product')->getResource()->getAttribute($attributeCode);
$this->_attributesCache[$attributeCode] = array('entity_type_id' => $attribute->getEntityTypeId(), 'attribute_id' => $attribute->getId(), 'table' => $attribute->getBackend()->getTable(), 'is_global' => $attribute->getIsGlobal() == Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL, 'backend_type' => $attribute->getBackendType());
}
$attribute = $this->_attributesCache[$attributeCode];
if (!$this->_select instanceof Zend_Db_Select) {
return false;
}
switch ($type) {
case '=':
$conditionRule = '=?';
break;
case 'in':
$conditionRule = ' IN(?)';
break;
default:
return false;
break;
}
$this->_select->join(array('t1_' . $attributeCode => $attribute['table']), 'r.entity_pk_value=t1_' . $attributeCode . '.entity_id AND t1_' . $attributeCode . '.store_id=0', array())->where('t1_' . $attributeCode . '.attribute_id=?', $attribute['attribute_id']);
if ($attribute['is_global']) {
$this->_select->where('t1_' . $attributeCode . '.value' . $conditionRule, $value);
} else {
$ifCase = $this->getCheckSql('t2_' . $attributeCode . '.value_id > 0', 't2_' . $attributeCode . '.value', 't1_' . $attributeCode . '.value');
$this->_select->joinLeft(array('t2_' . $attributeCode => $attribute['table']), $this->_getWriteAdapter()->quoteInto('t1_' . $attributeCode . '.entity_id = t2_' . $attributeCode . '.entity_id AND t1_' . $attributeCode . '.attribute_id = t2_' . $attributeCode . '.attribute_id AND t2_' . $attributeCode . '.store_id=?', $storeId), array())->where('(' . $ifCase . ')' . $conditionRule, $value);
}
return $this->_select;
}
示例2: _addHierarchy
protected function _addHierarchy()
{
$requestPath = $this->_getWriteAdapter()->getIfNullSql('h.request_url', 'main_table.identifier');
// Add Hierarchy
$this->_select->join(array('h' => $this->getTable('enterprise_cms/hierarchy_node')), 'main_table.page_id=h.page_id', array($requestPath . ' as url'));
return $this;
}
示例3: _getCollectionCE
/**
* Get Canonical Collection ( all different link for that product )
*
* @param string $storeId
* @param string $prodId
*
* @return Zend_Db_Statement_Interface
*/
public function _getCollectionCE($storeId, $prodId, $catId = null)
{
$adapter = $this->_getReadAdapter();
$urlConditions = array('e.product_id=ur.product_id', 'e.category_id=ur.category_id', $adapter->quoteInto('ur.store_id=?', $storeId), 'ur.is_system="1"');
$this->_select = $adapter->select()->from(array('e' => $this->getMainTable()), array('category_id'))->where('e.product_id =?', $prodId)->where('e.store_id =?', $storeId)->where('e.is_parent= "1"');
if ($catId) {
$this->_select->where('e.category_id =?', $catId);
}
$this->_select = $this->_select->join(array('ur' => $this->getTable('core/url_rewrite')), join(' AND ', $urlConditions), array('url' => 'request_path'));
// die((string)($this->_select));
$query = $adapter->query($this->_select);
return $query;
}
示例4: _addFilter
/**
* Add attribute to filter
*
* @param int $storeId
* @param string $attributeCode
* @param mixed $value
* @param string $type
* @return \Zend_Db_Select|bool
*/
protected function _addFilter($storeId, $attributeCode, $value, $type = '=')
{
if (!$this->_select instanceof \Zend_Db_Select) {
return false;
}
if (!isset($this->_attributesCache[$attributeCode])) {
$attribute = $this->_categoryResource->getAttribute($attributeCode);
$this->_attributesCache[$attributeCode] = ['entity_type_id' => $attribute->getEntityTypeId(), 'attribute_id' => $attribute->getId(), 'table' => $attribute->getBackend()->getTable(), 'is_global' => $attribute->getIsGlobal(), 'backend_type' => $attribute->getBackendType()];
}
$attribute = $this->_attributesCache[$attributeCode];
switch ($type) {
case '=':
$conditionRule = '=?';
break;
case 'in':
$conditionRule = ' IN(?)';
break;
default:
return false;
break;
}
if ($attribute['backend_type'] == 'static') {
$this->_select->where('e.' . $attributeCode . $conditionRule, $value);
} else {
$this->_select->join(['t1_' . $attributeCode => $attribute['table']], 'e.entity_id = t1_' . $attributeCode . '.entity_id AND t1_' . $attributeCode . '.store_id = 0', [])->where('t1_' . $attributeCode . '.attribute_id=?', $attribute['attribute_id']);
if ($attribute['is_global']) {
$this->_select->where('t1_' . $attributeCode . '.value' . $conditionRule, $value);
} else {
$ifCase = $this->_select->getAdapter()->getCheckSql('t2_' . $attributeCode . '.value_id > 0', 't2_' . $attributeCode . '.value', 't1_' . $attributeCode . '.value');
$this->_select->joinLeft(['t2_' . $attributeCode => $attribute['table']], $this->_getWriteAdapter()->quoteInto('t1_' . $attributeCode . '.entity_id = t2_' . $attributeCode . '.entity_id AND t1_' . $attributeCode . '.attribute_id = t2_' . $attributeCode . '.attribute_id AND t2_' . $attributeCode . '.store_id=?', $storeId), [])->where('(' . $ifCase . ')' . $conditionRule, $value);
}
}
return $this->_select;
}
示例5: _addFilter
/**
* Add attribute to filter
*
* @param int $storeId
* @param string $attributeCode
* @param mixed $value
* @param string $type
* @return Zend_Db_Select
*/
protected function _addFilter($storeId, $attributeCode, $value, $type = '=')
{
if (!isset($this->_attributesCache[$attributeCode])) {
$this->_loadAttribute($attributeCode);
}
$attribute = $this->_attributesCache[$attributeCode];
if (!$this->_select instanceof Zend_Db_Select) {
return false;
}
switch ($type) {
case '=':
$conditionRule = '=?';
break;
case 'in':
$conditionRule = ' IN(?)';
break;
default:
return false;
break;
}
if ($attribute['backend_type'] == 'static') {
$this->_select->where('main_table.' . $attributeCode . $conditionRule, $value);
} else {
$this->_select->join(array('t1_' . $attributeCode => $attribute['table']), 'main_table.entity_id=t1_' . $attributeCode . '.entity_id AND t1_' . $attributeCode . '.store_id=0', array())->where('t1_' . $attributeCode . '.attribute_id=?', $attribute['attribute_id']);
if ($attribute['is_global']) {
$this->_select->where('t1_' . $attributeCode . '.value' . $conditionRule, $value);
} else {
$ifCase = $this->_select->getAdapter()->getCheckSql('t2_' . $attributeCode . '.value_id > 0', 't2_' . $attributeCode . '.value', 't1_' . $attributeCode . '.value');
$this->_select->joinLeft(array('t2_' . $attributeCode => $attribute['table']), $this->_getWriteAdapter()->quoteInto('t1_' . $attributeCode . '.entity_id = t2_' . $attributeCode . '.entity_id AND t1_' . $attributeCode . '.attribute_id = t2_' . $attributeCode . '.attribute_id AND t2_' . $attributeCode . '.store_id = ?', $storeId), array())->where('(' . $ifCase . ')' . $conditionRule, $value);
}
}
return $this->_select;
}
示例6: _addFilter
/**
* Add attribute to filter
*
* @param int $storeId
* @param string $attributeCode
* @param mixed $value
* @param string $type
*
* @return Zend_Db_Select
*/
protected function _addFilter($storeId, $attributeCode, $value, $type = '=')
{
if (!isset($this->_attributesCache[$attributeCode])) {
$attribute = Mage::getSingleton('catalog/category')->getResource()->getAttribute($attributeCode);
$this->_attributesCache[$attributeCode] = array('entity_type_id' => $attribute->getEntityTypeId(), 'attribute_id' => $attribute->getId(), 'table' => $attribute->getBackend()->getTable(), 'is_global' => $attribute->getIsGlobal(), 'backend_type' => $attribute->getBackendType());
}
$attribute = $this->_attributesCache[$attributeCode];
if (!$this->_select instanceof Zend_Db_Select) {
return false;
}
switch ($type) {
case '=':
$conditionRule = '=?';
break;
case 'in':
$conditionRule = ' IN(?)';
break;
default:
return false;
break;
}
if ($attribute['backend_type'] == 'static') {
$this->_select->where('e.' . $attributeCode . $conditionRule, $value);
} else {
$this->_select->join(array('t1_' . $attributeCode => $attribute['table']), 'e.entity_id=t1_' . $attributeCode . '.entity_id AND t1_' . $attributeCode . '.store_id=0', array())->where('t1_' . $attributeCode . '.attribute_id=?', $attribute['attribute_id']);
if ($attribute['is_global']) {
$this->_select->where('t1_' . $attributeCode . '.value' . $conditionRule, $value);
} else {
$this->_select->joinLeft(array('t2_' . $attributeCode => $attribute['table']), $this->_getWriteAdapter()->quoteInto('t1_' . $attributeCode . '.entity_id = t2_' . $attributeCode . '.entity_id AND t1_' . $attributeCode . '.attribute_id = t2_' . $attributeCode . '.attribute_id AND t2_' . $attributeCode . '.store_id=?', $storeId), array())->where('IFNULL(t2_' . $attributeCode . '.value, t1_' . $attributeCode . '.value)' . $conditionRule, $value);
}
}
return $this->_select;
}
示例7: forPreviousTokenId
/**
* Select the token before the current token
*
* @param string|array $fields
* @return \Gems_Tracker_Token_TokenSelect
*/
public function forPreviousTokenId($tokenId)
{
$this->sql_select->join('gems__tokens as ct', 'gems__tokens.gto_id_respondent_track = ct.gto_id_respondent_track AND
gems__tokens.gto_id_token != ct.gto_id_token AND
((gems__tokens.gto_round_order > ct.gto_round_order) OR
(gems__tokens.gto_round_order = ct.gto_round_order AND gems__tokens.gto_created > ct.gto_created))', array());
$this->sql_select->where('ct.gto_id_token = ?', $tokenId)->order('gems__tokens.gto_round_order')->order('gems__tokens.gto_created');
return $this;
}
示例8: _joinDefault
/**
* @access protected
* @param Zend_Db_Select $select
* @return void
*/
protected function _joinDefault(Zend_Db_Select $select)
{
$dbFEFOPPrograms = App_Model_DbTable_Factory::get('FEFOPPrograms');
$dbFEFOPModules = App_Model_DbTable_Factory::get('FEFOPModules');
$dbAddDistrict = App_Model_DbTable_Factory::get('AddDistrict');
$dbSysUser = App_Model_DbTable_Factory::get('SysUser');
$mapper = new Fefop_Model_Mapper_Contract();
$select->join($dbFEFOPPrograms->__toString(), 'FEFOP_Programs.id_fefop_programs = FEFOP_Contract.fk_id_fefop_programs', array())->join($dbFEFOPModules->__toString(), 'FEFOP_Modules.id_fefop_modules = FEFOP_Contract.fk_id_fefop_modules', array())->join($dbAddDistrict->__toString(), 'AddDistrict.acronym = FEFOP_Contract.num_district', array())->join($dbSysUser->__toString(), 'SysUser.id_sysuser = FEFOP_Contract.fk_id_sysuser', array())->join(array('s' => new Zend_Db_Expr('(' . $this->_selectFEFOPStatus() . ')')), 's.fk_id_fefop_contract = FEFOP_Contract.id_fefop_contract', array())->join(array('b' => new Zend_Db_Expr('(' . $mapper->getSelectBeneficiary() . ')')), 'b.fk_id_fefop_contract = FEFOP_Contract.id_fefop_contract AND b.target = 1', array());
}
示例9: _appendGrantsFilter
/**
* append grants acl filter
*
* @param Zend_Db_Select $select
* @param Tinebase_Backend_Sql_Abstract $backend
* @param Tinebase_Model_User $user
*/
protected function _appendGrantsFilter($select, $backend, $user)
{
$db = $backend->getAdapter();
$select->join(array($this->_aclTableName => SQL_TABLE_PREFIX . $this->_aclTableName), "{$db->quoteIdentifier($this->_aclTableName . '.record_id')} = {$db->quoteIdentifier($backend->getTableName() . '.id')}", array());
Tinebase_Container::addGrantsSql($select, $user, $this->_requiredGrants, $this->_aclTableName);
if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) {
Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' $select after appending grants sql: ' . $select);
}
}
示例10: join
/**
* Join
*
* Joins a table, without selecting any columns by default and allowing MySQL table alias syntax
*
* @access public
* @param array|string|Zend_Db_Expr $name
* @param string $cond
* @param array|string $cols
* @param string $schema
* @return $this - Chainable.
*/
public function join($name, $cond, $cols = array(), $schema = null)
{
$this->_joinHistory[] = array('function' => 'join', 'args' => func_get_args());
if (is_string($name) && strpos($name, ' ')) {
list($table, $alias) = explode(' ', $name);
$name = array($alias => $table);
}
$this->_isJoined = true;
$this->_select->join($name, $cond, $cols, $schema);
$this->_count = false;
return $this;
}
示例11: getAllImagesCollection
public function getAllImagesCollection($storeId, $includeOutOfStock = true, $catId = null)
{
$store = Mage::app()->getStore($storeId);
/* @var $store Mage_Core_Model_Store */
if (!$store) {
return false;
}
// filter for category
if ($catId) {
$catConditions = array('e.entity_id=cat_index.product_id', $this->_getWriteAdapter()->quoteInto('cat_index.store_id=?', $store->getId()), $this->_getWriteAdapter()->quoteInto('cat_index.category_id=?', $catId), $this->_getWriteAdapter()->quoteInto('cat_index.is_parent=?', 1));
} else {
$rootId = $store->getRootCategoryId();
$_category = Mage::getModel('catalog/category')->load($rootId);
//get category model
$child_categories = $_category->getResource()->getChildren($_category, false);
//array consisting of all child categories id
$child_categories = array_merge(array($rootId), $child_categories);
// filter product that doesn't belongs to the store root category childs
$catConditions = array('e.entity_id=cat_index.product_id', $this->_getWriteAdapter()->quoteInto('cat_index.store_id=?', $store->getId()), $this->_getWriteAdapter()->quoteInto('cat_index.position!=?', 0));
}
$this->_select = $this->_getWriteAdapter()->select()->from(array('e' => $this->getMainTable()), array($this->getIdFieldName(), 'e.entity_id', 'path' => 'e.value'))->join(array('cat_index' => $this->getTable('catalog/category_product_index')), join(' AND ', $catConditions), array());
// filter Out of Stock
if (!$includeOutOfStock) {
$stkConditions = array('e.entity_id=stk.product_id', $this->_getWriteAdapter()->quoteInto('stk.is_in_stock=?', 1));
$this->_select = $this->_select->join(array('stk' => $this->getTable('cataloginventory/stock_item')), join(' AND ', $stkConditions), array('is_in_stock' => 'is_in_stock'));
}
// $valueConditions = array(
// 'e.value_id=w.value_id',
// // $this->_getWriteAdapter()->quoteInto('w.disabled=?', 0)
// );
//
// $this->_select = $this->_select->join(
// array('w' => $this->getTable('catalog/product_attribute_media_gallery_value')), join(' AND ', $valueConditions), array('w.disabled')
// );
$query = $this->_getWriteAdapter()->query($this->_select);
// die((string) ($this->_select));
return $query;
}
示例12: _limitByStoreWebsite
/**
* Limit select by website with joining to store table
*
* @param Zend_Db_Select $select
* @param int | Zend_Db_Expr $website
* @param string $storeIdField
* @return Enterprise_CustomerSegment_Model_Condition_Abstract
*/
protected function _limitByStoreWebsite(Zend_Db_Select $select, $website, $storeIdField)
{
$storeTable = $this->getResource()->getTable('core/store');
$select->join(array('store' => $storeTable), $storeIdField . '=store.store_id', array())->where('store.website_id=?', $website);
return $this;
}
示例13: getCollection
/**
* Get category collection array
*
* @return array
*/
public function getCollection($storeId, $onlyCount = false, $limit = 4000000000, $from = 0)
{
$products = array();
$store = Mage::app()->getStore($storeId);
/* @var $store Mage_Core_Model_Store */
if (!$store) {
return false;
}
if (self::FILTER_PRODUCT == 1) {
$fpstring = " AND product_id IN (" . implode(',', $this->_getStoreProductIds($storeId)) . ")";
} else {
$fpstring = '';
}
$read = $this->_getReadAdapter();
$this->_select = $read->select()->distinct()->from(array('e' => $this->getMainTable()), array($onlyCount ? 'COUNT(*)' : $this->getIdFieldName()))->join(array('w' => $this->getTable('catalog/product_website')), "e.entity_id=w.product_id {$fpstring}", array())->where('w.website_id=?', $store->getWebsiteId())->limit($limit, $from);
$excludeAttr = Mage::getModel('catalog/product')->getResource()->getAttribute('exclude_from_sitemap');
if ($excludeAttr) {
$this->_select->joinLeft(array('exclude_tbl' => $excludeAttr->getBackend()->getTable()), 'exclude_tbl.entity_id = e.entity_id AND exclude_tbl.attribute_id = ' . $excludeAttr->getAttributeId() . new Zend_Db_Expr(" AND store_id =\n IF(\n\t\t\t\t\t\t(SELECT `exclude`.`value` FROM `{$excludeAttr->getBackend()->getTable()}` AS `exclude` WHERE `exclude`.`entity_id` = `e`.`entity_id` AND `attribute_id` = {$excludeAttr->getAttributeId()} AND `store_id` = {$storeId}) ,\n\t\t\t\t\t\t(SELECT {$storeId}),\n\t\t\t\t\t\t(SELECT 0)\n\t\t\t\t\t)"), array())->where('exclude_tbl.value=0 OR exclude_tbl.value IS NULL');
}
if (Mage::helper('xsitemap')->isExcludeFromXMLOutOfStockProduct($storeId)) {
$cond = 'e.entity_id = csi.product_id';
if (Mage::getStoreConfig('cataloginventory/item_options/manage_stock', $storeId)) {
$cond .= ' AND IF (csi.use_config_manage_stock = 1, csi.is_in_stock = 1, (csi.manage_stock = 0 OR (csi.manage_stock = 1 AND csi.is_in_stock = 1)))';
} else {
$cond .= ' AND IF (csi.use_config_manage_stock = 1, TRUE, (csi.manage_stock = 0 OR (csi.manage_stock = 1 AND csi.is_in_stock = 1)))';
}
$this->_select->join(array('csi' => $this->getTable('cataloginventory/stock_item')), $cond, array('is_in_stock', 'manage_stock', 'use_config_manage_stock'));
}
$this->_addFilter($storeId, 'visibility', Mage::getSingleton('catalog/product_visibility')->getVisibleInSiteIds(), 'in');
$this->_addFilter($storeId, 'status', Mage::getSingleton('catalog/product_status')->getVisibleStatusIds(), 'in');
if ($onlyCount) {
return $read->fetchOne($this->_select);
}
$sort = '';
if (Mage::helper('xsitemap')->isSeosuiteUltimateAvailable() && Mage::helper('xsitemap')->isSeosuiteCanonicalUrlEnabled($storeId) && Mage::helper('xsitemap')->getSeosuiteProductCanonicalType($storeId)) {
$productCanonicalType = Mage::helper('xsitemap')->getSeosuiteProductCanonicalType($storeId);
if ($productCanonicalType == 3) {
//$suffix = "AND canonical_url_rewrite.category_id IS NULL";
$suffix = '';
$suffix2 = "AND category_id IS NULL";
} else {
//$suffix = "AND canonical_url_rewrite.category_id IS NOT NULL";
$suffix = '';
$suffix2 = "AND category_id IS NOT NULL";
}
if ($productCanonicalType == 1 || $productCanonicalType == 4) {
$sort = 'DESC';
} else {
if ($productCanonicalType == 2 || $productCanonicalType == 5) {
$sort = 'ASC';
} else {
}
}
} else {
$length = Mage::helper('xsitemap')->getXmlSitemapUrlLength();
if ($length == 'short') {
$sort = 'ASC';
} elseif ($length == 'long') {
$sort = 'DESC';
}
if (Mage::getStoreConfigFlag('catalog/seo/product_use_categories', $storeId)) {
$suffix3 = '';
} else {
$suffix3 = 'AND `category_id` IS NULL';
}
}
$canonicalAttr = Mage::getModel('catalog/product')->getResource()->getAttribute('canonical_url');
$urlPathAttr = Mage::getModel('catalog/product')->getResource()->getAttribute('url_path');
/*
if (Mage::helper('xsitemap')->isEnterpriseSince113()) {
$this->_select->columns(array('url' => new Zend_Db_Expr("(
SELECT `eur`.`request_path`
FROM `" . Mage::getSingleton('core/resource')->getTableName('enterprise_url_rewrite') . "` AS `eur`
INNER JOIN `" . Mage::getSingleton('core/resource')->getTableName('enterprise_catalog_product_rewrite') . "` AS `ecpr`
ON `eur`.`url_rewrite_id` = `ecpr`.`url_rewrite_id`
WHERE `product_id`=`e`.`entity_id` AND `ecpr`.`store_id` IN(" . intval(Mage::app()->isSingleStoreMode()
? 0 : 0, $storeId) . ") AND `is_system`=1 AND `request_path` IS NOT NULL " .
($sort ? " ORDER BY LENGTH(`request_path`) " . $sort : "") .
" LIMIT 1)")));
}
*
*/
if (Mage::helper('xsitemap')->isEnterpriseSince113()) {
$urlSuffix = Mage::helper('catalog/product')->getProductUrlSuffix($storeId);
if ($urlSuffix) {
$urlSuffix = '.' . $urlSuffix;
} else {
$urlSuffix = '';
}
$this->_select->joinLeft(array('ecp' => $this->getTable('enterprise_catalog/product')), 'ecp.product_id = e.entity_id ' . 'AND ecp.store_id = ' . $storeId, array())->joinLeft(array('euur' => $this->getTable('enterprise_urlrewrite/url_rewrite')), 'ecp.url_rewrite_id = euur.url_rewrite_id AND euur.is_system = 1', array())->joinLeft(array('ecp2' => $this->getTable('enterprise_catalog/product')), 'ecp2.product_id = e.entity_id AND ecp2.store_id = 0', array())->joinLeft(array('euur2' => $this->getTable('enterprise_urlrewrite/url_rewrite')), 'ecp2.url_rewrite_id = euur2.url_rewrite_id', array('url' => 'concat( ' . $this->_getWriteAdapter()->getIfNullSql('euur.request_path', 'euur2.request_path') . ',"' . $urlSuffix . '")'));
} elseif (!empty($productCanonicalType) && $canonicalAttr) {
$this->_select->columns(array('url' => new Zend_Db_Expr("\n IFNULL(\n (IFNULL(\n (SELECT canonical_url_rewrite.`request_path`\n FROM `" . $canonicalAttr->getBackend()->getTable() . "` AS canonical_path\n LEFT JOIN `" . $this->getTable('core/url_rewrite') . "` AS canonical_url_rewrite ON canonical_url_rewrite.`id_path` = canonical_path.`value`\n WHERE canonical_path.`entity_id` = e.`entity_id` AND canonical_path.`attribute_id` = " . $canonicalAttr->getAttributeId() . " AND canonical_url_rewrite.`store_id` IN (0," . $storeId . ") {$suffix}" . ($sort ? " ORDER BY LENGTH(canonical_url_rewrite.`request_path`) " . $sort : "") . " LIMIT 1),\n (SELECT `request_path`\n FROM `" . $this->getTable('core/url_rewrite') . "`\n WHERE `product_id`=e.`entity_id` AND `store_id` IN (0," . $storeId . ") AND `is_system`=1 AND `request_path` IS NOT NULL {$suffix2}" . ($sort ? " ORDER BY LENGTH(`request_path`) " . $sort : "") . " LIMIT 1)\n )),\n (SELECT p.`value` FROM `" . $urlPathAttr->getBackend()->getTable() . "` AS p\n WHERE p.`entity_id` = e.`entity_id` AND p.`attribute_id` = " . $urlPathAttr->getAttributeId() . " AND p.`store_id` IN (0," . $storeId . ") ORDER BY p.`store_id` DESC LIMIT 1\n )\n )")));
} else {
$this->_select->columns(array('url' => new Zend_Db_Expr("(\n SELECT `request_path`\n FROM `" . $this->getTable('core/url_rewrite') . "`\n WHERE `product_id`=e.`entity_id` AND `store_id`=" . intval($storeId) . " AND `is_system`=1 AND `request_path` IS NOT NULL {$suffix3}" . ($sort ? " ORDER BY LENGTH(`request_path`) " . $sort : "") . " LIMIT 1)")));
//.........这里部分代码省略.........
示例14: processSelect
/**
* Stub function to allow extension of standard one table select.
*
* @param \Zend_Db_Select $select
*/
protected function processSelect(\Zend_Db_Select $select)
{
// $select->joinLeft('gems__rounds', 'gto_id_round = gro_id_round', array());
// $select->join('gems__tracks', 'gto_id_track = gtr_id_track', array());
$select->join('gems__surveys', 'gto_id_survey = gsu_id_survey', array());
$select->join('gems__groups', 'gsu_id_primary_group = ggp_id_group', array());
$select->join('gems__respondents', 'gto_id_respondent = grs_id_user', array());
$select->join('gems__respondent2track', 'gto_id_respondent_track = gr2t_id_respondent_track', array());
$select->join('gems__reception_codes', 'gto_reception_code = grc_id_reception_code', array());
}
示例15: getPagamentosByUser
/**
* Recuperar da table proposta_valores comissões baseadas em um array de ids do usuarios
* @param array $uids
*/
public function getPagamentosByUser($uids = array())
{
$select = new Zend_Db_Select($this->db);
$select->from(array('v' => $this->name_valores), array('id', 'id_proposta', 'comissao', 'parcelas_pagas', 'last_modified', 'last_user_id'));
$select->join(array('c' => $this->name), 'v.id_proposta = c.id', 'dados_extras');
$select->where('c.created_user_id IN (' . implode(',', $uids) . ')');
$select->order('v.last_modified DESC');
return $select;
}