本文整理汇总了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);
}