BackendInterface.php 3.44 KB
Newer Older
Sebastian Kurfürst's avatar
Sebastian Kurfürst committed
1
<?php
Thomas Maroschik's avatar
Thomas Maroschik committed
2
3
namespace TYPO3\CMS\Extbase\Persistence\Generic\Storage;

4
/*
5
 * This file is part of the TYPO3 CMS project.
6
 *
7
8
9
 * 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.
10
 *
11
12
 * For the full copyright and license information, please read the
 * LICENSE.txt file that was distributed with this source code.
13
 *
14
15
 * The TYPO3 project - inspiring people to share!
 */
16

Sebastian Kurfürst's avatar
Sebastian Kurfürst committed
17
18
19
/**
 * Storage backend interface
 */
20
21
22
23
24
25
26
27
28
29
30
interface BackendInterface
{
    /**
     * Adds a row to the storage
     *
     * @param string $tableName The database table name
     * @param array $fieldValues The fieldValues to insert
     * @param bool $isRelation TRUE if we are currently inserting into a relation table, FALSE by default
     * @return int the UID of the inserted row
     */
    public function addRow($tableName, array $fieldValues, $isRelation = false);
31

32
33
34
35
36
37
38
39
40
    /**
     * Updates a row in the storage
     *
     * @param string $tableName The database table name
     * @param array $fieldValues The fieldValues to update
     * @param bool $isRelation TRUE if we are currently inserting into a relation table, FALSE by default
     * @return mixed|void
     */
    public function updateRow($tableName, array $fieldValues, $isRelation = false);
Sebastian Kurfürst's avatar
Sebastian Kurfürst committed
41

42
43
44
45
46
47
48
49
    /**
     * Updates a relation row in the storage
     *
     * @param string $tableName The database relation table name
     * @param array $fieldValues The fieldValues to be updated
     * @return bool
     */
    public function updateRelationTableRow($tableName, array $fieldValues);
Sebastian Kurfürst's avatar
Sebastian Kurfürst committed
50

51
52
53
54
55
56
57
58
59
    /**
     * Deletes a row in the storage
     *
     * @param string $tableName The database table name
     * @param array $where An array of where array('fieldname' => value). This array will be transformed to a WHERE clause
     * @param bool $isRelation TRUE if we are currently inserting into a relation table, FALSE by default
     * @return mixed|void
     */
    public function removeRow($tableName, array $where, $isRelation = false);
60

61
62
63
64
65
66
67
68
69
    /**
     * Fetches maximal value for given table column
     *
     * @param string $tableName The database table name
     * @param array $where An array of where array('fieldname' => value). This array will be transformed to a WHERE clause
     * @param string $columnName column name to get the max value from
     * @return mixed the max value
     */
    public function getMaxValueFromTable($tableName, array $where, $columnName);
Sebastian Kurfürst's avatar
Sebastian Kurfürst committed
70

71
72
73
74
75
76
77
    /**
     * Returns the number of items matching the query.
     *
     * @param \TYPO3\CMS\Extbase\Persistence\QueryInterface $query
     * @return int
     */
    public function getObjectCountByQuery(\TYPO3\CMS\Extbase\Persistence\QueryInterface $query);
78

79
80
81
82
83
84
85
    /**
     * Returns the object data matching the $query.
     *
     * @param \TYPO3\CMS\Extbase\Persistence\QueryInterface $query
     * @return array
     */
    public function getObjectDataByQuery(\TYPO3\CMS\Extbase\Persistence\QueryInterface $query);
Sebastian Kurfürst's avatar
Sebastian Kurfürst committed
86

87
88
89
90
91
92
93
94
    /**
     * Checks if a Value Object equal to the given Object exists in the data base
     *
     * @param \TYPO3\CMS\Extbase\DomainObject\AbstractValueObject $object The Value Object
     * @return mixed The matching uid if an object was found, else FALSE
     * @todo this is the last monster in this persistence series. refactor!
     */
    public function getUidOfAlreadyPersistedValueObject(\TYPO3\CMS\Extbase\DomainObject\AbstractValueObject $object);
Sebastian Kurfürst's avatar
Sebastian Kurfürst committed
95
}