* (c) 2009 Jochen Rau <jochen.rau@typoplanet.de>
* All rights reserved
*
-* This class is a backport of the corresponding class of FLOW3.
+* This class is a backport of the corresponding class of FLOW3.
* All credits go to the v5 team.
*
* This script is part of the TYPO3 project. The TYPO3 project is
/**
* A persistence query interface
*
- * @package TYPO3
- * @subpackage Extbase
- * @version $Id: QueryInterface.php 658 2009-05-16 13:54:16Z jocrau $
+ * @package Extbase
+ * @subpackage Persistence
+ * @version $Id$
+ * @api
*/
interface Tx_Extbase_Persistence_QueryInterface {
+ /**
+ * The '=' comparison operator.
+ * @api
+ */
+ const OPERATOR_EQUAL_TO = 1;
+
+ /**
+ * The '!=' comparison operator.
+ * @api
+ */
+ const OPERATOR_NOT_EQUAL_TO = 2;
+
+ /**
+ * The '<' comparison operator.
+ * @api
+ */
+ const OPERATOR_LESS_THAN = 3;
+
+ /**
+ * The '<=' comparison operator.
+ * @api
+ */
+ const OPERATOR_LESS_THAN_OR_EQUAL_TO = 4;
+
+ /**
+ * The '>' comparison operator.
+ * @api
+ */
+ const OPERATOR_GREATER_THAN = 5;
+
+ /**
+ * The '>=' comparison operator.
+ * @api
+ */
+ const OPERATOR_GREATER_THAN_OR_EQUAL_TO = 6;
+
+ /**
+ * The 'like' comparison operator.
+ * @api
+ */
+ const OPERATOR_LIKE = 7;
+
+ /**
+ * The 'contains' comparison operator.
+ * @api
+ */
+ const OPERATOR_CONTAINS = 8;
+
+ /**
+ * The 'in' comparison operator.
+ * @api
+ */
+ const OPERATOR_IN = 9;
+
/**
* Constants representing the direction when ordering result sets.
*/
const ORDER_ASCENDING = 'ASC';
const ORDER_DESCENDING = 'DESC';
+ /**
+ * An inner join.
+ */
+ const JCR_JOIN_TYPE_INNER = '{http://www.jcp.org/jcr/1.0}joinTypeInner';
+
+ /**
+ * A left-outer join.
+ */
+ const JCR_JOIN_TYPE_LEFT_OUTER = '{http://www.jcp.org/jcr/1.0}joinTypeLeftOuter';
+
+ /**
+ * A right-outer join.
+ */
+ const JCR_JOIN_TYPE_RIGHT_OUTER = '{http://www.jcp.org/jcr/1.0}joinTypeRightOuter';
+
/**
* Executes the query against the backend and returns the result
*
- * @return array The query result, an array of objects
+ * @return array<object> The query result as an array of objects
+ * @api
*/
public function execute();
+ /**
+ * Executes the query against the database and returns the number of matching objects
+ *
+ * @return integer The number of matching objects
+ * @api
+ */
+ public function count();
+
/**
* Sets the property names to order the result by. Expected like this:
* array(
*
* @param array $orderings The property names to order by
* @return Tx_Extbase_Persistence_QueryInterface
+ * @api
*/
public function setOrderings(array $orderings);
*
* @param integer $limit
* @return Tx_Extbase_Persistence_QueryInterface
+ * @api
*/
public function setLimit($limit);
*
* @param integer $offset
* @return Tx_Extbase_Persistence_QueryInterface
+ * @api
*/
public function setOffset($offset);
*
* @param object $constraint Some constraint, depending on the backend
* @return Tx_Extbase_Persistence_QueryInterface
+ * @api
*/
public function matching($constraint);
/**
* Performs a logical conjunction of the two given constraints.
*
- * @param object $constraint1 First constraint
- * @param object $constraint2 Second constraint
+ * @param mixed $constraint1 The first of multiple constraints or an array of constraints.
* @return object
+ * @api
*/
- public function logicalAnd($constraint1, $constraint2);
+ public function logicalAnd($constraint1);
/**
* Performs a logical disjunction of the two given constraints
*
- * @param object $constraint1 First constraint
- * @param object $constraint2 Second constraint
+ * @param mixed $constraint1 The first of multiple constraints or an array of constraints.
* @return object
+ * @api
*/
- public function logicalOr($constraint1, $constraint2);
+ public function logicalOr($constraint1);
/**
* Performs a logical negation of the given constraint
*
* @param object $constraint Constraint to negate
* @return object
+ * @api
*/
public function logicalNot($constraint);
*
* @param string $uid An identifier to match against
* @return object
+ * @api
*/
public function withUid($uid);
* @param mixed $operand The value to compare with
* @param boolean $caseSensitive Whether the equality test should be done case-sensitive
* @return object
+ * @api
*/
public function equals($propertyName, $operand, $caseSensitive = TRUE);
* @param string $propertyName The name of the property to compare against
* @param mixed $operand The value to compare with
* @return object
+ * @api
*/
public function like($propertyName, $operand);
+ /**
+ * Returns a "contains" criterion used for matching objects against a query.
+ * It matches if the multivalued property contains the given operand.
+ *
+ * @param string $propertyName The name of the (multivalued) property to compare against
+ * @param mixed $operand The value to compare with
+ * @return object
+ * @api
+ */
+ public function contains($propertyName, $operand);
+
+ /**
+ * Returns an "in" criterion used for matching objects against a query. It
+ * matches if the property's value is contained in the multivalued operand.
+ *
+ * @param string $propertyName The name of the property to compare against
+ * @param mixed $operand The value to compare with, multivalued
+ * @return object
+ * @api
+ */
+ public function in($propertyName, $operand);
+
/**
* Returns a less than criterion used for matching objects against a query
*
* @param string $propertyName The name of the property to compare against
* @param mixed $operand The value to compare with
* @return object
+ * @api
*/
public function lessThan($propertyName, $operand);
* @param string $propertyName The name of the property to compare against
* @param mixed $operand The value to compare with
* @return object
+ * @api
*/
public function lessThanOrEqual($propertyName, $operand);
* @param string $propertyName The name of the property to compare against
* @param mixed $operand The value to compare with
* @return object
+ * @api
*/
public function greaterThan($propertyName, $operand);
* @param string $propertyName The name of the property to compare against
* @param mixed $operand The value to compare with
* @return object
+ * @api
*/
public function greaterThanOrEqual($propertyName, $operand);