ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
arWhere Class Reference

Class arWhere. More...

+ Inheritance diagram for arWhere:
+ Collaboration diagram for arWhere:

Public Member Functions

 asSQLStatement (ActiveRecord $ar)
 @description Build WHERE Statement More...
 
 setFieldname ($fieldname)
 
 getFieldname ()
 
 setOperator ($operator)
 
 getOperator ()
 
 setValue ($value)
 
 getValue ()
 
 setType ($type)
 
 getType ()
 
 setStatement ($statement)
 
 getStatement ()
 
 setLink ($link)
 
 getLink ()
 
- Public Member Functions inherited from arStatement
 asSQLStatement (ActiveRecord $ar)
 
 getTableNameAs ()
 
 setTableNameAs ($table_name_as)
 

Data Fields

const TYPE_STRING = 1
 
const TYPE_REGULAR = 2
 

Protected Attributes

 $type = self::TYPE_REGULAR
 
 $fieldname = ''
 
 $value
 
 $operator = '='
 
 $statement = ''
 
 $link = 'AND'
 
- Protected Attributes inherited from arStatement
 $table_name_as = ''
 

Detailed Description

Class arWhere.

Author
Fabian Schmid fs@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch
Version
2.0.7

Definition at line 10 of file class.arWhere.php.

Member Function Documentation

◆ asSQLStatement()

arWhere::asSQLStatement ( ActiveRecord  $ar)

@description Build WHERE Statement

Parameters
ActiveRecord$ar
Exceptions
arException
Returns
string

Reimplemented from arStatement.

Definition at line 48 of file class.arWhere.php.

49 {
50 if ($this->getType() == self::TYPE_REGULAR) {
51 $arField = $ar->getArFieldList()->getFieldByName($this->getFieldname());
52 if ($arField instanceof arField) {
53 $type = $arField->getFieldType();
54 $statement = $ar->getConnectorContainerName() . '.' . $this->getFieldname();
55 } else {
56 $statement = $this->getFieldname();
57 }
58
59 if (is_array($this->getValue())) {
60 if (in_array($this->getOperator(), array( 'IN', 'NOT IN', 'NOTIN' ))) {
61 $statement .= ' ' . $this->getOperator() . ' (';
62 } else {
63 $statement .= ' IN (';
64 }
65 $values = array();
66 foreach ($this->getValue() as $value) {
67 $values[] = $ar->getArConnector()->quote($value, $type);
68 }
69 $statement .= implode(', ', $values);
70 $statement .= ')';
71 } else {
72 if ($this->getValue() === null) {
73 $operator = 'IS';
74 if (in_array($this->getOperator(), array('IS', 'IS NOT'))) {
75 $operator = $this->getOperator();
76 }
77 $this->setOperator($operator);
78 }
79 $statement .= ' ' . $this->getOperator();
80 $statement .= ' ' . $ar->getArConnector()->quote($this->getValue(), $type);
81 }
83 }
84
85 return $this->getStatement();
86 }
Class arField.
setStatement($statement)
setOperator($operator)
$values

References $operator, $statement, $type, $value, $values, ActiveRecord\getArConnector(), ActiveRecord\getArFieldList(), ActiveRecord\getConnectorContainerName(), getFieldname(), getOperator(), getStatement(), getType(), getValue(), setOperator(), and setStatement().

+ Here is the call graph for this function:

◆ getFieldname()

arWhere::getFieldname ( )
Returns
string

Definition at line 101 of file class.arWhere.php.

102 {
103 return $this->fieldname;
104 }

References $fieldname.

Referenced by asSQLStatement().

+ Here is the caller graph for this function:

◆ getLink()

arWhere::getLink ( )
Returns
string

Definition at line 191 of file class.arWhere.php.

192 {
193 return $this->link;
194 }

References $link.

◆ getOperator()

arWhere::getOperator ( )
Returns
string

Definition at line 119 of file class.arWhere.php.

120 {
121 return $this->operator;
122 }

References $operator.

Referenced by asSQLStatement().

+ Here is the caller graph for this function:

◆ getStatement()

arWhere::getStatement ( )
Returns
string

Definition at line 173 of file class.arWhere.php.

174 {
175 return $this->statement;
176 }

References $statement.

Referenced by asSQLStatement().

+ Here is the caller graph for this function:

◆ getType()

arWhere::getType ( )
Returns
int

Definition at line 155 of file class.arWhere.php.

156 {
157 return $this->type;
158 }

References $type.

Referenced by asSQLStatement().

+ Here is the caller graph for this function:

◆ getValue()

arWhere::getValue ( )
Returns
mixed

Definition at line 137 of file class.arWhere.php.

138 {
139 return $this->value;
140 }

References $value.

Referenced by asSQLStatement().

+ Here is the caller graph for this function:

◆ setFieldname()

arWhere::setFieldname (   $fieldname)
Parameters
string$fieldname

Definition at line 92 of file class.arWhere.php.

93 {
94 $this->fieldname = $fieldname;
95 }

References $fieldname.

◆ setLink()

arWhere::setLink (   $link)
Parameters
string$link

Definition at line 182 of file class.arWhere.php.

183 {
184 $this->link = $link;
185 }

References $link.

◆ setOperator()

arWhere::setOperator (   $operator)
Parameters
string$operator

Definition at line 110 of file class.arWhere.php.

111 {
112 $this->operator = $operator;
113 }

References $operator.

Referenced by asSQLStatement().

+ Here is the caller graph for this function:

◆ setStatement()

arWhere::setStatement (   $statement)
Parameters
string$statement

Definition at line 164 of file class.arWhere.php.

165 {
166 $this->statement = $statement;
167 }

References $statement.

Referenced by asSQLStatement().

+ Here is the caller graph for this function:

◆ setType()

arWhere::setType (   $type)
Parameters
int$type

Definition at line 146 of file class.arWhere.php.

147 {
148 $this->type = $type;
149 }

References $type.

◆ setValue()

arWhere::setValue (   $value)
Parameters
mixed$value

Definition at line 128 of file class.arWhere.php.

129 {
130 $this->value = $value;
131 }

References $value.

Field Documentation

◆ $fieldname

arWhere::$fieldname = ''
protected

Definition at line 21 of file class.arWhere.php.

Referenced by getFieldname(), and setFieldname().

◆ $link

arWhere::$link = 'AND'
protected

Definition at line 37 of file class.arWhere.php.

Referenced by getLink(), and setLink().

◆ $operator

arWhere::$operator = '='
protected

Definition at line 29 of file class.arWhere.php.

Referenced by asSQLStatement(), getOperator(), and setOperator().

◆ $statement

arWhere::$statement = ''
protected

Definition at line 33 of file class.arWhere.php.

Referenced by asSQLStatement(), getStatement(), and setStatement().

◆ $type

arWhere::$type = self::TYPE_REGULAR
protected

Definition at line 17 of file class.arWhere.php.

Referenced by asSQLStatement(), getType(), and setType().

◆ $value

arWhere::$value
protected

Definition at line 25 of file class.arWhere.php.

Referenced by asSQLStatement(), getValue(), and setValue().

◆ TYPE_REGULAR

const arWhere::TYPE_REGULAR = 2

Definition at line 13 of file class.arWhere.php.

◆ TYPE_STRING

const arWhere::TYPE_STRING = 1

Definition at line 12 of file class.arWhere.php.

Referenced by ActiveRecordList\where().


The documentation for this class was generated from the following file: