1<?php
2
3/*
4 * This file is part of the TYPO3 CMS project.
5 *
6 * It is free software; you can redistribute it and/or modify it under
7 * the terms of the GNU General Public License, either version 2
8 * of the License, or any later version.
9 *
10 * For the full copyright and license information, please read the
11 * LICENSE.txt file that was distributed with this source code.
12 *
13 * The TYPO3 project - inspiring people to share!
14 */
15
16namespace TYPO3\CMS\Extbase\Persistence\Generic\Qom;
17
18/**
19 * A statement acting as a constraint.
20 * @internal only to be used within Extbase, not part of TYPO3 Core API.
21 */
22class Statement implements ConstraintInterface
23{
24    /**
25     * @var string|\Doctrine\DBAL\Statement|\TYPO3\CMS\Core\Database\Query\QueryBuilder
26     */
27    protected $statement;
28
29    /**
30     * @var array
31     */
32    protected $boundVariables = [];
33
34    /**
35     * Constructs the Statement instance
36     *
37     * @param string|\Doctrine\DBAL\Statement|\TYPO3\CMS\Core\Database\Query\QueryBuilder $statement The statement as sql string or an instance of \Doctrine\DBAL\Statement or \TYPO3\CMS\Core\Database\Query\QueryBuilder
38     * @param array $boundVariables An array of variables to bind to the statement, only to be used with prepared statements
39     */
40    public function __construct($statement, array $boundVariables = [])
41    {
42        $this->statement = $statement;
43        $this->boundVariables = $boundVariables;
44    }
45
46    /**
47     * Gets the statement.
48     *
49     * @return string|\Doctrine\DBAL\Statement|\TYPO3\CMS\Core\Database\Query\QueryBuilder the statement; non-null
50     */
51    public function getStatement()
52    {
53        return $this->statement;
54    }
55
56    /**
57     * Gets the bound variables
58     *
59     * @return array $boundVariables
60     */
61    public function getBoundVariables()
62    {
63        return $this->boundVariables;
64    }
65
66    /**
67     * Fills an array with the names of all bound variables in the constraints
68     *
69     * @param array $boundVariables
70     */
71    public function collectBoundVariableNames(&$boundVariables)
72    {
73    }
74}
75