RDBMapper.php
1 <?php
2 /**
3  * wCMF - wemove Content Management Framework
4  * Copyright (C) 2005-2020 wemove digital solutions GmbH
5  *
6  * Licensed under the terms of the MIT License.
7  *
8  * See the LICENSE file distributed with this work for
9  * additional information.
10  */
11 namespace wcmf\lib\model\mapper;
12 
18 
19 /**
20  * RDBMapper defines the interface for mapper classes that map to relational databases.
21  *
22  * @author ingo herwig <ingo@wemove.com>
23  */
24 interface RDBMapper extends PersistenceMapper {
25 
26  /**
27  * Get the database connection.
28  * @return PDOConnection
29  */
30  public function getConnection();
31 
32  /**
33  * Get the database adapter.
34  * @return Laminas\Db\Adapter\AdapterInterface
35  */
36  public function getAdapter();
37 
38  /**
39  * Get the symbol used to quote identifiers.
40  * @return String
41  */
42  public function getQuoteIdentifierSymbol();
43 
44  /**
45  * Add quotation to a given identifier (like column name).
46  * @param $identifier The identifier string
47  * @return String
48  */
49  public function quoteIdentifier($identifier);
50 
51  /**
52  * Add quotation to a given value.
53  * @param $value The value
54  * @return String
55  */
56  public function quoteValue($value);
57 
58  /**
59  * Get the table name with the dbprefix added
60  * @return The table name
61  */
62  public function getRealTableName();
63 
64  /**
65  * Execute a select query on the connection.
66  * @param $selectStmt A SelectStatement instance
67  * @param $pagingInfo An PagingInfo instance describing which page to load (optional, default: _null_)
68  * @return An array as the result of PDOStatement::fetchAll(PDO::FETCH_ASSOC)
69  */
70  public function select(SelectStatement $selectStmt, PagingInfo $pagingInfo=null);
71 
72  /**
73  * Construct an object id from given row data
74  * @param $data An associative array with the pk column names as keys and pk values as values
75  * @return The oid
76  */
77  public function constructOID($data);
78 
79  /**
80  * Render a Criteria instance as string.
81  * @param $criteria The Criteria instance
82  * @param $placeholder Placeholder (':columnName', '?') used instead of the value (optional, default: _null_)
83  * @param $tableName The table name to use (may differ from criteria's type attribute) (optional)
84  * @param $columnName The column name to use (may differ from criteria's attribute attribute) (optional)
85  * @return Array with condition (string) and placeholder (string)
86  */
87  public function renderCriteria(Criteria $criteria, $placeholder=null, $tableName=null, $columnName=null);
88 
89  /**
90  * Load objects defined by a select statement.
91  * @param $selectStmt A SelectStatement instance
92  * @param $buildDepth One of the BUILDDEPTH constants or a number describing the number of generations to build
93  * (except BuildDepth::REQUIRED, BuildDepth::PROXIES_ONLY) (default: BuildDepth::SINGLE)
94  * @param $pagingInfo A reference PagingInfo instance (optional, default: _null_)
95  * @param $originalData A reference that will receive the original database data (optional)
96  * @return Array of PersistentObject instances
97  */
98  public function loadObjectsFromSQL(SelectStatement $selectStmt, $buildDepth=BuildDepth::SINGLE,
99  PagingInfo $pagingInfo=null, &$originalData=null);
100 }
101 ?>
RDBMapper defines the interface for mapper classes that map to relational databases.
Definition: RDBMapper.php:24
renderCriteria(Criteria $criteria, $placeholder=null, $tableName=null, $columnName=null)
Render a Criteria instance as string.
constructOID($data)
Construct an object id from given row data.
getQuoteIdentifierSymbol()
Get the symbol used to quote identifiers.
loadObjectsFromSQL(SelectStatement $selectStmt, $buildDepth=BuildDepth::SINGLE, PagingInfo $pagingInfo=null, &$originalData=null)
Load objects defined by a select statement.
quoteIdentifier($identifier)
Add quotation to a given identifier (like column name).
PersistenceMapper defines the interface for all mapper classes.
Criteria defines a condition on a PersistentObject's attribute used to select specific instances.
Definition: Criteria.php:21
BuildDepth values are used to define the depth when loading object trees.
Definition: BuildDepth.php:19
select(SelectStatement $selectStmt, PagingInfo $pagingInfo=null)
Execute a select query on the connection.
getRealTableName()
Get the table name with the dbprefix added.
PagingInfo contains information about a paged list.
Definition: PagingInfo.php:18
getAdapter()
Get the database adapter.
getConnection()
Get the database connection.
quoteValue($value)
Add quotation to a given value.