本文整理汇总了PHP中Attribute::getValues方法的典型用法代码示例。如果您正苦于以下问题:PHP Attribute::getValues方法的具体用法?PHP Attribute::getValues怎么用?PHP Attribute::getValues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Attribute
的用法示例。
在下文中一共展示了Attribute::getValues方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAttributeValues
/**
*
*/
public function getAttributeValues()
{
if (!$this->getPrimaryKey()) {
return null;
}
$o_db = $this->getDb();
$qr_attrs = $o_db->query("\n\t\t\tSELECT *\n\t\t\tFROM ca_attribute_values cav\n\t\t\tINNER JOIN ca_metadata_elements AS cme ON cme.element_id = cav.element_id\n\t\t\tWHERE\n\t\t\t\tcav.attribute_id = ?\n\t\t", (int) $this->getPrimaryKey());
$o_attr = new Attribute($this->getFieldValuesArray());
while ($qr_attrs->nextRow()) {
$va_raw_row = $qr_attrs->getRow();
$o_attr->addValueFromRow($va_raw_row);
}
return $o_attr->getValues();
}
示例2: getAttributeValues
/**
* Return values for currently loaded attribute.
*
* @param array $pa_options Options include:
* returnAs = what to return; possible values are:
* values = an array of attribute values [Default]
* attributeInstance = an instance of the Attribute class loaded with the attribute value(s)
* count = the number of values in the attribute
*
* @return mixed An array, instance of class Attribute or an integer value count depending upon setting of returnAs option. Returns null if no attribute is loaded.
*/
public function getAttributeValues($pa_options = null)
{
if (!$this->getPrimaryKey()) {
return null;
}
$o_db = $this->getDb();
$qr_attrs = $o_db->query("\n\t\t\tSELECT *\n\t\t\tFROM ca_attribute_values cav\n\t\t\tINNER JOIN ca_metadata_elements AS cme ON cme.element_id = cav.element_id\n\t\t\tWHERE\n\t\t\t\tcav.attribute_id = ?\n\t\t", (int) $this->getPrimaryKey());
$o_attr = new Attribute($this->getFieldValuesArray());
while ($qr_attrs->nextRow()) {
$va_raw_row = $qr_attrs->getRow();
$o_attr->addValueFromRow($va_raw_row);
}
switch ($vs_return_as = caGetOption('returnAs', $pa_options, null)) {
case 'attributeInstance':
return $o_attr;
break;
case 'count':
return sizeof($o_attr->getValues());
break;
case 'values':
default:
return $o_attr->getValues();
break;
}
}