public function getAttributes($pID, $method = 'getValue') { $db = Database::get(); $values = $db->GetAll("select akID, avID from VividStoreProductAttributeValues where pID = ?", array($pID)); $avl = new AttributeValueList(); foreach ($values as $val) { $ak = StoreProductKey::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 static function getAttributes($cID, $cvID, $method = 'getValue') { $db = Loader::db(); $values = $db->GetAll("select akID, avID from CollectionAttributeValues where cID = ? and cvID = ?", array($cID, $cvID)); $avl = new AttributeValueList(); foreach ($values as $val) { $ak = static::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 *** version can store * against its object. * @return AttributeValueList */ public static function getAttributes($afID, $method = 'getValue') { $db = Database::connection(); $values = $db->GetAll("select akID, avID from AttributeFormsAttributeValues where afID = ?", array($afID)); $avl = new AttributeValueList(); foreach ($values as $val) { $ak = static::getByID($val['akID']); if (is_object($ak)) { $value = $ak->getAttributeValue($val['avID'], $method); $avl->addAttributeValue($ak, $value); } } return $avl; }
/** * @param string $table * @param array $columnHeaders * @param \Concrete\Core\Attribute\Value\ValueList $attribs * @param mixed $rs this is a legacy parameter, not actually used anymore */ public function reindex($table, $columnHeaders, $attribs, $rs = null) { /** @var \Concrete\Core\Database\Connection $db */ $db = Loader::db(); $sm = $db->getSchemaManager(); /** @var \Doctrine\DBAL\Schema\Column[] $columns */ $columns = $sm->listTableColumns($table); $attribs->rewind(); while ($attribs->valid()) { $column = 'ak_' . $attribs->key(); if (is_array($attribs->current())) { foreach ($attribs->current() as $key => $value) { $col = $column . '_' . $key; if (isset($columns[strtolower($col)])) { $columnHeaders[$col] = $value; } } } else { if (isset($columns[strtolower($column)])) { $columnHeaders[$column] = $attribs->current(); } } $attribs->next(); } $db->insert($table, $columnHeaders); }