/** * Returns an attribute value list of attributes and values (duh) which a collection version can store * against its object. * @return AttributeValueList */ public function getAttributes($fID, $fvID, $method = 'getValue') { $db = Loader::db(); $values = $db->GetAll("select akID, avID from FileAttributeValues where fID = ? and fvID = ?", array($fID, $fvID)); $avl = new AttributeValueList(); foreach($values as $val) { $ak = FileAttributeKey::getByID($val['akID']); if (is_object($ak)) { $value = $ak->getAttributeValue($val['avID'], $method); $avl->addAttributeValue($ak, $value); } } return $avl; }
/** * Returns an attribute value list of attributes and values (duh) which a collection version can store * against its object. * @return AttributeValueList */ public function getAttributes($fID, $method = 'getValue') { $db = Loader::db(); $values = $db->GetAll("SELECT akID, avID FROM FormifyAttributeValues WHERE fID = ?", array($fID)); $avl = new AttributeValueList(); foreach ($values as $val) { $ak = FormKey::getByID($val['akID']); if (is_object($ak)) { $value = $ak->getAttributeValue($val['avID'], $method); $avl->addAttributeValue($ak, $value); } } return $avl; }
public static function Create($attribute) { AttributeValueList::create(array('product_id' => $attribute->product_id, 'attribute_id' => $attribute->attribute_id, 'value' => $attribute->value)); }