BackendInterface.php 3.26 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!
 */
Sebastian Kurfürst's avatar
Sebastian Kurfürst committed
16
17
18
/**
 * Storage backend interface
 */
19
20
interface BackendInterface {

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

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

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

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

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

Sebastian Kurfürst's avatar
Sebastian Kurfürst committed
70
	/**
71
	 * Returns the number of items matching the query.
Sebastian Kurfürst's avatar
Sebastian Kurfürst committed
72
	 *
Thomas Maroschik's avatar
Thomas Maroschik committed
73
	 * @param \TYPO3\CMS\Extbase\Persistence\QueryInterface $query
74
	 * @return int
75
	 * @api
Sebastian Kurfürst's avatar
Sebastian Kurfürst committed
76
	 */
Thomas Maroschik's avatar
Thomas Maroschik committed
77
	public function getObjectCountByQuery(\TYPO3\CMS\Extbase\Persistence\QueryInterface $query);
Sebastian Kurfürst's avatar
Sebastian Kurfürst committed
78

79
	/**
80
	 * Returns the object data matching the $query.
81
	 *
Thomas Maroschik's avatar
Thomas Maroschik committed
82
	 * @param \TYPO3\CMS\Extbase\Persistence\QueryInterface $query
83
84
	 * @return array
	 * @api
85
	 */
Thomas Maroschik's avatar
Thomas Maroschik committed
86
	public function getObjectDataByQuery(\TYPO3\CMS\Extbase\Persistence\QueryInterface $query);
87
88
89
90
91
92
93
94
95

	/**
	 * 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
96
}