本文整理匯總了PHP中Magento\Eav\Model\Entity\Attribute::getBackend方法的典型用法代碼示例。如果您正苦於以下問題:PHP Attribute::getBackend方法的具體用法?PHP Attribute::getBackend怎麽用?PHP Attribute::getBackend使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Magento\Eav\Model\Entity\Attribute
的用法示例。
在下文中一共展示了Attribute::getBackend方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: findWhereAttributeIs
/**
* Return entities where attribute value is
*
* @param array|int $entityIdsFilter
* @param \Magento\Eav\Model\Entity\Attribute $attribute
* @param mixed $expectedValue
* @return array
*/
public function findWhereAttributeIs($entityIdsFilter, $attribute, $expectedValue)
{
$bind = array('attribute_id' => $attribute->getId(), 'value' => $expectedValue);
$select = $this->_getReadAdapter()->select()->from($attribute->getBackend()->getTable(), array('entity_id'))->where('attribute_id = :attribute_id')->where('value = :value')->where('entity_id IN(?)', $entityIdsFilter);
return $this->_getReadAdapter()->fetchCol($select, $bind);
}
示例2: findWhereAttributeIs
/**
* Return entities where attribute value is
*
* @param array|int $entityIdsFilter
* @param \Magento\Eav\Model\Entity\Attribute $attribute
* @param mixed $expectedValue
* @return array
*/
public function findWhereAttributeIs($entityIdsFilter, $attribute, $expectedValue)
{
$linkField = $this->getLinkField();
$bind = ['attribute_id' => $attribute->getId(), 'value' => $expectedValue];
$selectEntities = $this->getConnection()->select()->from(['ce' => $this->getTable('catalog_category_entity')], ['entity_id'])->joinLeft(['ci' => $attribute->getBackend()->getTable()], "ci.{$linkField} = ce.{$linkField} AND attribute_id = :attribute_id", ['value'])->where('ci.value = :value')->where('ce.entity_id IN (?)', $entityIdsFilter);
return $this->getConnection()->fetchCol($selectEntities, $bind);
}