Neos\Flow\Security\Authorization\Privilege\Entity\Doctrine\PropertyConditionGenerator::getConstraintStringForSimpleProperty PHP Method

getConstraintStringForSimpleProperty() protected method

protected getConstraintStringForSimpleProperty ( SQLFilter $sqlFilter, string $propertyPointer, string $operandDefinition = null ) : string
$sqlFilter SQLFilter
$propertyPointer string
$operandDefinition string
return string
    protected function getConstraintStringForSimpleProperty(SQLFilter $sqlFilter, $propertyPointer, $operandDefinition = null)
    {
        $operandDefinition = $operandDefinition === null ? $this->operandDefinition : $operandDefinition;
        $parameter = null;
        $addNullExpression = false;
        try {
            if (is_array($this->operandDefinition)) {
                $parameters = [];
                foreach ($this->operandDefinition as $operandIterator => $singleOperandValue) {
                    if ($singleOperandValue !== null) {
                        $parameters[] = $sqlFilter->getParameter($operandIterator);
                    } else {
                        $addNullExpression = true;
                    }
                }
                $parameter = implode(',', $parameters);
            } elseif ($this->getRawParameterValue($operandDefinition) !== null) {
                $parameter = $sqlFilter->getParameter($operandDefinition);
            }
        } catch (\InvalidArgumentException $exception) {
        }
        if ($parameter === null || $parameter === '') {
            $addNullExpression = true;
        }
        switch ($this->operator) {
            case '==':
                return $parameter === null ? $propertyPointer . ' IS NULL' : $propertyPointer . ' = ' . $parameter;
            case '!=':
                return $parameter === null ? $propertyPointer . ' IS NOT NULL' : $propertyPointer . ' <> ' . $parameter;
            case '<':
                return $propertyPointer . ' < ' . $parameter;
            case '>':
                return $propertyPointer . ' > ' . $parameter;
            case '<=':
                return $propertyPointer . ' <= ' . $parameter;
            case '>=':
                return $propertyPointer . ' >= ' . $parameter;
            case 'like':
                return $propertyPointer . ' LIKE ' . $parameter;
            case 'in':
                $inPart = $parameter !== null && $parameter !== '' ? $propertyPointer . ' IN (' . $parameter . ') ' : '';
                $nullPart = $addNullExpression ? $propertyPointer . ' IS NULL' : '';
                return $inPart . ($inPart !== '' && $nullPart !== '' ? ' OR ' : '') . $nullPart;
        }
    }