TYPO3 v15 dev-main snapshot ()

This commit is contained in:
2026-08-10 22:31:15 +02:00
commit 6830982e7d
295 changed files with 31995 additions and 0 deletions
@@ -0,0 +1,30 @@
<?php
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Extbase\Persistence\Generic\Qom;
/**
* Performs a logical conjunction of two other constraints.
*
* To satisfy the And constraint, a node-tuple must satisfy both constraint1 and
* constraint2.
*
* @internal only to be used within Extbase, not part of TYPO3 Core API.
*/
interface AndInterface extends ConstraintInterface
{
public function getConstraint1(): ConstraintInterface;
public function getConstraint2(): ConstraintInterface;
}
@@ -0,0 +1,38 @@
<?php
declare(strict_types=1);
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Extbase\Persistence\Generic\Qom;
/**
* Evaluates to the value of a bind variable.
*
* @internal only to be used within Extbase, not part of TYPO3 Core API.
*/
final readonly class BindVariableValue implements BindVariableValueInterface
{
public function __construct(private string $variableName) {}
public function collectBoundVariableNames(array &$boundVariables): void
{
$boundVariables[$this->variableName] = null;
}
public function getBindVariableName(): string
{
return $this->variableName;
}
}
@@ -0,0 +1,26 @@
<?php
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Extbase\Persistence\Generic\Qom;
/**
* Evaluates to the value of a bind variable.
*
* @internal only to be used within Extbase, not part of TYPO3 Core API.
*/
interface BindVariableValueInterface extends StaticOperandInterface
{
public function getBindVariableName(): string;
}
@@ -0,0 +1,43 @@
<?php
declare(strict_types=1);
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Extbase\Persistence\Generic\Qom;
/**
* Evaluates to the first non-NULL value among the operands.
*
* @internal only to be used within Extbase, not part of TYPO3 Core API.
*/
final readonly class Coalesce implements CoalesceInterface
{
/**
* @param array<DynamicOperandInterface|string> $operands
*/
public function __construct(
private array $operands
) {}
public function getOperands(): array
{
return $this->operands;
}
public function getFunctionName(): string
{
return 'COALESCE';
}
}
@@ -0,0 +1,28 @@
<?php
declare(strict_types=1);
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Extbase\Persistence\Generic\Qom;
/**
* Evaluates to the first non-NULL value among the operands.
*
* Usage example:
* $query->orderBy($query->coalesce('nickname', 'firstName'), QueryInterface::ORDER_ASCENDING);
*
* @internal only to be used within Extbase, not part of TYPO3 Core API.
*/
interface CoalesceInterface extends FunctionExpressionInterface {}
@@ -0,0 +1,110 @@
<?php
declare(strict_types=1);
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Extbase\Persistence\Generic\Qom;
use TYPO3\CMS\Extbase\Persistence\QueryInterface;
/**
* Filters node-tuples based on the outcome of a binary operation.
*
* For any comparison, operand2 always evaluates to a scalar value. In contrast,
* operand1 may evaluate to an array of values (for example, the value of a multi-valued
* property), in which case the comparison is separately performed for each element
* of the array, and the Comparison constraint is satisfied as a whole if the
* comparison against any element of the array is satisfied.
*
* If operand1 and operand2 evaluate to values of different property types, the
* value of operand2 is converted to the property type of the value of operand1.
* If the type conversion fails, the query is invalid.
*
* If operator is not supported for the property type of operand1, the query is invalid.
*
* If operand1 evaluates to null (for example, if the operand evaluates the value
* of a property which does not exist), the constraint is not satisfied.
*
* The OPERATOR_EQUAL_TO operator is satisfied only if the value of operand1
* equals the value of operand2.
*
* The OPERATOR_NOT_EQUAL_TO operator is satisfied unless the value of
* operand1 equals the value of operand2.
*
* The OPERATOR_LESS_THAN operator is satisfied only if the value of
* operand1 is ordered before the value of operand2.
*
* The OPERATOR_LESS_THAN_OR_EQUAL_TO operator is satisfied unless the value
* of operand1 is ordered after the value of operand2.
*
* The OPERATOR_GREATER_THAN operator is satisfied only if the value of
* operand1 is ordered after the value of operand2.
*
* The OPERATOR_GREATER_THAN_OR_EQUAL_TO operator is satisfied unless the
* value of operand1 is ordered before the value of operand2.
*
* The OPERATOR_LIKE operator is satisfied only if the value of operand1
* matches the pattern specified by the value of operand2, where in the pattern:
* the character "%" matches zero or more characters, and
* the character "_" (underscore) matches exactly one character, and
* the string "\x" matches the character "x", and
* all other characters match themselves.
*
* @internal only to be used within Extbase, not part of TYPO3 Core API.
*/
final readonly class Comparison implements ComparisonInterface
{
/**
* @param QueryInterface::OPERATOR_* $operator
*/
public function __construct(
private PropertyValueInterface $operand1,
private int $operator,
private mixed $operand2
) {}
public function getOperand1(): PropertyValueInterface
{
return $this->operand1;
}
/**
* @return QueryInterface::OPERATOR_*
*/
public function getOperator(): int
{
$operator = $this->operator;
if ($this->getOperand2() === null) {
if ($operator === QueryInterface::OPERATOR_EQUAL_TO) {
$operator = QueryInterface::OPERATOR_EQUAL_TO_NULL;
} elseif ($operator === QueryInterface::OPERATOR_NOT_EQUAL_TO) {
$operator = QueryInterface::OPERATOR_NOT_EQUAL_TO_NULL;
}
}
return $operator;
}
public function getOperand2(): mixed
{
return $this->operand2;
}
public function collectBoundVariableNames(array &$boundVariables): array
{
return [];
}
}
@@ -0,0 +1,75 @@
<?php
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Extbase\Persistence\Generic\Qom;
use TYPO3\CMS\Extbase\Persistence\QueryInterface;
/**
* Filters node-tuples based on the outcome of a binary operation.
*
* For any comparison, operand2 always evaluates to a scalar value. In contrast,
* operand1 may evaluate to an array of values (for example, the value of a multi-valued
* property), in which case the comparison is separately performed for each element
* of the array, and the Comparison constraint is satisfied as a whole if the
* comparison against any element of the array is satisfied.
*
* If operand1 and operand2 evaluate to values of different property types, the
* value of operand2 is converted to the property type of the value of operand1.
* If the type conversion fails, the query is invalid.
*
* If operator is not supported for the property type of operand1, the query is invalid.
*
* If operand1 evaluates to null (for example, if the operand evaluates the value
* of a property which does not exist), the constraint is not satisfied.
*
* The JCR_OPERATOR_EQUAL_TO operator is satisfied only if the value of operand1
* equals the value of operand2.
*
* The JCR_OPERATOR_NOT_EQUAL_TO operator is satisfied unless the value of
* operand1 equals the value of operand2.
*
* The JCR_OPERATOR_LESS_THAN operator is satisfied only if the value of
* operand1 is ordered before the value of operand2.
*
* The JCR_OPERATOR_LESS_THAN_OR_EQUAL_TO operator is satisfied unless the value
* of operand1 is ordered after the value of operand2.
*
* The JCR_OPERATOR_GREATER_THAN operator is satisfied only if the value of
* operand1 is ordered after the value of operand2.
*
* The JCR_OPERATOR_GREATER_THAN_OR_EQUAL_TO operator is satisfied unless the
* value of operand1 is ordered before the value of operand2.
*
* The JCR_OPERATOR_LIKE operator is satisfied only if the value of operand1
* matches the pattern specified by the value of operand2, where in the pattern:
* the character "%" matches zero or more characters, and
* the character "_" (underscore) matches exactly one character, and
* the string "\x" matches the character "x", and
* all other characters match themselves.
*
* @internal only to be used within Extbase, not part of TYPO3 Core API.
*/
interface ComparisonInterface extends ConstraintInterface
{
public function getOperand1(): PropertyValueInterface;
/**
* @return QueryInterface::OPERATOR_*
*/
public function getOperator(): int;
public function getOperand2(): mixed;
}
@@ -0,0 +1,43 @@
<?php
declare(strict_types=1);
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Extbase\Persistence\Generic\Qom;
/**
* Evaluates to the concatenated string value of the operands.
*
* @internal only to be used within Extbase, not part of TYPO3 Core API.
*/
final readonly class Concat implements ConcatInterface
{
/**
* @param array<DynamicOperandInterface|string> $operands
*/
public function __construct(
private array $operands
) {}
public function getOperands(): array
{
return $this->operands;
}
public function getFunctionName(): string
{
return 'CONCAT';
}
}
@@ -0,0 +1,28 @@
<?php
declare(strict_types=1);
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Extbase\Persistence\Generic\Qom;
/**
* Evaluates to the concatenated string value of the operands.
*
* Usage example:
* $query->orderBy($query->concat('firstName', 'lastName'), QueryInterface::ORDER_ASCENDING);
*
* @internal only to be used within Extbase, not part of TYPO3 Core API.
*/
interface ConcatInterface extends FunctionExpressionInterface {}
@@ -0,0 +1,29 @@
<?php
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Extbase\Persistence\Generic\Qom;
/**
* Filters the set of tuples formed by evaluating the query's sources and
* the joins between them.
*
* To be included in the query results, a tuple must satisfy the constraint.
*
* @internal only to be used within Extbase, not part of TYPO3 Core API.
*/
interface ConstraintInterface
{
public function collectBoundVariableNames(array &$boundVariables);
}
@@ -0,0 +1,23 @@
<?php
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Extbase\Persistence\Generic\Qom;
/**
* An operand whose value can only be determined in evaluating the query.
*
* @internal only to be used within Extbase, not part of TYPO3 Core API.
*/
interface DynamicOperandInterface extends OperandInterface {}
@@ -0,0 +1,69 @@
<?php
declare(strict_types=1);
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Extbase\Persistence\Generic\Qom;
/**
* Tests whether the value of a property in a first selector is equal to the value of a
* property in a second selector.
* A node-tuple satisfies the constraint only if: the selector1Name node has a property named property1Name, and
* the selector2Name node has a property named property2Name, and
* the value of property property1Name is equal to the value of property property2Name.
*
* @internal only to be used within Extbase, not part of TYPO3 Core API.
*/
final readonly class EquiJoinCondition implements EquiJoinConditionInterface
{
public function __construct(
private string $selector1Name,
private string $property1Name,
private string $selector2Name,
private string $property2Name
) {
// @todo Test for selector1Name = selector2Name -> exception
}
public function getSelector1Name(): string
{
return $this->selector1Name;
}
public function getProperty1Name(): string
{
return $this->property1Name;
}
public function getSelector2Name(): string
{
return $this->selector2Name;
}
public function getProperty2Name(): string
{
return $this->property2Name;
}
public function getChildSelectorName(): string
{
return '';
}
public function getParentSelectorName(): string
{
return '';
}
}
@@ -0,0 +1,32 @@
<?php
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Extbase\Persistence\Generic\Qom;
/**
* Tests whether the childSelector node is a child of the parentSelector node. A
* node-tuple satisfies the constraint only if:
* childSelectorNode.getParent().isSame(parentSelectorNode)
* would return true, where childSelectorNode is the node for childSelector and
* parentSelectorNode is the node for parentSelector.
*
* @internal only to be used within Extbase, not part of TYPO3 Core API.
*/
interface EquiJoinConditionInterface extends JoinConditionInterface
{
public function getChildSelectorName(): string;
public function getParentSelectorName(): string;
}
@@ -0,0 +1,43 @@
<?php
declare(strict_types=1);
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Extbase\Persistence\Generic\Qom;
/**
* Base interface for SQL function expressions with multiple operands.
*
* Function expressions can be used in ORDER BY clauses to sort results
* by computed values such as CONCAT, TRIM, COALESCE, etc.
*
* @internal only to be used within Extbase, not part of TYPO3 Core API.
*/
interface FunctionExpressionInterface extends DynamicOperandInterface
{
/**
* Returns the operands of this function expression.
*
* @return array<DynamicOperandInterface|string> The operands
*/
public function getOperands(): array;
/**
* Returns the SQL function name.
*
* @return string The function name (e.g., 'CONCAT', 'TRIM', 'COALESCE')
*/
public function getFunctionName(): string;
}
+59
View File
@@ -0,0 +1,59 @@
<?php
declare(strict_types=1);
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Extbase\Persistence\Generic\Qom;
/**
* Performs a join between two node-tuple sources.
*
* @internal only to be used within Extbase, not part of TYPO3 Core API.
*/
final readonly class Join implements SourceInterface, JoinInterface
{
/**
* @param string $joinType One of Query::JCR_JOIN_TYPE_*
*/
public function __construct(
private SourceInterface&SelectorInterface $left,
private SourceInterface&SelectorInterface $right,
private string $joinType,
private JoinConditionInterface $joinCondition
) {}
public function getLeft(): SourceInterface&SelectorInterface
{
return $this->left;
}
public function getRight(): SourceInterface&SelectorInterface
{
return $this->right;
}
/**
* @return string one of QueryObjectModelConstants.JCR_JOIN_TYPE_*
*/
public function getJoinType(): string
{
return $this->joinType;
}
public function getJoinCondition(): JoinConditionInterface
{
return $this->joinCondition;
}
}
@@ -0,0 +1,26 @@
<?php
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Extbase\Persistence\Generic\Qom;
/**
* Filters the set of node-tuples formed from a join.
*
* @internal only to be used within Extbase, not part of TYPO3 Core API.
*/
interface JoinConditionInterface
{
public function getSelector1Name(): string;
}
@@ -0,0 +1,35 @@
<?php
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Extbase\Persistence\Generic\Qom;
/**
* Performs a join between two node-tuple sources.
*
* @internal only to be used within Extbase, not part of TYPO3 Core API.
*/
interface JoinInterface
{
public function getLeft(): SourceInterface&SelectorInterface;
public function getRight(): SourceInterface&SelectorInterface;
/**
* @return string one of QueryObjectModelConstants.JCR_JOIN_TYPE_*
*/
public function getJoinType(): string;
public function getJoinCondition(): JoinConditionInterface;
}
@@ -0,0 +1,50 @@
<?php
declare(strict_types=1);
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Extbase\Persistence\Generic\Qom;
/**
* Performs a logical conjunction of two other constraints.
*
* To satisfy the And constraint, a node-tuple must satisfy both constraint1 and
* constraint2.
*
* @internal only to be used within Extbase, not part of TYPO3 Core API.
*/
final readonly class LogicalAnd implements AndInterface
{
public function __construct(
private ConstraintInterface $constraint1,
private ConstraintInterface $constraint2
) {}
public function collectBoundVariableNames(array &$boundVariables): void
{
$this->constraint1->collectBoundVariableNames($boundVariables);
$this->constraint2->collectBoundVariableNames($boundVariables);
}
public function getConstraint1(): ConstraintInterface
{
return $this->constraint1;
}
public function getConstraint2(): ConstraintInterface
{
return $this->constraint2;
}
}
@@ -0,0 +1,40 @@
<?php
declare(strict_types=1);
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Extbase\Persistence\Generic\Qom;
/**
* Performs a logical negation of another constraint.
*
* To satisfy the Not constraint, the node-tuple must not satisfy constraint.
*
* @internal only to be used within Extbase, not part of TYPO3 Core API.
*/
final readonly class LogicalNot implements NotInterface
{
public function __construct(private ConstraintInterface $constraint) {}
public function collectBoundVariableNames(array &$boundVariables): void
{
$this->constraint->collectBoundVariableNames($boundVariables);
}
public function getConstraint(): ConstraintInterface
{
return $this->constraint;
}
}
@@ -0,0 +1,52 @@
<?php
declare(strict_types=1);
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Extbase\Persistence\Generic\Qom;
/**
* Performs a logical disjunction of two other constraints.
*
* To satisfy the Or constraint, the node-tuple must either:
* satisfy constraint1 but not constraint2, or
* satisfy constraint2 but not constraint1, or
* satisfy both constraint1 and constraint2.
*
* @internal only to be used within Extbase, not part of TYPO3 Core API.
*/
final readonly class LogicalOr implements OrInterface
{
public function __construct(
private ConstraintInterface $constraint1,
private ConstraintInterface $constraint2
) {}
public function collectBoundVariableNames(array &$boundVariables): void
{
$this->constraint1->collectBoundVariableNames($boundVariables);
$this->constraint2->collectBoundVariableNames($boundVariables);
}
public function getConstraint1(): ConstraintInterface
{
return $this->constraint1;
}
public function getConstraint2(): ConstraintInterface
{
return $this->constraint2;
}
}
@@ -0,0 +1,49 @@
<?php
declare(strict_types=1);
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Extbase\Persistence\Generic\Qom;
/**
* Evaluates to the lower-case string value (or values, if multi-valued) of
* operand.
*
* If operand does not evaluate to a string value, its value is first converted
* to a string.
*
* If operand evaluates to null, the LowerCase operand also evaluates to null.
*
* @internal only to be used within Extbase, not part of TYPO3 Core API.
*/
final readonly class LowerCase implements LowerCaseInterface
{
public function __construct(private PropertyValueInterface $operand) {}
public function getOperand(): PropertyValueInterface
{
return $this->operand;
}
public function getSelectorName(): string
{
return $this->operand->getSelectorName();
}
public function getPropertyName(): string
{
return 'LOWER' . $this->operand->getPropertyName();
}
}
@@ -0,0 +1,32 @@
<?php
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Extbase\Persistence\Generic\Qom;
/**
* Evaluates to the lower-case string value (or values, if multi-valued) of
* operand.
*
* If operand does not evaluate to a string value, its value is first converted
* to a string.
*
* If operand evaluates to null, the LowerCase operand also evaluates to null.
*
* @internal only to be used within Extbase, not part of TYPO3 Core API.
*/
interface LowerCaseInterface extends PropertyValueInterface
{
public function getOperand(): PropertyValueInterface;
}
@@ -0,0 +1,28 @@
<?php
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Extbase\Persistence\Generic\Qom;
/**
* Performs a logical negation of another constraint.
*
* To satisfy the Not constraint, the node-tuple must not satisfy constraint.
*
* @internal only to be used within Extbase, not part of TYPO3 Core API.
*/
interface NotInterface extends ConstraintInterface
{
public function getConstraint(): ConstraintInterface;
}
@@ -0,0 +1,23 @@
<?php
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Extbase\Persistence\Generic\Qom;
/**
* An operand to a binary operation specified by a Comparison.
*
* @internal only to be used within Extbase, not part of TYPO3 Core API.
*/
interface OperandInterface {}
@@ -0,0 +1,32 @@
<?php
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Extbase\Persistence\Generic\Qom;
/**
* Performs a logical disjunction of two other constraints.
*
* To satisfy the Or constraint, the node-tuple must either:
* satisfy constraint1 but not constraint2, or
* satisfy constraint2 but not constraint1, or
* satisfy both constraint1 and constraint2.
*
* @internal only to be used within Extbase, not part of TYPO3 Core API.
*/
interface OrInterface extends ConstraintInterface
{
public function getConstraint1(): ConstraintInterface;
public function getConstraint2(): ConstraintInterface;
}
@@ -0,0 +1,50 @@
<?php
declare(strict_types=1);
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Extbase\Persistence\Generic\Qom;
use TYPO3\CMS\Extbase\Persistence\QueryInterface;
/**
* Determines the relative order of two rows in the result set by evaluating operand for
* each.
*
* @internal only to be used within Extbase, not part of TYPO3 Core API.
*/
final readonly class Ordering implements OrderingInterface
{
/**
* @param string $order One of QueryInterface::ORDER_*
*/
public function __construct(
private DynamicOperandInterface $operand,
private string $order = QueryInterface::ORDER_ASCENDING
) {}
public function getOperand(): DynamicOperandInterface
{
return $this->operand;
}
/**
* @return string One of QueryInterface::ORDER_*
*/
public function getOrder(): string
{
return $this->order;
}
}
@@ -0,0 +1,32 @@
<?php
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Extbase\Persistence\Generic\Qom;
/**
* Determines the relative order of two rows in the result set by evaluating operand for
* each.
*
* @internal only to be used within Extbase, not part of TYPO3 Core API.
*/
interface OrderingInterface
{
public function getOperand(): DynamicOperandInterface;
/**
* @return string One of QueryInterface::ORDER_*
*/
public function getOrder(): string;
}
@@ -0,0 +1,49 @@
<?php
declare(strict_types=1);
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Extbase\Persistence\Generic\Qom;
/**
* Evaluates to the value (or values, if multi-valued) of a property.
*
* If, for a node-tuple, the selector node does not have a property named property,
* the operand evaluates to null.
*
* The query is invalid if:
*
* selector is not the name of a selector in the query, or
* property is not a syntactically valid JCR name.
*
* @internal only to be used within Extbase, not part of TYPO3 Core API.
*/
final readonly class PropertyValue implements PropertyValueInterface
{
public function __construct(
private string $propertyName,
private string $selectorName = '',
) {}
public function getSelectorName(): string
{
return $this->selectorName;
}
public function getPropertyName(): string
{
return $this->propertyName;
}
}
@@ -0,0 +1,36 @@
<?php
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Extbase\Persistence\Generic\Qom;
/**
* Evaluates to the value (or values, if multi-valued) of a property.
*
* If, for a node-tuple, the selector node does not have a property named property,
* the operand evaluates to null.
*
* The query is invalid if:
*
* selector is not the name of a selector in the query, or
* property is not a syntactically valid JCR name.
*
* @internal only to be used within Extbase, not part of TYPO3 Core API.
*/
interface PropertyValueInterface extends DynamicOperandInterface
{
public function getSelectorName(): string;
public function getPropertyName(): string;
}
@@ -0,0 +1,184 @@
<?php
declare(strict_types=1);
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Extbase\Persistence\Generic\Qom;
use TYPO3\CMS\Core\Database\Query\QueryBuilder;
use TYPO3\CMS\Core\SingletonInterface;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Persistence\QueryInterface;
/**
* The Query Object Model Factory
*
* @internal only to be used within Extbase, not part of TYPO3 Core API.
*/
class QueryObjectModelFactory implements SingletonInterface
{
/**
* Selects a subset of the nodes in the repository based on node type.
*/
public function selector(?string $nodeTypeName = null, string $selectorName = ''): SourceInterface&SelectorInterface
{
if ($selectorName === '') {
$selectorName = $nodeTypeName;
}
return new Selector($selectorName, $nodeTypeName);
}
/**
* Sets a statement as constraint. This is not part of the JCR 2.0 Specification!
*/
public function statement(string|\Doctrine\DBAL\Statement|QueryBuilder $statement, array $boundVariables = []): Statement
{
return GeneralUtility::makeInstance(Statement::class, $statement, $boundVariables);
}
/**
* Performs a join between two node-tuple sources.
*/
public function join(
SourceInterface&SelectorInterface $left,
SourceInterface&SelectorInterface $right,
string $joinType,
JoinConditionInterface $joinCondition
): SourceInterface&JoinInterface {
return new Join($left, $right, $joinType, $joinCondition);
}
/**
* Tests whether the value of a property in a first selector is equal to the value of a property in a second selector.
*/
public function equiJoinCondition(string $selector1Name, string $property1Name, string $selector2Name, string $property2Name): EquiJoinConditionInterface
{
return GeneralUtility::makeInstance(EquiJoinCondition::class, $selector1Name, $property1Name, $selector2Name, $property2Name);
}
/**
* Performs a logical conjunction of two other constraints.
*/
public function _and(ConstraintInterface $constraint1, ConstraintInterface $constraint2): AndInterface
{
return GeneralUtility::makeInstance(LogicalAnd::class, $constraint1, $constraint2);
}
/**
* Performs a logical disjunction of two other constraints.
*/
public function _or(ConstraintInterface $constraint1, ConstraintInterface $constraint2): OrInterface
{
return GeneralUtility::makeInstance(LogicalOr::class, $constraint1, $constraint2);
}
/**
* Performs a logical negation of another constraint.
*/
public function not(ConstraintInterface $constraint): NotInterface
{
return GeneralUtility::makeInstance(LogicalNot::class, $constraint);
}
/**
* Filters node-tuples based on the outcome of a binary operation.
*/
public function comparison(PropertyValueInterface $operand1, int $operator, mixed $operand2): ComparisonInterface
{
return GeneralUtility::makeInstance(Comparison::class, $operand1, $operator, $operand2);
}
/**
* Evaluates to the value (or values, if multi-valued) of a property in the specified or default selector.
*/
public function propertyValue(string $propertyName, string $selectorName = ''): PropertyValueInterface
{
return GeneralUtility::makeInstance(PropertyValue::class, $propertyName, $selectorName);
}
/**
* Evaluates to the lower-case string value (or values, if multi-valued) of an operand.
*/
public function lowerCase(PropertyValueInterface $operand): LowerCaseInterface
{
return GeneralUtility::makeInstance(LowerCase::class, $operand);
}
/**
* Evaluates to the upper-case string value (or values, if multi-valued) of an operand.
*/
public function upperCase(PropertyValueInterface $operand): UpperCaseInterface
{
return GeneralUtility::makeInstance(UpperCase::class, $operand);
}
/**
* Orders by the value of the specified operand, in ascending order.
*
* The query is invalid if $operand does not evaluate to a scalar value.
*/
public function ascending(DynamicOperandInterface $operand): OrderingInterface
{
return GeneralUtility::makeInstance(Ordering::class, $operand, QueryInterface::ORDER_ASCENDING);
}
/**
* Orders by the value of the specified operand, in descending order.
*
* The query is invalid if $operand does not evaluate to a scalar value.
*/
public function descending(DynamicOperandInterface $operand): OrderingInterface
{
return GeneralUtility::makeInstance(Ordering::class, $operand, QueryInterface::ORDER_DESCENDING);
}
/**
* Evaluates to the value of a bind variable.
*/
public function bindVariable(string $bindVariableName): BindVariableValueInterface
{
return GeneralUtility::makeInstance(BindVariableValue::class, $bindVariableName);
}
/**
* Evaluates to the concatenated string value of the operands.
*
* @param DynamicOperandInterface|string ...$operands Property names or operand objects to concatenate
*/
public function concat(DynamicOperandInterface|string ...$operands): ConcatInterface
{
return GeneralUtility::makeInstance(Concat::class, $operands);
}
/**
* Evaluates to the trimmed string value of the operand.
*
* @param DynamicOperandInterface $operand The operand to trim
*/
public function trim(DynamicOperandInterface $operand): TrimInterface
{
return GeneralUtility::makeInstance(Trim::class, $operand);
}
/**
* Evaluates to the first non-NULL value among the operands.
*
* @param DynamicOperandInterface|string ...$operands Property names or operand objects
*/
public function coalesce(DynamicOperandInterface|string ...$operands): CoalesceInterface
{
return GeneralUtility::makeInstance(Coalesce::class, $operands);
}
}
@@ -0,0 +1,49 @@
<?php
declare(strict_types=1);
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Extbase\Persistence\Generic\Qom;
/**
* Selects a subset of the nodes in the repository based on node type.
*
* A selector selects every node in the repository, subject to access control
* constraints, that satisfies at least one of the following conditions:
*
* the node's primary node type is nodeType, or
* the node's primary node type is a subtype of nodeType, or
* the node has a mixin node type that is nodeType, or
* the node has a mixin node type that is a subtype of nodeType.
*
* @internal only to be used within Extbase, not part of TYPO3 Core API.
*/
final readonly class Selector implements SourceInterface, SelectorInterface
{
public function __construct(
private string $selectorName,
private ?string $nodeTypeName,
) {}
public function getNodeTypeName(): ?string
{
return $this->nodeTypeName;
}
public function getSelectorName(): string
{
return $this->selectorName;
}
}
@@ -0,0 +1,43 @@
<?php
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Extbase\Persistence\Generic\Qom;
/**
* Selects a subset of the nodes in the repository based on node type.
*
* A selector selects every node in the repository, subject to access control
* constraints, that satisfies at least one of the following conditions:
*
* the node's primary node type is nodeType, or
* the node's primary node type is a subtype of nodeType, or
* the node has a mixin node type that is nodeType, or
* the node has a mixin node type that is a subtype of nodeType.
*
* @internal only to be used within Extbase, not part of TYPO3 Core API.
*/
interface SelectorInterface
{
/**
* Gets the name of the required node type.
*/
public function getNodeTypeName(): ?string;
/**
* Gets the selector name.
* A selector's name can be used elsewhere in the query to identify the selector.
*/
public function getSelectorName(): string;
}
@@ -0,0 +1,23 @@
<?php
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Extbase\Persistence\Generic\Qom;
/**
* Evaluates to a set of node-tuples.
*
* @internal only to be used within Extbase, not part of TYPO3 Core API.
*/
interface SourceInterface {}
@@ -0,0 +1,48 @@
<?php
declare(strict_types=1);
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Extbase\Persistence\Generic\Qom;
use TYPO3\CMS\Core\Database\Query\QueryBuilder;
/**
* A statement acting as a constraint.
*
* @internal only to be used within Extbase, not part of TYPO3 Core API.
*/
final readonly class Statement implements ConstraintInterface
{
/**
* @param array $boundVariables An array of variables to bind to the statement, only to be used with prepared statements
*/
public function __construct(
private string|\Doctrine\DBAL\Statement|QueryBuilder $statement,
private array $boundVariables = []
) {}
public function getStatement(): string|\Doctrine\DBAL\Statement|QueryBuilder
{
return $this->statement;
}
public function getBoundVariables(): array
{
return $this->boundVariables;
}
public function collectBoundVariableNames(array &$boundVariables) {}
}
@@ -0,0 +1,24 @@
<?php
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Extbase\Persistence\Generic\Qom;
/**
* An operand whose value can be determined from static analysis of the query,
* prior to its evaluation.
*
* @internal only to be used within Extbase, not part of TYPO3 Core API.
*/
interface StaticOperandInterface extends OperandInterface {}
+45
View File
@@ -0,0 +1,45 @@
<?php
declare(strict_types=1);
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Extbase\Persistence\Generic\Qom;
/**
* Evaluates to the trimmed string value of the operand.
*
* @internal only to be used within Extbase, not part of TYPO3 Core API.
*/
final readonly class Trim implements TrimInterface
{
public function __construct(
private DynamicOperandInterface $operand
) {}
public function getOperand(): DynamicOperandInterface
{
return $this->operand;
}
public function getOperands(): array
{
return [$this->operand];
}
public function getFunctionName(): string
{
return 'TRIM';
}
}
@@ -0,0 +1,34 @@
<?php
declare(strict_types=1);
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Extbase\Persistence\Generic\Qom;
/**
* Evaluates to the trimmed string value of the operand.
*
* Usage example:
* $query->orderBy($query->trim('title'), QueryInterface::ORDER_ASCENDING);
*
* @internal only to be used within Extbase, not part of TYPO3 Core API.
*/
interface TrimInterface extends FunctionExpressionInterface
{
/**
* Returns the operand being trimmed.
*/
public function getOperand(): DynamicOperandInterface;
}
@@ -0,0 +1,49 @@
<?php
declare(strict_types=1);
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Extbase\Persistence\Generic\Qom;
/**
* Evaluates to the upper-case string value (or values, if multi-valued) of
* operand.
*
* If operand does not evaluate to a string value, its value is first converted
* to a string.
*
* If operand evaluates to null, the UpperCase operand also evaluates to null.
*
* @internal only to be used within Extbase, not part of TYPO3 Core API.
*/
final readonly class UpperCase implements UpperCaseInterface
{
public function __construct(private PropertyValueInterface $operand) {}
public function getOperand(): PropertyValueInterface
{
return $this->operand;
}
public function getSelectorName(): string
{
return $this->operand->getSelectorName();
}
public function getPropertyName(): string
{
return 'UPPER' . $this->operand->getPropertyName();
}
}
@@ -0,0 +1,32 @@
<?php
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Extbase\Persistence\Generic\Qom;
/**
* Evaluates to the upper-case string value (or values, if multi-valued) of
* operand.
*
* If operand does not evaluate to a string value, its value is first converted
* to a string.
*
* If operand evaluates to null, the UpperCase operand also evaluates to null.
*
* @internal only to be used within Extbase, not part of TYPO3 Core API.
*/
interface UpperCaseInterface extends PropertyValueInterface
{
public function getOperand(): PropertyValueInterface;
}