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!
 */
16

Sebastian Kurfürst's avatar
Sebastian Kurfürst committed
17
18
19
/**
 * Storage backend interface
 */
20
21
interface BackendInterface {

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

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

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

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

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

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

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

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