public static CustomJoin ( $strTableName, $strTableAlias, $strJoinConditionSql ) |
protected function GetQqNodeForAttributeNode(QQCondition &$objQqCondition = null, &$objQqClauses = null, $strValue) { // Get the Attribute object we are trying to query against $objAttribute = Attribute::Load($this->NodeDetail); $strAttributeValueTableAlias = 'av' . self::$intJoinCount++; $objQqClauses[] = QQ::CustomJoin('attribute_value', $strAttributeValueTableAlias, sprintf('%s%s%s.%sperson_id%s = %st0%s.%sid%s AND %s%s%s.%sattribute_id%s = %s', self::GetDatabase()->EscapeIdentifierBegin, $strAttributeValueTableAlias, self::GetDatabase()->EscapeIdentifierEnd, self::GetDatabase()->EscapeIdentifierBegin, self::GetDatabase()->EscapeIdentifierEnd, self::GetDatabase()->EscapeIdentifierBegin, self::GetDatabase()->EscapeIdentifierEnd, self::GetDatabase()->EscapeIdentifierBegin, self::GetDatabase()->EscapeIdentifierEnd, self::GetDatabase()->EscapeIdentifierBegin, $strAttributeValueTableAlias, self::GetDatabase()->EscapeIdentifierEnd, self::GetDatabase()->EscapeIdentifierBegin, self::GetDatabase()->EscapeIdentifierEnd, $objAttribute->Id)); // What is the ATTRIBUTE's type? Figure out the Custom QQ Node based on that switch ($objAttribute->AttributeDataTypeId) { case AttributeDataType::Checkbox: $objQqNode = QQ::CustomNode(sprintf('%s.boolean_value', $strAttributeValueTableAlias)); break; case AttributeDataType::Date: $objQqNode = QQ::CustomNode(sprintf('%s.date_value', $strAttributeValueTableAlias)); break; case AttributeDataType::DateTime: $objQqNode = QQ::CustomNode(sprintf('%s.datetime_value', $strAttributeValueTableAlias)); break; case AttributeDataType::Text: $objQqNode = QQ::CustomNode(sprintf('%s.text_value', $strAttributeValueTableAlias)); break; case AttributeDataType::ImmutableSingleDropdown: case AttributeDataType::MutableSingleDropdown: $objQqNode = QQ::CustomNode(sprintf('%s.single_attribute_option_id', $strAttributeValueTableAlias)); break; case AttributeDataType::ImmutableMultipleDropdown: case AttributeDataType::MutableMultipleDropdown: $strAttributeOptionTableAlias = 'avmaoa' . self::$intJoinCount++; $objQqClauses[] = QQ::CustomJoin('attributevalue_multipleattributeoption_assn', $strAttributeOptionTableAlias, sprintf("%s.attribute_value_id = %s.id AND %s.attribute_option_id = '%s'", $strAttributeOptionTableAlias, $strAttributeValueTableAlias, $strAttributeOptionTableAlias, $strValue)); $objQqNode = QQ::CustomNode(sprintf('%s.attribute_option_id', $strAttributeOptionTableAlias)); break; default: throw new Exception('No Support for Attribute Data Type Id: ' . $objAttribute->AttributeDataTypeId); } return $objQqNode; }