本文整理汇总了PHP中Magento\Framework\Model\Resource\Db\AbstractDb::_getLoadSelect方法的典型用法代码示例。如果您正苦于以下问题:PHP AbstractDb::_getLoadSelect方法的具体用法?PHP AbstractDb::_getLoadSelect怎么用?PHP AbstractDb::_getLoadSelect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Framework\Model\Resource\Db\AbstractDb
的用法示例。
在下文中一共展示了AbstractDb::_getLoadSelect方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _getLoadSelect
/**
* Prepare wishlist load select query
*
* @param string $field
* @param mixed $value
* @param \Magento\Framework\Model\AbstractModel $object
* @return \Zend_Db_Select
*/
protected function _getLoadSelect($field, $value, $object)
{
$select = parent::_getLoadSelect($field, $value, $object);
if ($field == $this->_customerIdFieldName) {
$select->order('wishlist_id ' . \Zend_Db_Select::SQL_ASC)->limit(1);
}
return $select;
}
示例2: _getLoadSelect
/**
* Add expiration date filter to select
*
* @param string $field
* @param mixed $value
* @param \Magento\Persistent\Model\Session $object
* @return \Zend_Db_Select
*/
protected function _getLoadSelect($field, $value, $object)
{
$select = parent::_getLoadSelect($field, $value, $object);
if (!$object->getLoadExpired()) {
$tableName = $this->getMainTable();
$select->join(['customer' => $this->getTable('customer_entity')], 'customer.entity_id = ' . $tableName . '.customer_id')->where($tableName . '.updated_at >= ?', $object->getExpiredBefore());
}
return $select;
}
示例3: _getLoadSelect
/**
* Retrieve select object for load object data
*
* @param string $field
* @param mixed $value
* @param \Magento\Framework\Model\AbstractModel $object
* @return \Zend_Db_Select
*/
protected function _getLoadSelect($field, $value, $object)
{
if ($field == 'default_state') {
$select = $this->_getReadAdapter()->select()->from($this->getMainTable(), ['label'])->join(['state_table' => $this->stateTable], $this->getMainTable() . '.status = state_table.status', 'status')->where('state_table.state = ?', $value)->order('state_table.is_default DESC')->limit(1);
} else {
$select = parent::_getLoadSelect($field, $value, $object);
}
return $select;
}
示例4: _getLoadSelect
/**
* Retrieve select object for load object data
*
* @param string $field
* @param mixed $value
* @param \Magento\Log\Model\Customer $object
* @return \Magento\Framework\DB\Select
*/
protected function _getLoadSelect($field, $value, $object)
{
$select = parent::_getLoadSelect($field, $value, $object);
if ($field == 'customer_id') {
// load additional data by last login
$table = $this->getMainTable();
$select->joinInner(['lvt' => $this->_visitorTable], "lvt.visitor_id = {$table}.visitor_id", ['last_visit_at'])->joinInner(['lvit' => $this->_visitorInfoTable], 'lvt.visitor_id = lvit.visitor_id', ['http_referer', 'remote_addr'])->joinInner(['luit' => $this->_urlInfoTable], 'luit.url_id = lvt.last_url_id', ['url'])->order("{$table}.login_at DESC")->limit(1);
}
return $select;
}
示例5: _getLoadSelect
/**
* Retrieve select object for load object data
*
* @param string $field
* @param mixed $value
* @param \Magento\Review\Model\Rating $object
* @return \Magento\Framework\DB\Select
*/
protected function _getLoadSelect($field, $value, $object)
{
$adapter = $this->_getReadAdapter();
$table = $this->getMainTable();
$storeId = (int) $this->_storeManager->getStore(\Magento\Store\Model\Store::ADMIN_CODE)->getId();
$select = parent::_getLoadSelect($field, $value, $object);
$codeExpr = $adapter->getIfNullSql('title.value', "{$table}.rating_code");
$select->joinLeft(['title' => $this->getTable('rating_title')], $adapter->quoteInto("{$table}.rating_id = title.rating_id AND title.store_id = ?", $storeId), ['rating_code' => $codeExpr]);
return $select;
}
示例6: _getLoadSelect
/**
* Retrieve select object for load object data
*
* @param string $field
* @param mixed $value
* @param \Magento\UrlRewrite\Model\UrlRewrite $object
* @return \Zend_Db_Select
*/
protected function _getLoadSelect($field, $value, $object)
{
/** @var $select \Magento\Framework\DB\Select */
$select = parent::_getLoadSelect($field, $value, $object);
if ($object->getStoreId() !== null) {
$select->where('store_id IN(?)', [\Magento\Store\Model\Store::DEFAULT_STORE_ID, $object->getStoreId()]);
$select->order('store_id ' . \Magento\Framework\DB\Select::SQL_DESC);
$select->limit(1);
}
return $select;
}
示例7: _getLoadSelect
/**
* Retrieve select object for load object data
*
* @param string $field
* @param mixed $value
* @param \Magento\Framework\Model\AbstractModel $object
* @return \Magento\Framework\DB\Select
*/
protected function _getLoadSelect($field, $value, $object)
{
$select = parent::_getLoadSelect($field, $value, $object);
$adapter = $this->_getReadAdapter();
$locale = $this->_localeResolver->getLocaleCode();
$systemLocale = \Magento\Framework\AppInterface::DISTRO_LOCALE_CODE;
$regionField = $adapter->quoteIdentifier($this->getMainTable() . '.' . $this->getIdFieldName());
$condition = $adapter->quoteInto('lrn.locale = ?', $locale);
$select->joinLeft(array('lrn' => $this->_regionNameTable), "{$regionField} = lrn.region_id AND {$condition}", array());
if ($locale != $systemLocale) {
$nameExpr = $adapter->getCheckSql('lrn.region_id is null', 'srn.name', 'lrn.name');
$condition = $adapter->quoteInto('srn.locale = ?', $systemLocale);
$select->joinLeft(array('srn' => $this->_regionNameTable), "{$regionField} = srn.region_id AND {$condition}", array('name' => $nameExpr));
} else {
$select->columns(array('name'), 'lrn');
}
return $select;
}
示例8: _getLoadSelect
/**
* Retrieve select object for load object data
*
* @param string $field
* @param mixed $value
* @param \Magento\Framework\Model\AbstractModel $object
* @return $this
*/
protected function _getLoadSelect($field, $value, $object)
{
$select = parent::_getLoadSelect($field, $value, $object);
return $select;
}
示例9: _getLoadSelect
/**
* Retrieve select object for load object data
*
* @param string $field
* @param mixed $value
* @param \Magento\Cms\Model\Page $object
* @return \Zend_Db_Select
*/
protected function _getLoadSelect($field, $value, $object)
{
$select = parent::_getLoadSelect($field, $value, $object);
if ($object->getStoreId()) {
$storeIds = array(\Magento\Store\Model\Store::DEFAULT_STORE_ID, (int) $object->getStoreId());
$select->join(array('cms_page_store' => $this->getTable('cms_page_store')), $this->getMainTable() . '.page_id = cms_page_store.page_id', array())->where('is_active = ?', 1)->where('cms_page_store.store_id IN (?)', $storeIds)->order('cms_page_store.store_id DESC')->limit(1);
}
return $select;
}
示例10: _getLoadSelect
/**
* Retrieve select object for load object data
*
* @param string $field
* @param mixed $value
* @param AbstractModel $object
* @return \Zend_Db_Select
*/
protected function _getLoadSelect($field, $value, $object)
{
$select = parent::_getLoadSelect($field, $value, $object);
$select->where('store_id = ?', (int) $object->getStoreId());
return $select;
}
示例11: _getLoadSelect
/**
* Retrieve select object for load object data
*
* @param string $field
* @param mixed $value
* @param \Ashsmith\Blog\Model\Post $object
* @return \Zend_Db_Select
*/
protected function _getLoadSelect($field, $value, $object)
{
$select = parent::_getLoadSelect($field, $value, $object);
$select->where('is_active = ?', 1)->limit(1);
return $select;
}
示例12: loadByIdWithoutStore
/**
* Load quote data by identifier without store
*
* @param \Magento\Quote\Model\Quote $quote
* @param int $quoteId
* @return $this
*/
public function loadByIdWithoutStore($quote, $quoteId)
{
$read = $this->_getReadAdapter();
if ($read) {
$select = parent::_getLoadSelect('entity_id', $quoteId, $quote);
$data = $read->fetchRow($select);
if ($data) {
$quote->setData($data);
}
}
$this->_afterLoad($quote);
return $this;
}
示例13: _getLoadSelect
/**
* Retrieve select object for load object data
*
* @param string $field
* @param mixed $value
* @param FormFieldset $object
* @return Select
*/
protected function _getLoadSelect($field, $value, $object)
{
$select = parent::_getLoadSelect($field, $value, $object);
$labelExpr = $select->getAdapter()->getIfNullSql('store_label.label', 'default_label.label');
$select->joinLeft(['default_label' => $this->getTable('eav_form_fieldset_label')], $this->getMainTable() . '.fieldset_id = default_label.fieldset_id AND default_label.store_id=0', [])->joinLeft(['store_label' => $this->getTable('eav_form_fieldset_label')], $this->getMainTable() . '.fieldset_id = store_label.fieldset_id AND default_label.store_id=' . (int) $object->getStoreId(), ['label' => $labelExpr]);
return $select;
}
示例14: _getLoadSelect
/**
* Get load select
*
* @param string $field
* @param mixed $value
* @param \Magento\Framework\Model\AbstractModel $object
* @return \Magento\Framework\DB\Select
*/
protected function _getLoadSelect($field, $value, $object)
{
$select = parent::_getLoadSelect($field, $value, $object);
if ($object->getStoreId()) {
$select->join(array('cps' => $this->getTable('checkout_agreement_store')), $this->getMainTable() . '.agreement_id = cps.agreement_id')->where('is_active=1')->where('cps.store_id IN (0, ?)', $object->getStoreId())->order('store_id DESC')->limit(1);
}
return $select;
}
示例15: _getLoadSelect
/**
* Retrieve select object and join it to product entity table to get type ids
*
* @param string $field
* @param int $value
* @param \Magento\CatalogInventory\Model\Stock\Item $object
* @return \Magento\Framework\DB\Select
*/
protected function _getLoadSelect($field, $value, $object)
{
$select = parent::_getLoadSelect($field, $value, $object)->join(['p' => $this->getTable('catalog_product_entity')], 'product_id=p.entity_id', ['type_id']);
return $select;
}