phpOMS/DataStorage/DataMapperInterface.php

155 lines
3.1 KiB
PHP

<?php
/**
* Orange Management
*
* PHP Version 7.1
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @copyright 2013 Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link http://orange-management.com
*/
namespace phpOMS\DataStorage;
use phpOMS\DataStorage\Database\Query\Builder;
/**
* Datamapper interface.
*
* DB, Cache, Session
*
* @category Framework
* @package phpOMS\DataStorage\Database
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @license OMS License 1.0
* @link http://orange-management.com
* @since 1.0.0
*/
interface DataMapperInterface
{
/**
* Create data.
*
* @param mixed $obj Object reference (gets filled with insert id)
*
* @return mixed
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public static function create($obj);
/**
* Update data.
*
* @param mixed $obj Object reference (gets filled with insert id)
*
* @return int Status
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public static function update($obj) : int;
/**
* Save data.
*
* @return void
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public static function save();
/**
* Delete data.
*
* @param mixed $obj Object to delete
*
* @return int Status
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public static function delete($obj) : int;
/**
* Find data.
*
* @param array $columns Columns
*
* @return Builder
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public static function find(...$columns) : Builder;
/**
* List data.
*
* @param Builder $query Query
*
* @return mixed
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public static function listResults(Builder $query);
/**
* Populate data.
*
* @param array $result Result set
*
* @return mixed
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public static function populate(array $result);
/**
* Populate data.
*
* @param array $result Result set
*
* @return array
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public static function populateIterable(array $result) : array;
/**
* Load.
*
* @param array $objects Objects to load
*
* @return $this
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public static function with(...$objects);
/**
* Get object.
*
* @param mixed $primaryKey Key
*
* @return self
*
* @since 1.0.0
* @author Dennis Eichhorn <d.eichhorn@oms.com>
*/
public static function get($primaryKey);
}