|
TYPO3 API
SVNRelease
|
00001 <?php 00002 /*************************************************************** 00003 * Copyright notice 00004 * 00005 * (c) 2009 Jochen Rau <jochen.rau@typoplanet.de> 00006 * All rights reserved 00007 * 00008 * This class is a backport of the corresponding class of FLOW3. 00009 * All credits go to the v5 team. 00010 * 00011 * This script is part of the TYPO3 project. The TYPO3 project is 00012 * free software; you can redistribute it and/or modify 00013 * it under the terms of the GNU General Public License as published by 00014 * the Free Software Foundation; either version 2 of the License, or 00015 * (at your option) any later version. 00016 * 00017 * The GNU General Public License can be found at 00018 * http://www.gnu.org/copyleft/gpl.html. 00019 * 00020 * This script is distributed in the hope that it will be useful, 00021 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00022 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00023 * GNU General Public License for more details. 00024 * 00025 * This copyright notice MUST APPEAR in all copies of the script! 00026 ***************************************************************/ 00027 00028 /** 00029 * Filters node-tuples based on the outcome of a binary operation. 00030 * 00031 * For any comparison, operand2 always evaluates to a scalar value. In contrast, 00032 * operand1 may evaluate to an array of values (for example, the value of a multi-valued 00033 * property), in which case the comparison is separately performed for each element 00034 * of the array, and the Comparison constraint is satisfied as a whole if the 00035 * comparison against any element of the array is satisfied. 00036 * 00037 * If operand1 and operand2 evaluate to values of different property types, the 00038 * value of operand2 is converted to the property type of the value of operand1. 00039 * If the type conversion fails, the query is invalid. 00040 * 00041 * If operator is not supported for the property type of operand1, the query is invalid. 00042 * 00043 * If operand1 evaluates to null (for example, if the operand evaluates the value 00044 * of a property which does not exist), the constraint is not satisfied. 00045 * 00046 * The JCR_OPERATOR_EQUAL_TO operator is satisfied only if the value of operand1 00047 * equals the value of operand2. 00048 * 00049 * The JCR_OPERATOR_NOT_EQUAL_TO operator is satisfied unless the value of 00050 * operand1 equals the value of operand2. 00051 * 00052 * The JCR_OPERATOR_LESSS_THAN operator is satisfied only if the value of 00053 * operand1 is ordered before the value of operand2. 00054 * 00055 * The JCR_OPERATOR_LESS_THAN_OR_EQUAL_TO operator is satisfied unless the value 00056 * of operand1 is ordered after the value of operand2. 00057 * 00058 * The JCR_OPERATOR_GREATER_THAN operator is satisfied only if the value of 00059 * operand1 is ordered after the value of operand2. 00060 * 00061 * The JCR_OPERATOR_GREATER_THAN_OR_EQUAL_TO operator is satisfied unless the 00062 * value of operand1 is ordered before the value of operand2. 00063 * 00064 * The JCR_OPERATOR_LIKE operator is satisfied only if the value of operand1 00065 * matches the pattern specified by the value of operand2, where in the pattern: 00066 * * the character "%" matches zero or more characters, and 00067 * * the character "_" (underscore) matches exactly one character, and 00068 * * the string "\x" matches the character "x", and 00069 * all other characters match themselves. 00070 * 00071 * @package Extbase 00072 * @subpackage Persistence\QOM 00073 * @version $Id: Comparison.php 1971 2010-03-08 16:59:04Z jocrau $ 00074 * @scope prototype 00075 */ 00076 class Tx_Extbase_Persistence_QOM_Comparison implements Tx_Extbase_Persistence_QOM_ComparisonInterface { 00077 00078 /** 00079 * @var Tx_Extbase_Persistence_QOM_DynamicOperandInterface 00080 */ 00081 protected $operand1; 00082 00083 /** 00084 * @var integer 00085 */ 00086 protected $operator; 00087 00088 /** 00089 * @var mixed 00090 */ 00091 protected $operand2; 00092 00093 /** 00094 * Constructs this Comparison instance 00095 * 00096 * @param Tx_Extbase_Persistence_QOM_DynamicOperandInterface $operand1 00097 * @param int $operator one of Tx_Extbase_Persistence_QueryInterface.OPERATOR_* 00098 * @param mixed $operand2 00099 */ 00100 public function __construct(Tx_Extbase_Persistence_QOM_DynamicOperandInterface $operand1, $operator, $operand2) { 00101 $this->operand1 = $operand1; 00102 $this->operator = $operator; 00103 $this->operand2 = $operand2; 00104 } 00105 00106 /** 00107 * 00108 * Gets the first operand. 00109 * 00110 * @return Tx_Extbase_Persistence_QOM_DynamicOperandInterface the operand; non-null 00111 */ 00112 public function getOperand1() { 00113 return $this->operand1; 00114 } 00115 00116 /** 00117 * Gets the operator. 00118 * 00119 * @return string one of Tx_Extbase_Persistence_QOM_QueryObjectModelConstantsInterface.JCR_OPERATOR_* 00120 */ 00121 public function getOperator() { 00122 return $this->operator; 00123 } 00124 00125 /** 00126 * Gets the second operand. 00127 * 00128 * @return mixed the operand; non-null 00129 */ 00130 public function getOperand2() { 00131 return $this->operand2; 00132 } 00133 00134 } 00135 00136 ?>
1.8.0