diff options
Diffstat (limited to 'lib/public/AppFramework/Db/Mapper.php')
-rw-r--r-- | lib/public/AppFramework/Db/Mapper.php | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/public/AppFramework/Db/Mapper.php b/lib/public/AppFramework/Db/Mapper.php index b008702ba54..6910757add0 100644 --- a/lib/public/AppFramework/Db/Mapper.php +++ b/lib/public/AppFramework/Db/Mapper.php @@ -34,6 +34,7 @@ use OCP\IDBConnection; * Simple parent class for inheriting your data access layer from. This class * may be subject to change in the future * @since 7.0.0 + * @deprecated 14.0.0 Move over to QBMapper */ abstract class Mapper { @@ -47,6 +48,7 @@ abstract class Mapper { * @param string $entityClass the name of the entity that the sql should be * mapped to queries without using sql * @since 7.0.0 + * @deprecated 14.0.0 Move over to QBMapper */ public function __construct(IDBConnection $db, $tableName, $entityClass=null){ $this->db = $db; @@ -65,6 +67,7 @@ abstract class Mapper { /** * @return string the table name * @since 7.0.0 + * @deprecated 14.0.0 Move over to QBMapper */ public function getTableName(){ return $this->tableName; @@ -76,6 +79,7 @@ abstract class Mapper { * @param Entity $entity the entity that should be deleted * @return Entity the deleted entity * @since 7.0.0 - return value added in 8.1.0 + * @deprecated 14.0.0 Move over to QBMapper */ public function delete(Entity $entity){ $sql = 'DELETE FROM `' . $this->tableName . '` WHERE `id` = ?'; @@ -90,6 +94,7 @@ abstract class Mapper { * @param Entity $entity the entity that should be created * @return Entity the saved entity with the set id * @since 7.0.0 + * @deprecated 14.0.0 Move over to QBMapper */ public function insert(Entity $entity){ // get updated fields to save, fields have to be set using a setter to @@ -139,6 +144,7 @@ abstract class Mapper { * @param Entity $entity the entity that should be created * @return Entity the saved entity with the set id * @since 7.0.0 - return value was added in 8.0.0 + * @deprecated 14.0.0 Move over to QBMapper */ public function update(Entity $entity){ // if entity wasn't changed it makes no sense to run a db query @@ -195,6 +201,7 @@ abstract class Mapper { * @param array $array * @return bool true if associative * @since 8.1.0 + * @deprecated 14.0.0 Move over to QBMapper */ private function isAssocArray(array $array) { return array_values($array) !== $array; @@ -205,6 +212,7 @@ abstract class Mapper { * @param $value * @return int PDO constant * @since 8.1.0 + * @deprecated 14.0.0 Move over to QBMapper */ private function getPDOType($value) { switch (gettype($value)) { @@ -226,6 +234,7 @@ abstract class Mapper { * @param int $offset from which row we want to start * @return \PDOStatement the database query result * @since 7.0.0 + * @deprecated 14.0.0 Move over to QBMapper */ protected function execute($sql, array $params=[], $limit=null, $offset=null){ $query = $this->db->prepare($sql, $limit, $offset); @@ -249,7 +258,6 @@ abstract class Mapper { return $query; } - /** * Returns an db result and throws exceptions when there are more or less * results @@ -262,6 +270,7 @@ abstract class Mapper { * @throws MultipleObjectsReturnedException if more than one item exist * @return array the result as row * @since 7.0.0 + * @deprecated 14.0.0 Move over to QBMapper */ protected function findOneQuery($sql, array $params=[], $limit=null, $offset=null){ $stmt = $this->execute($sql, $params, $limit, $offset); @@ -297,6 +306,7 @@ abstract class Mapper { * @param int $offset from which row we want to start * @return string formatted error message string * @since 9.1.0 + * @deprecated 14.0.0 Move over to QBMapper */ private function buildDebugMessage($msg, $sql, array $params=[], $limit=null, $offset=null) { return $msg . @@ -313,6 +323,7 @@ abstract class Mapper { * @param array $row the row which should be converted to an entity * @return Entity the entity * @since 7.0.0 + * @deprecated 14.0.0 Move over to QBMapper */ protected function mapRowToEntity($row) { return call_user_func($this->entityClass .'::fromRow', $row); @@ -327,6 +338,7 @@ abstract class Mapper { * @param int $offset from which row we want to start * @return array all fetched entities * @since 7.0.0 + * @deprecated 14.0.0 Move over to QBMapper */ protected function findEntities($sql, array $params=[], $limit=null, $offset=null) { $stmt = $this->execute($sql, $params, $limit, $offset); @@ -354,6 +366,7 @@ abstract class Mapper { * @throws MultipleObjectsReturnedException if more than one item exist * @return Entity the entity * @since 7.0.0 + * @deprecated 14.0.0 Move over to QBMapper */ protected function findEntity($sql, array $params=[], $limit=null, $offset=null){ return $this->mapRowToEntity($this->findOneQuery($sql, $params, $limit, $offset)); |