You are here

function uc_attribute_subject_exists in Ubercart 7.3

Same name and namespace in other branches
  1. 8.4 uc_attribute/uc_attribute.module \uc_attribute_subject_exists()
  2. 6.2 uc_attribute/uc_attribute.module \uc_attribute_subject_exists()

Checks if a product/class attribute exists.

Parameters

int $aid: The base attribute ID.

string $type: Is this a product or a class?

int $id: The product/class attribute's ID.

Return value

bool TRUE if the attribute exists.

2 calls to uc_attribute_subject_exists()
UbercartAttributeTestCase::testAttributeAPI in uc_attribute/tests/uc_attribute.test
Tests the basic attribute API.
uc_attribute_subject_save in uc_attribute/uc_attribute.module
Saves a product/class attribute.

File

uc_attribute/uc_attribute.module, line 1097
Ubercart Attribute module.

Code

function uc_attribute_subject_exists($aid, $type, $id) {
  $sql = uc_attribute_type_info($type);
  $query = db_select($sql['attr_table'], 'a')
    ->fields('a', array(
    'aid',
  ))
    ->condition('aid', $aid)
    ->condition($sql['id'], $id);
  return FALSE !== $query
    ->execute()
    ->fetchField();
}